@@ -13,10 +13,56 @@ concurrency:
1313 cancel-in-progress : true
1414
1515jobs :
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