FE - Create #287
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
--- | |
name: FE - Create | |
on: | |
workflow_dispatch: | |
inputs: | |
featurenet-name: | |
description: 'Name of the featurenet' | |
type: string | |
required: true | |
ref: | |
description: "git ref: full commit hash, branch, tag - or 'mainnet' or 'testnet'" | |
type: string | |
required: true | |
expiration: | |
description: 'Time after which featurenet will be removed' | |
required: true | |
type: choice | |
options: | |
- 48h | |
- 24h | |
- 12h | |
- 3h | |
- 96h | |
- never | |
default: '48h' | |
validators: | |
description: 'Number of validators to start, from 0 to 50' | |
required: true | |
default: '5' | |
type: string | |
internal: | |
description: 'Internal network, accessible from VPN only' | |
required: true | |
type: boolean | |
default: false | |
short-session: | |
description: 'Use short session aleph-node binary' | |
required: true | |
type: boolean | |
sudo-account-id: | |
description: 'Sudo account ID' | |
type: string | |
required: false | |
default: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' | |
finality-version: | |
description: 'Finality version to start FE with. If specified, it must be a cardinal number. | |
If not specified, it will be generated from the runtime.' | |
type: string | |
required: false | |
workflow_call: | |
inputs: | |
featurenet-name: | |
description: 'Name of the featurenet' | |
type: string | |
required: true | |
ref: | |
description: "git ref: full commit hash, branch, tag - or 'mainnet' or 'testnet'" | |
type: string | |
required: true | |
expiration: | |
description: 'Time after which featurenet will be removed' | |
required: true | |
type: string | |
default: '48h' | |
validators: | |
description: 'Number of validators to start, from 0 to 50' | |
required: true | |
default: '5' | |
type: string | |
internal: | |
description: 'Internal network, accessible from VPN only' | |
required: true | |
type: boolean | |
default: false | |
short-session: | |
description: 'Use short session aleph-node binary' | |
required: true | |
type: boolean | |
sudo-account-id: | |
description: 'Sudo account ID' | |
type: string | |
required: false | |
default: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' | |
finality-version: | |
description: 'Finality version to start FE with. Must be a cardinal number' | |
type: string | |
required: false | |
jobs: | |
validate-inputs: | |
name: Validate inputs | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Validate inputs | |
shell: bash | |
run: | | |
if [[ ! '${{ inputs.featurenet-name }}' =~ ^[a-z0-9][a-z0-9\-]{4,48}$ ]]; then | |
echo '!!! Invalid featurenet name' | |
exit 1 | |
fi | |
if [[ ! '${{ inputs.ref }}' =~ ^[a-zA-Z0-9][a-zA-Z0-9\._\-]{1,48}$ ]]; then | |
echo "!!! Invalid ref" | |
exit 1 | |
fi | |
check-vars-and-secrets: | |
name: Check vars and secrets | |
needs: [validate-inputs] | |
uses: ./.github/workflows/_check-vars-and-secrets.yml | |
secrets: inherit | |
get-full-docker-image-path: | |
name: Get full aleph-node full docker path path | |
needs: [check-vars-and-secrets] | |
runs-on: ubuntu-20.04 | |
outputs: | |
fqdn-image: ${{ steps.get-fqdns.outputs.fqdn-image }} | |
ref: ${{ steps.get-fqdns.outputs.ref }} | |
image-exists: ${{ steps.get-fqdns.outputs.image-exists }} | |
# yamllint disable-line rule:line-length | |
chain-bootstrapper-image-exists: ${{ steps.get-fqdns.outputs.chain-bootstrapper-image-exists }} | |
chain-bootstrapper-fqdn-image: ${{ steps.get-fqdns.outputs.chain-bootstrapper-fqdn-image }} | |
steps: | |
- name: Get aleph-node fqdn path | |
id: get-fqdns | |
uses: Cardinal-Cryptography/github-actions/get-aleph-node-fqdn-image@v7 | |
with: | |
ref: ${{ inputs.ref }} | |
test-binary: ${{ inputs.short-session == true && 'true' || 'false' }} | |
ecr-dev-node-repo: ${{ vars.ECR_DEV_ALEPH_NODE_REPO }} | |
ecr-prod-node-repo: ${{ vars.ECR_ALEPH_NODE_REPO }} | |
ecr-chain-bootstrapper-repo: ${{ vars.ECR_CHAIN_BOOTSTRAPPER_REPO }} | |
only-aleph-nope-production-repo: 'false' | |
build-aleph-node: | |
name: Build aleph-node | |
if: ${{ needs.get-full-docker-image-path.outputs.image-exists != 'true' }} | |
needs: [get-full-docker-image-path] | |
uses: ./.github/workflows/_build-aleph-node.yml | |
with: | |
ref: ${{ needs.get-full-docker-image-path.outputs.ref }} | |
production: ${{ !inputs.short-session }} | |
push-aleph-node-image-to-ecr: | |
name: Build and push aleph-node image to ECR | |
if: ${{ needs.get-full-docker-image-path.outputs.image-exists != 'true' }} | |
needs: | |
- build-aleph-node | |
- get-full-docker-image-path | |
uses: ./.github/workflows/_push-image-to-ecr.yml | |
secrets: inherit | |
with: | |
binary-artifact-name: ${{ needs.build-aleph-node.outputs.artifact-name-binary }} | |
docker-image-name: ${{ needs.get-full-docker-image-path.outputs.fqdn-image }} | |
binary-name: aleph-node | |
docker-file-path: ./docker/Dockerfile | |
build-chain-bootstrapper: | |
needs: [get-full-docker-image-path] | |
if: ${{ needs.get-full-docker-image-path.outputs.chain-bootstrapper-image-exists != 'true' }} | |
name: Build chain-bootstrapper | |
uses: ./.github/workflows/_build-chain-bootstrapper.yml | |
with: | |
ref: ${{ needs.get-full-docker-image-path.outputs.ref }} | |
production: ${{ !inputs.short-session }} | |
push-chain-bootstrapper-image-to-ecr: | |
name: Push chain-bootstrapper docker image to ECR | |
if: ${{ needs.get-full-docker-image-path.outputs.chain-bootstrapper-image-exists != 'true' }} | |
needs: | |
- get-full-docker-image-path | |
- build-chain-bootstrapper | |
uses: ./.github/workflows/_push-image-to-ecr.yml | |
secrets: inherit | |
with: | |
binary-artifact-name: ${{ needs.build-chain-bootstrapper.outputs.artifact-name-binary }} | |
# yamllint disable-line rule:line-length | |
docker-image-name: ${{ needs.get-full-docker-image-path.outputs.chain-bootstrapper-fqdn-image }} | |
binary-name: chain-bootstrapper | |
docker-file-path: ./bin/chain-bootstrapper/Dockerfile | |
create-featurenet: | |
needs: | |
- get-full-docker-image-path | |
- push-aleph-node-image-to-ecr | |
- push-chain-bootstrapper-image-to-ecr | |
# to prevent this job to be skipped when on of the parent jobs is skipped | |
if: ${{ !cancelled() }} | |
name: Create featurenet from ${{ inputs.ref }} | |
uses: Cardinal-Cryptography/github-actions/.github/workflows/_featurenet-create.yml@v7 | |
secrets: inherit | |
with: | |
featurenet-name: ${{ inputs.featurenet-name }} | |
aleph-node-image: ${{ needs.get-full-docker-image-path.outputs.fqdn-image }} | |
# yamllint disable-line rule:line-length | |
chain-bootstrapper-image: ${{ needs.get-full-docker-image-path.outputs.chain-bootstrapper-fqdn-image }} | |
validators: ${{ inputs.validators }} | |
expiration: ${{ inputs.expiration }} | |
internal: ${{ inputs.internal && true || false }} | |
delete-first: true | |
sudo-account-id: ${{ inputs.sudo-account-id }} | |
finality-version: ${{ inputs.finality-version }} |