Skip to content

Trigger tracing node #28

Trigger tracing node

Trigger tracing node #28

name: Trigger tracing node
on:
workflow_dispatch:
inputs:
type:
description: 'Node type'
required: true
type: choice
options:
- mainnets
- testnets
version:
description: 'Darwinia version'
type: string
env:
DOCKER_REGISTRY: ghcr.io
jobs:
bulid-tracing-node:
name: Build tracing node
runs-on: ubuntu-latest
strategy:
matrix:
type:
- mainnets
- testnets
steps:
- uses: actions/checkout@v2
- 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 (testnets)
if: ${{ matrix.type == 'testnets' }}
run: |
mkdir overridden-runtimes
git clone https://github.com/darwinia-network/wasm-runtime-overrides
cd wasm-runtime-overrides
git checkout -b pangolin origin/pangolin
cp -r pangolin ../overridden-runtimes
git checkout -b pangoro origin/pangoro
cp -r pangoro ../overridden-runtimes
- name: Prepare wasm runtime override (mainnets)
if: ${{ matrix.type == 'mainnets' }}
run: |
mkdir overridden-runtimes
git clone https://github.com/darwinia-network/wasm-runtime-overrides
cd wasm-runtime-overrides
git checkout -b darwinia origin/darwinia
cp -r darwinia ../overridden-runtimes
git checkout -b crab origin/crab
cp -r crab ../overridden-runtimes
- name: Prepare build docker image
run: mv overridden-runtimes docker-image/darwinia-tracing
- name: Build darwinia-tracing
uses: docker/build-push-action@v3
if: ${{ github.event.inputs.type == matrix.type }}
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 (testnets)
if: ${{ github.event.inputs.type == 'testnets' && matrix.type == 'testnets' }}
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}"
- 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 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]: [mainnets-tracing] ${MESSAGE}"