Skip to content

Run a node with selected configuration #238

Run a node with selected configuration

Run a node with selected configuration #238

name: 'Run a node with selected configuration'
on:
workflow_dispatch:
inputs:
network:
description: "Select a network on which You want to run a node"
default: "mainnet"
required: true
type: choice
options:
- mainnet
- gnosis
- sepolia
- goerli
- chiado
cl_client:
description: "Select Consensus Layer Client to run node against"
default: ""
required: true
type: choice
options:
- lighthouse
- lodestar
#- nimbus
- prysm
- teku
cl_custom_image:
description: "In case of need to run non-default cl image (different than actually supported by Sedge) put it in there"
default: ""
required: false
config:
description: "Select a config file which will be selected for tests."
default: "default.json"
required: true
type: choice
options:
- default.json
- archiveSync.json
- fastSync.json
- fullSync.json
- fuzzer.json
non_validator_mode:
description: "If checked, node will be started in NonValidator mode (OldBodies and oldReceipts will not be synced)"
default: true
type: boolean
timeout:
description: "Timeout in hours before triggering the deletion of smoke test instances. Maximum time of node lifetime can be 72 hours."
default: "24"
required: true
volume:
description: "In case custom volume size needs to be applied, put value in GB here)"
required: false
default: ""
additional_nethermind_flags:
description: "Provide any additional flags to the Nethermind in space-separated format. Example: \"JsonRpc.Enabled=false Sync.SnapSync=false\"."
default: ""
required: false
additional_cl_flags:
description: "Provide any additional flags to the CL client in space-separated format. Example: \"clflag1=1 clflag2=2\"."
default: ""
required: false
ssh_keys:
description: "SSH Keys to be installed in the smoke test nodes (separated by commas without space in-between commas) for example: key1,key2,key3"
default: ""
required: false
jobs:
create_docker_image:
runs-on: ubuntu-latest
outputs:
base_tag: ${{ steps.set-base-tag.outputs.base_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Prepare docker tag
id: prepare_ref
run: |
REF_NAME=${{ github.ref }}
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "CLEAN_REF=$CLEAN_REF" >> $GITHUB_ENV
- name: Set BASE_TAG
id: set-base-tag
env:
GITHUB_USERNAME: ${{ github.actor }}
run: |
BASE_TAG="${GITHUB_USERNAME:0:1}$(shuf -i 1000-9999 -n 1)"
echo "BASE_TAG=$BASE_TAG" >> $GITHUB_ENV
echo "::set-output name=base_tag::$BASE_TAG"
- name: Creating a node with NodeName="DevNode-${{ github.actor }}-${{ env.BASE_TAG }}-${{ env.CLEAN_REF }}-${{ inputs.network }}-${{ inputs.cl_client }}"
run: echo "NodeName='DevNode-${{ github.actor }}-${{ env.BASE_TAG }}-${{ env.CLEAN_REF }}-${{ inputs.network }}-${{ inputs.cl_client }}'"
- name: Set Repo Variable
run: |
echo "REPO=$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Trigger Docker Build Action with Cleaned Ref
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-nethermind-docker-images.yml
ref: "${{ github.ref }}"
token: "${{ secrets.REPOSITORY_DISPATCH_TOKEN }}"
inputs: '{
"repo": "${{ env.REPO }}",
"tag": "${{ env.CLEAN_REF }}",
"dockerfile": "Dockerfile"
}'
- name: Set Repo and Org Variables
run: |
echo "ORG_NAME=$(echo $GITHUB_REPOSITORY | cut -d / -f 1)" >> $GITHUB_ENV
echo "REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d / -f 2)" >> $GITHUB_ENV
- name: Wait for Docker Build Action to complete
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
WORKFLOW_ID: 'build-nethermind-docker-images.yml'
MAX_WAIT_MINUTES: '5'
INTERVAL: '5'
TIMEOUT: '10'
ORG_NAME: ${{ env.ORG_NAME }}
REPO_NAME: ${{ env.REPO_NAME }}
REF: ${{ github.ref }}
run: |
chmod +x scripts/wait-for-workflow-completed.sh
./scripts/wait-for-workflow-completed.sh
working-directory: ${{ github.workspace }}
trigger_node_and_vm_creation:
needs: create_docker_image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Prepare docker tag
id: prepare_ref
run: |
REF_NAME=${{ github.ref }}
CLEAN_REF=$(echo "${REF_NAME/refs\/heads\//}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "CLEAN_REF=$CLEAN_REF" >> $GITHUB_ENV
- name: Use BASE_TAG
run: |
echo "BASE_TAG=${{ needs.create_docker_image.outputs.base_tag }}" >> $GITHUB_ENV
- name: Trigger Node creation Repo Action
run: |
echo $INPUTS | gh -R $WORKFLOW_REPO workflow run $WORKFLOW_ID --ref $WORKFLOW_REF --json
env:
WORKFLOW_ID: 'run-single-node.yml'
WORKFLOW_REF: main
WORKFLOW_REPO: NethermindEth/post-merge-smoke-tests
GITHUB_USER: ${{ secrets.REPOSITORY_DISPATCH_USER }}
GITHUB_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
INPUTS: >
{
"github_username": "${{ github.actor }}",
"base_tag": "${{ env.BASE_TAG }}",
"config_file": "${{ inputs.config }}",
"nethermind_branch": "${{ env.CLEAN_REF }}",
"network": "${{ inputs.network }}",
"cl_client": "${{ inputs.cl_client }}",
"additional_options":
"{
\"cl_custom_image\":\"${{ inputs.cl_custom_image }}\",
\"timeout\":\"${{ inputs.timeout }}\",
\"non_validator_mode\":\"${{ inputs.non_validator_mode }}\",
\"volume\":\"${{ inputs.volume }}\",
\"additional_nethermind_flags\":\"${{ inputs.additional_nethermind_flags }}\",
\"additional_cl_flags\":\"${{ inputs.additional_cl_flags }}\",
\"ssh_keys\":\"${{ inputs.ssh_keys }}\"
}"
}
- name: Wait for creation of node
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
WORKFLOW_ID: 'run-single-node.yml'
MAX_WAIT_MINUTES: '5'
INTERVAL: '5'
TIMEOUT: '20'
ORG_NAME: 'NethermindEth'
REPO_NAME: 'post-merge-smoke-tests'
REF: 'main'
run: |
chmod +x scripts/wait-for-workflow-completed.sh
./scripts/wait-for-workflow-completed.sh
working-directory: ${{ github.workspace }}