Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 728b51e

Browse files
committed
Update GHA workflows to use ephemeral ec2 runners
The hardware we were previously using for multi-arch builds is being end-of-lifed so this is the next best solution. Signed-off-by: Ryan Beck-Buysse <[email protected]>
1 parent 9814437 commit 728b51e

File tree

3 files changed

+355
-6
lines changed

3 files changed

+355
-6
lines changed

.github/workflows/grid-dev.yaml

+79-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,54 @@ on:
33
- push
44
- workflow_dispatch
55
jobs:
6+
start_cluster:
7+
if: github.repository == 'hyperledger/grid'
8+
name: Start buildx cluster
9+
runs-on: ubuntu-latest
10+
outputs:
11+
label: ${{ steps.start_buildx_cluster.outputs.label }}
12+
permissions:
13+
id-token: write
14+
contents: read
15+
steps:
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@v1
18+
with:
19+
aws-region: ${{ secrets.AWS_BUILDX_REGION }}
20+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
21+
22+
- uses: actions/checkout@v2
23+
24+
- name: Start EC2 runner
25+
id: start_buildx_cluster
26+
uses: ./.github/actions/ec2-runners
27+
with:
28+
action: start
29+
amd_ami_id: ${{ secrets.AMD_AMI_ID }}
30+
amd_instance_type: ${{ secrets.AMD_INSTANCE_TYPE }}
31+
arm_ami_id: ${{ secrets.ARM_AMI_ID }}
32+
arm_instance_type: ${{ secrets.ARM_INSTANCE_TYPE }}
33+
gh_personal_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
34+
security_group_id: ${{ secrets.SECURITY_GROUP_ID }}
35+
subnet: ${{ secrets.SUBNET }}
36+
37+
- name: Output label
38+
run: echo ${{ steps.start_buildx_cluster.outputs.label }}
39+
40+
- name: Notify Slack of Failure
41+
if: cancelled() || failure()
42+
uses: 8398a7/action-slack@v3
43+
with:
44+
status: ${{ job.status }}
45+
fields: repo,message,author,job
46+
env:
47+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
48+
649
build_grid_dev:
750
if: github.repository == 'hyperledger/grid'
851
name: Build grid-dev
9-
runs-on: macos-arm
52+
needs: start_cluster
53+
runs-on: ${{ needs.start_cluster.outputs.label }}
1054
steps:
1155
- name: Login to DockerHub
1256
uses: docker/login-action@v1
@@ -31,3 +75,37 @@ jobs:
3175
fields: repo,message,author,job
3276
env:
3377
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
78+
79+
stop_cluster:
80+
name: Stop buildx cluster
81+
needs:
82+
- start_cluster
83+
- build_grid_dev
84+
runs-on: ubuntu-latest
85+
if: ${{ github.repository == 'hyperledger/grid' && always() }}
86+
permissions:
87+
id-token: write
88+
contents: read
89+
steps:
90+
- name: Configure AWS credentials
91+
uses: aws-actions/configure-aws-credentials@v1
92+
with:
93+
aws-region: ${{ secrets.AWS_BUILDX_REGION }}
94+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
95+
96+
- uses: actions/checkout@v2
97+
98+
- name: Destroy cluster
99+
uses: ./.github/actions/ec2-runners
100+
with:
101+
action: stop
102+
label: ${{ needs.start_cluster.outputs.label }}
103+
104+
- name: Notify Slack of Failure
105+
if: cancelled() || failure()
106+
uses: 8398a7/action-slack@v3
107+
with:
108+
status: ${{ job.status }}
109+
fields: repo,message,author,job
110+
env:
111+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/publish-docker-branch.yaml

+192-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,56 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
publish_docker_images:
16+
start_cluster_nightly:
1717
if: >-
1818
github.repository_owner == 'hyperledger'
19-
runs-on: macos-arm
19+
name: Start buildx cluster
20+
runs-on: ubuntu-latest
21+
outputs:
22+
label: ${{ steps.start-buildx-cluster.outputs.label }}
23+
permissions:
24+
id-token: write
25+
contents: read
26+
steps:
27+
- name: Configure AWS credentials
28+
uses: aws-actions/configure-aws-credentials@v1
29+
with:
30+
aws-region: ${{ secrets.AWS_BUILDX_REGION }}
31+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
32+
33+
- uses: actions/checkout@v2
34+
35+
- name: Start EC2 runner
36+
id: start-buildx-cluster
37+
uses: ./.github/actions/ec2-runners
38+
with:
39+
action: start
40+
amd_ami_id: ${{ secrets.AMD_AMI_ID }}
41+
amd_instance_type: c6i.4xlarge
42+
arm_ami_id: ${{ secrets.ARM_AMI_ID }}
43+
arm_instance_type: c6g.4xlarge
44+
gh_personal_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
45+
security_group_id: ${{ secrets.SECURITY_GROUP_ID }}
46+
subnet: ${{ secrets.SUBNET }}
47+
48+
- name: Output label
49+
run: echo ${{ steps.start-buildx-cluster.outputs.label }}
50+
51+
- name: Notify Slack of Failure
52+
if: failure()
53+
uses: 8398a7/action-slack@v3
54+
with:
55+
status: ${{ job.status }}
56+
fields: repo,message,author,job
57+
env:
58+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
59+
60+
publish_docker_nightly:
61+
if: >-
62+
github.repository_owner == 'hyperledger'
63+
needs:
64+
- start_cluster_nightly
65+
runs-on: ${{ needs.start_cluster_nightly.outputs.label }}
2066
steps:
2167
- name: Display envvars
2268
run: env
@@ -31,13 +77,122 @@ jobs:
3177
with:
3278
fetch-depth: 0
3379

