diff --git a/.github/workflows/trigger-tracing-node.yml b/.github/workflows/trigger-tracing-node.yml index 24de37c..beeffdc 100644 --- a/.github/workflows/trigger-tracing-node.yml +++ b/.github/workflows/trigger-tracing-node.yml @@ -3,15 +3,23 @@ name: Trigger tracing node on: workflow_dispatch: inputs: - type: - description: 'Node type' + # type: + # description: 'Node type' + # required: true + # type: choice + # options: + # - mainnets + # - testnets + network: + description: "Network" required: true type: choice options: - - mainnets - - testnets + - darwinia + - crab + - pangolin version: - description: 'Darwinia version' + description: 'Version' type: string env: @@ -39,25 +47,13 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ${{ env.DOCKER_REGISTRY }} - - name: Prepare wasm runtime override (testnets) - if: ${{ matrix.type == 'testnets' }} - run: | - mkdir overridden-runtimes - git clone https://github.com/darwinia-network/darwinia-release - cd darwinia-release - git checkout -b pangolin origin/pangolin - cp -r wasm ../overridden-runtimes/pangolin - - - name: Prepare wasm runtime override (mainnets) - if: ${{ matrix.type == 'mainnets' }} + - name: Prepare wasm runtime override (${{ github.event.inputs.network }}) run: | mkdir overridden-runtimes git clone https://github.com/darwinia-network/darwinia-release cd darwinia-release - git checkout -b darwinia origin/darwinia - cp -r wasm ../overridden-runtimes/darwinia - git checkout -b crab origin/crab - cp -r wasm ../overridden-runtimes/crab + git checkout -b ${{ github.event.inputs.network }} origin/${{ github.event.inputs.network }} + cp -r wasm ../overridden-runtimes/${{ github.event.inputs.network }} - name: Prepare build docker image run: mv overridden-runtimes docker-image/darwinia-tracing @@ -74,51 +70,27 @@ jobs: build-args: | DARWINIA_VERSION=${{ env.DARWINIA_VERSION }} - - name: Trigger deploy (testnets) - if: ${{ github.event.inputs.type == 'testnets' && matrix.type == 'testnets' }} + - name: Trigger deploy (${{ github.event.inputs.network }}) env: DARWINIA_VERSION: ${{ github.event.inputs.version }} GITHUB_TOKEN: ${{ secrets.GH_TKN_DARWINIA }} run: | MESSAGE='${{ github.event.head_commit.message }}' DOCKER_IMAGE_TAG=${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/darwinia-tracing:${{ env.DARWINIA_VERSION }} - - jq -n \ - --arg file playbooks/pangolin_nodes/host_vars/g3.testnets \ - --arg key .substrate_node_runner.node.image \ - --arg value ${DOCKER_IMAGE_TAG} \ - '{file: $file, key: $key, value: $value}' >> /tmp/changes.json - #jq -n \ - # --arg file playbooks/pangoro_nodes/host_vars/g3.testnets \ - # --arg key .substrate_node_runner.node.image \ - # --arg value ${DOCKER_IMAGE_TAG} \ - # '{file: $file, key: $key, value: $value}' >> /tmp/changes.json - - MULTI_CHANGES=$(jq -crs '.' < /tmp/changes.json) - - gh workflow run \ - trigger.yml \ - --ref=main \ - --repo=darwinia-network/ansible-playbooks \ - --raw-field="changes=${MULTI_CHANGES}" \ - --raw-field="message=[devops]: [testnets-tracing] ${MESSAGE}" + NETWORK='${{ github.event.inputs.network }}' + EFFECT_FILE='' + if [[ "${NETWORK}" == "pangolin" ]]; then + EFFECT_FILE=playbooks/pangolin_nodes/host_vars/g3.testnets + fi + if [[ "${NETWORK}" == "crab" ]]; then + EFFECT_FILE=playbooks/crab_nodes/host_vars/c1.crab2 + fi + if [[ "${NETWORK}" == "darwinia" ]]; then + EFFECT_FILE=playbooks/darwinia_nodes/host_vars/c1.darwinia2 + fi - - name: Trigger deploy (mainnets) - if: ${{ github.event.inputs.type == 'mainnets' && matrix.type == 'mainnets' }} - env: - DARWINIA_VERSION: ${{ github.event.inputs.version }} - GITHUB_TOKEN: ${{ secrets.GH_TKN_DARWINIA }} - run: | - MESSAGE='${{ github.event.head_commit.message }}' - DOCKER_IMAGE_TAG=${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/darwinia-tracing:${{ env.DARWINIA_VERSION }} - jq -n \ - --arg file playbooks/crab_nodes/host_vars/c1.crab2 \ - --arg key .substrate_node_runner.node.image \ - --arg value ${DOCKER_IMAGE_TAG} \ - '{file: $file, key: $key, value: $value}' >> /tmp/changes.json - jq -n \ - --arg file playbooks/darwinia_nodes/host_vars/c1.darwinia2 \ + --arg file ${EFFECT_FILE} \ --arg key .substrate_node_runner.node.image \ --arg value ${DOCKER_IMAGE_TAG} \ '{file: $file, key: $key, value: $value}' >> /tmp/changes.json @@ -130,5 +102,6 @@ jobs: --ref=main \ --repo=darwinia-network/ansible-playbooks \ --raw-field="changes=${MULTI_CHANGES}" \ - --raw-field="message=[devops]: [mainnets-tracing] ${MESSAGE}" + --raw-field="message=[devops]: [tracing-${NETWORK}] ${MESSAGE}" +