Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[humanitec] Add compatibility with RHDH dynamic plugins... #401

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/humanitec-backend-scaffolder-module/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
97 changes: 97 additions & 0 deletions plugins/humanitec-backend-scaffolder-module/README.md
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
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@frontside/backstage-plugin-humanitec-scaffolder-backend-module-dynamic",
"version": "0.3.16",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "backend-plugin-module"
},
"scripts": {},
"dependencies": {
"@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": {},
"files": [
"dist"
],
"bundleDependencies": true,
"peerDependencies": {
"@backstage/backend-common": "^0.21.3",
"@backstage/backend-plugin-api": "^0.6.13",
"@backstage/config": "^1.1.1",
"@backstage/plugin-scaffolder-backend": "^1.19.1",
"@backstage/plugin-scaffolder-node": "^0.3.3"
},
"overrides": {
"@aws-sdk/util-utf8-browser": {
"@smithy/util-utf8": "^2.0.0"
}
},
"resolutions": {
"@aws-sdk/util-utf8-browser": "npm:@smithy/util-utf8@~2",
"@frontside/backstage-plugin-humanitec-backend": "file:./embedded/frontside-backstage-plugin-humanitec-backend",
"@frontside/backstage-plugin-humanitec-common": "file:./embedded/frontside-backstage-plugin-humanitec-common"
}
}
Loading
Loading