34-
- name: Publish main images to dockerhub
80+
- name: Publish nightly images to dockerhub
3581
run: docker buildx ls && ./ci/publish-docker nightly
3682
env:
3783
NAMESPACE: ${{ secrets.DOCKER_HUB_NAMESPACE }}/
3884
VERSION: AUTO_STRICT
3985
CARGO_TERM_COLOR: always
4086

87+
- name: Notify Slack of Failure
88+
if: failure()
89+
uses: 8398a7/action-slack@v3
90+
with:
91+
status: ${{ job.status }}
92+
fields: repo,message,author,job
93+
env:
94+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
95+
96+
stop_cluster_nightly:
97+
if: ${{ github.repository == 'hyperledger/grid' && always() }}
98+
name: Stop buildx cluster
99+
needs:
100+
- start_cluster_nightly
101+
- publish_docker_nightly
102+
runs-on: ubuntu-latest
103+
permissions:
104+
id-token: write
105+
contents: read
106+
steps:
107+
- name: Configure AWS credentials
108+
uses: aws-actions/configure-aws-credentials@v1
109+
with:
110+
aws-region: ${{ secrets.AWS_BUILDX_REGION }}
111+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
112+
113+
- uses: actions/checkout@v2
114+
115+
- name: Destroy cluster
116+
uses: ./.github/actions/ec2-runners
117+
with:
118+
action: stop
119+
label: ${{ needs.start_cluster_nightly.outputs.label }}
120+
121+
- name: Notify Slack of Failure
122+
if: failure()
123+
uses: 8398a7/action-slack@v3
124+
with:
125+
status: ${{ job.status }}
126+
fields: repo,message,author,job
127+
env:
128+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
129+
130+
# --== experimental images ==--
131+
132+
start_cluster_experimental:
133+
if: >-
134+
github.repository_owner == 'hyperledger'
135+
name: Start buildx cluster
136+
runs-on: ubuntu-latest
137+
outputs:
138+
label: ${{ steps.start-buildx-cluster.outputs.label }}
139+
permissions:
140+
id-token: write
141+
contents: read
142+
steps:
143+
- name: Configure AWS credentials
144+
uses: aws-actions/configure-aws-credentials@v1
145+
with:
146+
aws-region: ${{ secrets.AWS_BUILDX_REGION }}
147+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
148+
149+
- uses: actions/checkout@v2
150+
151+
- name: Start EC2 runner
152+
id: start-buildx-cluster
153+
uses: ./.github/actions/ec2-runners
154+
with:
155+
action: start
156+
amd_ami_id: ${{ secrets.AMD_AMI_ID }}
157+
amd_instance_type: c6i.4xlarge
158+
arm_ami_id: ${{ secrets.ARM_AMI_ID }}
159+
arm_instance_type: c6g.4xlarge
160+
gh_personal_access_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
161+
security_group_id: ${{ secrets.SECURITY_GROUP_ID }}
162+
subnet: ${{ secrets.SUBNET }}
163+
164+
- name: Output label
165+
run: echo ${{ steps.start-buildx-cluster.outputs.label }}
166+
167+
- name: Notify Slack of Failure
168+
if: failure()
169+
uses: 8398a7/action-slack@v3
170+
with:
171+
status: ${{ job.status }}
172+
fields: repo,message,author,job
173+
env:
174+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
175+
176+
publish_docker_experimental:
177+
if: >-
178+
github.repository_owner == 'hyperledger'
179+
needs:
180+
- start_cluster_experimental
181+
runs-on: ${{ needs.start_cluster_experimental.outputs.label }}
182+
steps:
183+
- name: Display envvars
184+
run: env
185+
186+
- name: Login to DockerHub
187+
uses: docker/login-action@v1
188+
with:
189+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
190+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
191+
192+
- uses: actions/checkout@v2
193+
with:
194+
fetch-depth: 0
195+
41196
- name: Publish experimental images to dockerhub
42197
run: docker buildx ls && ./ci/publish-docker experimental
43198
env:
@@ -53,3 +208,37 @@ jobs:
53208
fields: repo,message,author,job
54209
env:
55210
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
211+
212+
stop_cluster_experimental:
213+
if: ${{ github.repository == 'hyperledger/grid' && always() }}
214+
name: Stop buildx cluster
215+
needs:
216+
- start_cluster_experimental
217+
- publish_docker_experimental
218+
runs-on: ubuntu-latest
219+
permissions:
220+
id-token: write
221+
contents: read
222+
steps:
223+
- name: Configure AWS credentials
224+
uses: aws-actions/configure-aws-credentials@v1
225+
with:
226+
aws-region: ${{ secrets.AWS_BUILDX_REGION }}
227+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
228+
229+
- uses: actions/checkout@v2
230+
231+
- name: Destroy cluster
232+
uses: ./.github/actions/ec2-runners
233+
with:
234+
action: stop
235+
label: ${{ needs.start_cluster_experimental.outputs.label }}
236+
237+
- name: Notify Slack of Failure
238+
if: failure()
239+
uses: 8398a7/action-slack@v3
240+
with:
241+
status: ${{ job.status }}
242+
fields: repo,message,author,job
243+
env:
244+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)