Skip to content

Trigger tracing node #222

Trigger tracing node

Trigger tracing node #222

name: Trigger tracing node
on:
workflow_dispatch:
inputs:
network:
description: "Network"
required: true
type: choice
options:
- darwinia
- crab
- koi
version:
description: 'Version'
type: string
env:
DOCKER_REGISTRY: ghcr.io
jobs:
bulid-tracing-node:
name: Build tracing node
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}
- 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 ${{ 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
- name: Build darwinia-tracing
uses: docker/build-push-action@v3
env:
DARWINIA_VERSION: ${{ github.event.inputs.version }}
with:
push: true
context: docker-image/darwinia-tracing
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/darwinia-tracing:${{ env.DARWINIA_VERSION }}
build-args: |
DARWINIA_VERSION=${{ env.DARWINIA_VERSION }}
- 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 }}
NETWORK='${{ github.event.inputs.network }}'
EFFECT_FILE=''
if [[ "${NETWORK}" == "koi" ]]; then
EFFECT_FILE=playbooks/koi_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
jq -n \
--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
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]: [tracing-${NETWORK}] ${MESSAGE}"