-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[humanitec] Add compatibility with RHDH dynamic plugins...
... mainly by adding support for the new backend system.
- Loading branch information
1 parent
ffac9ff
commit 53290b0
Showing
14 changed files
with
2,170 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
172 changes: 172 additions & 0 deletions
172
plugins/humanitec-backend-scaffolder-module/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
# @frontside/backstage-plugin-humanitec-backend | ||
|
||
## 0.3.16 | ||
|
||
### Patch Changes | ||
|
||
- fc748dd: Handle disconnects while fetching app info | ||
|
||
## 0.3.15 | ||
|
||
### Patch Changes | ||
|
||
- b9e57e3: Continue polling when an error is returned. | ||
|
||
## 0.3.14 | ||
|
||
### Patch Changes | ||
|
||
- bfed947: Deduplicate updates for the same orgId/appId | ||
- Updated dependencies [bfed947] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.12 | ||
|
||
## 0.3.13 | ||
|
||
### Patch Changes | ||
|
||
- c161cc4: Fixed connection when using authenticated API requests | ||
- Updated dependencies [c161cc4] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.11 | ||
|
||
## 0.3.12 | ||
|
||
### Patch Changes | ||
|
||
- b6f76c1: Bump Backstage to `1.20.x` along with related dependencies. This includes a bump of Knex to v3. Additionally, this version of Backstage begins to shift scaffolder alpha features into the mainline which affects the types in related packages. | ||
- Updated dependencies [b6f76c1] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.10 | ||
|
||
## 0.3.11 | ||
|
||
### Patch Changes | ||
|
||
- c503329: Bump Backstage to 1.18.4 and related dependencies. | ||
- Updated dependencies [c503329] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.9 | ||
|
||
## 0.3.10 | ||
|
||
### Patch Changes | ||
|
||
- edf4591: Backport graphql plugins from Backstage PRFC [#15519](https://github.com/backstage/backstage/pull/15519) | ||
|
||
## 0.3.9 | ||
|
||
### Patch Changes | ||
|
||
- 181c413: Upgraded to Backstage 1.17 | ||
- Updated dependencies [181c413] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.8 | ||
|
||
## 0.3.8 | ||
|
||
### Patch Changes | ||
|
||
- d8cbd21: bump backstage | ||
- Updated dependencies [d8cbd21] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.7 | ||
|
||
## 0.3.7 | ||
|
||
### Patch Changes | ||
|
||
- 1c1b178: Upgraded to Backstage 1.12.1 | ||
- Updated dependencies [1c1b178] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.6 | ||
|
||
## 0.3.6 | ||
|
||
### Patch Changes | ||
|
||
- 05f3423: Upgraded to Backstage 1.11.1 | ||
- Updated dependencies [05f3423] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.4 | ||
|
||
## 0.3.5 | ||
|
||
### Patch Changes | ||
|
||
- d803873: upgrade backstage dependencies | ||
- Updated dependencies [d803873] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.3 | ||
|
||
## 0.3.4 | ||
|
||
### Patch Changes | ||
|
||
- d62b0ad: Upgraded to Backstage 1.9 | ||
- Updated dependencies [d62b0ad] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.2 | ||
|
||
## 0.3.3 | ||
|
||
### Patch Changes | ||
|
||
- da0b58f: Fix Humanitec package distribution | ||
- Updated dependencies [da0b58f] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.1 | ||
|
||
## 0.3.2 | ||
|
||
### Patch Changes | ||
|
||
- ad0fde9: Upgrade backstage to 1.7 and bump effection dependencies | ||
|
||
## 0.3.1 | ||
|
||
### Patch Changes | ||
|
||
- 2a52c92: Upgraded dependencies to bring inline with Backstage 1.6 | ||
- Updated dependencies [2a52c92] | ||
- Updated dependencies [e914d87] | ||
- @frontside/backstage-plugin-humanitec-common@0.3.0 | ||
|
||
## 0.3.0 | ||
|
||
### Minor Changes | ||
|
||
- 2837d26: Doing a minor release to show that publishing is working | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [2837d26] | ||
- @frontside/backstage-plugin-humanitec-common@0.2.0 | ||
|
||
## 0.2.4 | ||
|
||
### Patch Changes | ||
|
||
- Manually publish packages | ||
- Updated dependencies | ||
- @frontside/backstage-plugin-humanitec-common@0.1.4 | ||
|
||
## 0.2.3 | ||
|
||
### Patch Changes | ||
|
||
- bf70ff9: Fixed publishing pipeline and releasing | ||
- Updated dependencies [bf70ff9] | ||
- @frontside/backstage-plugin-humanitec-common@0.1.3 | ||
|
||
## 0.2.2 | ||
|
||
### Patch Changes | ||
|
||
- 3ee04fe: Nothing changed, just experimenting with preview publish | ||
- Updated dependencies [3ee04fe] | ||
- @frontside/backstage-plugin-humanitec-common@0.1.2 | ||
|
||
## 0.2.1 | ||
|
||
### Patch Changes | ||
|
||
- 0fc9f4f: Introducing a @frontside/backstage-plugin-humanitec-common package | ||
- b95bda8: Adding missing dist files from Humanitec bundles | ||
- Updated dependencies [0fc9f4f] | ||
- @frontside/backstage-plugin-humanitec-common@0.1.1 | ||
|
||
## 0.2.0 | ||
|
||
### Minor Changes | ||
|
||
- c3e89bd: Initial release of Humanitec plugin for Backstage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# @frontside/backstage-plugin-humanitec-scaffolder-backend-module | ||
|
||
`@frontside/backstage-plugin-humanitec-backend` is a plugin for the Backstage backend app. It provides a route that `@frontside/backstage-plugin-humanitec` will use to connect to Humanitec API and scaffolder actions. | ||
`@frontside/backstage-plugin-humanitec-scaffolder-backend-module` is a new backend system module to add the humanitec action in the scaffolder | ||
|
||
## Scaffolder Actions | ||
|
||
This plugin provides the following scaffolder actions, | ||
|
||
### create-app | ||
|
||
`create-app` will create an app in Humanitec with specific workloads and automation. | ||
|
||
#### Installation | ||
|
||
TBD | ||
|
||
... | ||
|
||
|
||
4. Add configuration to `app-config.yaml` | ||
|
||
```diff | ||
humanitec: | ||
orgId: the-frontside-software-inc | ||
token: ${HUMANITEC_TOKEN} | ||
``` | ||
|
||
### Usage | ||
|
||
Add the action to your template, | ||
|
||
```diff | ||
+ - name: Create Humanitec App | ||
+ id: humanitec-create-app | ||
+ action: humanitec:create-app | ||
+ input: | ||
+ setupFile: humanitec-apps.yaml | ||
+ appId: ${{ parameters.componentName }} | ||
``` | ||
|
||
### setupFile parameter | ||
|
||
`humanitec:create-app` needs to know what workloads to create in the Humanitec App. In the future, workload configuration will be handled using [paws.sh](https://paws.sh), in the mean time, `humanitec:create-app` expects to read an YAML file where it expects to find information about the payload. By default, this file is called `humanitec-app.yaml` and can be changed by specifying `setupFile` parameter. | ||
|
||
Here is an example of such a file, | ||
|
||
```yaml | ||
--- | ||
id: ${{values.componentName | dump}} | ||
name: ${{values.componentName | dump}} | ||
|
||
environments: | ||
development: | ||
metadata: | ||
env_id: development | ||
name: Initial deployment | ||
|
||
modules: | ||
${{values.componentName | dump}}: | ||
externals: | ||
http: | ||
type: dns | ||
profile: humanitec/default-module | ||
spec: | ||
containers: | ||
${{values.componentName | dump}}: | ||
id: ${{values.componentName}} | ||
image: ${{values.registryUrl}}/${{values.componentName}}:dummy | ||
resources: | ||
limits: | ||
cpu: 0.25 | ||
memory: 256Mi | ||
requests: | ||
cpu: 0.025 | ||
memory: 64Mi | ||
variables: {} | ||
volume_mounts: {} | ||
files: {} | ||
ingress: | ||
rules: | ||
externals.http: | ||
http: | ||
"/": | ||
port: 9898 | ||
type: prefix | ||
|
||
# automations that will be created | ||
# see https://api-docs.humanitec.com/#tag/AutomationRule/paths/~1orgs~1{orgId}~1apps~1{appId}~1envs~1{envId}~1rules/post | ||
automations: | ||
development: | ||
- active: true | ||
exclude_images_filter: false | ||
images_filter: [] | ||
type: update | ||
update_to: branch | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "@frontside/backstage-plugin-humanitec-scaffolder-backend-module", | ||
"version": "0.3.16", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "dist/index.cjs.js", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"backstage": { | ||
"role": "backend-plugin-module" | ||
}, | ||
"scripts": { | ||
"start": "backstage-cli package start", | ||
"build": "backstage-cli package build", | ||
"lint": "backstage-cli package lint", | ||
"test": "backstage-cli package test", | ||
"clean": "backstage-cli package clean", | ||
"prepack": "backstage-cli package prepack", | ||
"postpack": "backstage-cli package postpack" | ||
}, | ||
"dependencies": { | ||
"@backstage/backend-common": "^0.19.9", | ||
"@backstage/backend-plugin-api": "^0.6.14", | ||
"@backstage/config": "^1.1.1", | ||
"@backstage/plugin-scaffolder-backend": "^1.19.1", | ||
"@backstage/plugin-scaffolder-node": "^0.2.9", | ||
"@frontside/backstage-plugin-humanitec-backend": "^0.3.16", | ||
"@frontside/backstage-plugin-humanitec-common": "^0.3.12", | ||
"@types/express": "*", | ||
"cross-fetch": "3.1.5", | ||
"express": "^4.17.1", | ||
"express-promise-router": "^4.1.0", | ||
"js-yaml": "^4.1.0", | ||
"node-fetch": "^2.6.7", | ||
"winston": "^3.2.1", | ||
"yn": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.24.0", | ||
"@types/js-yaml": "^4.0.5", | ||
"@types/supertest": "^2.0.8", | ||
"msw": "^0.35.0", | ||
"supertest": "^4.0.2" | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright 2022 The Frontside Software, Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export { createHumanitecApp } from '@frontside/backstage-plugin-humanitec-backend'; | ||
export { humanitecModule as default } from './module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { | ||
createBackendModule, | ||
coreServices, | ||
} from '@backstage/backend-plugin-api'; | ||
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; | ||
import { createHumanitecApp } from '@frontside/backstage-plugin-humanitec-backend'; | ||
|
||
/** | ||
* @public | ||
* The Humanitec Module for the Scaffolder Backend Plugin | ||
*/ | ||
export const humanitecModule = createBackendModule({ | ||
moduleId: 'humanitec-scaffolder-module', | ||
pluginId: 'scaffolder', | ||
register({ registerInit }) { | ||
registerInit({ | ||
deps: { | ||
scaffolderActions: scaffolderActionsExtensionPoint, | ||
config: coreServices.rootConfig, | ||
}, | ||
async init({ scaffolderActions, config }) { | ||
scaffolderActions.addActions( | ||
createHumanitecApp({ | ||
orgId: config.getString('humanitec.orgId'), | ||
token: config.getString('humanitec.token') | ||
}), | ||
); | ||
}, | ||
}); | ||
}, | ||
}); |
Oops, something went wrong.