-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (118 loc) · 4.88 KB
/
trigger-tracing-node.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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}"