forked from Agoric/agoric-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
251 lines (246 loc) · 9.26 KB
/
docker.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: Build release Docker Images
on:
push:
branches:
# $default-branch
- master
- release-pismo
tags:
- '@agoric/sdk@*'
workflow_dispatch:
jobs:
snapshot:
if: ${{ github.repository_owner == 'agoric' }}
runs-on: ubuntu-latest
outputs:
tag: '${{ steps.snapshot-tag.outputs.tag }}'
steps:
- name: Generate Snapshot Tag
id: snapshot-tag
run: |
COMMIT_TIME=$(curl --fail --silent \
--url https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
| jq '(.commit.committer.date | fromdate)')
TIMESTAMP=`date +%Y%m%d%H%M%S --date="@${COMMIT_TIME}"`
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-6)
SNAPSHOT_TAG="${TIMESTAMP}-${SHORT_SHA}"
echo "::set-output name=tag::$SNAPSHOT_TAG"
docker-sdk:
needs: snapshot
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64/v8
outputs:
tag: '${{ steps.docker-tags.outputs.tags }}'
tags: '${{ steps.docker-tags.outputs.tags }} ${{ needs.snapshot.outputs.tag }}'
steps:
- uses: actions/checkout@v2
- name: Save BUILD_TAG
run: |
ARCH=$(echo '${{ matrix.platform }}' | tr / _)
echo "ALL_ARCHES=linux/amd64 linux/arm64/v8" >> $GITHUB_ENV
echo "BUILD_TAG=${{ needs.snapshot.outputs.tag }}-$ARCH" >> $GITHUB_ENV
- name: Save GIT_REVISION
run: echo "GIT_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Save GIT_COMMIT
run: echo "GIT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Save commit hash, url of submodules to environment
run: |
node packages/xsnap/src/build.js --show-env >> $GITHUB_ENV
- name: Compute docker-tags
id: docker-tags
run: |
SDK_TAG=$(echo "${{ github.ref_name }}" | sed -ne 's!^@agoric/sdk@!!p')
case $SDK_TAG in
"")
if [ "${{ github.ref_name }}" = "release-pismo" ]; then
# A pismo dev release.
DOCKER_TAGS=pismo-dev
else
# Just a dev release.
DOCKER_TAGS=dev
fi
;;
*)
# A tagged SDK release.
# The commit may or may not be a descendant of the current master branch
DOCKER_TAGS="latest $SDK_TAG"
;;
esac
echo "::set-output name=tags::$DOCKER_TAGS"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push deployment
uses: docker/build-push-action@v2
with:
file: packages/deployment/Dockerfile.deployment
context: packages/deployment/docker
platforms: ${{ matrix.platform }}
push: true
tags: 'agoric/deployment:${{ env.BUILD_TAG }}'
- name: Merge and push multi-arch images
run: |
IMAGE=agoric/deployment
for TAG in ${{ steps.docker-tags.outputs.tags }} ${{ needs.snapshot.outputs.tag }}; do
for ARCH in $ALL_ARCHES; do
ARCHTAG=$(echo "$ARCH" | tr / _)
docker manifest create "$IMAGE:$TAG" --amend "$IMAGE:${{ needs.snapshot.outputs.tag }}-$ARCHTAG" || true
done
docker manifest push "$IMAGE:$TAG"
done
- name: Build and Push sdk
uses: docker/build-push-action@v2
with:
file: packages/deployment/Dockerfile.sdk
context: ./
platforms: ${{ matrix.platform }}
push: true
tags: 'agoric/agoric-sdk:${{ env.BUILD_TAG }}'
# When changing/adding entries here, make sure to search the whole
# project for `@@AGORIC_DOCKER_SUBMODULES@@`
build-args: |
GIT_COMMIT=${{env.GIT_COMMIT}}
MODDABLE_COMMIT_HASH=${{env.MODDABLE_COMMIT_HASH}}
MODDABLE_URL=${{env.MODDABLE_URL}}
XSNAP_NATIVE_COMMIT_HASH=${{env.XSNAP_NATIVE_COMMIT_HASH}}
XSNAP_NATIVE_URL=${{env.XSNAP_NATIVE_URL}}
GIT_REVISION=${{env.GIT_REVISION}}
- name: Merge and push multi-arch images
run: |
IMAGE=agoric/agoric-sdk
for TAG in ${{ steps.docker-tags.outputs.tags }} ${{ needs.snapshot.outputs.tag }}; do
for ARCH in $ALL_ARCHES; do
ARCHTAG=$(echo "$ARCH" | tr / _)
docker manifest create "$IMAGE:$TAG" --amend "$IMAGE:${{ needs.snapshot.outputs.tag }}-$ARCHTAG" || true
done
docker manifest push "$IMAGE:$TAG"
done
- name: Build and Push setup
uses: docker/build-push-action@v2
with:
file: packages/deployment/Dockerfile
context: packages/deployment
platforms: ${{ matrix.platform }}
tags: 'agoric/cosmic-swingset-setup:${{ env.BUILD_TAG }}'
push: true
build-args: |
TAG=${{ env.BUILD_TAG }}
- name: Merge and push multi-arch images
run: |
IMAGE=agoric/cosmic-swingset-setup
for TAG in ${{ steps.docker-tags.outputs.tags }} ${{ needs.snapshot.outputs.tag }}; do
for ARCH in $ALL_ARCHES; do
ARCHTAG=$(echo "$ARCH" | tr / _)
docker manifest create "$IMAGE:$TAG" --amend "$IMAGE:${{ needs.snapshot.outputs.tag }}-$ARCHTAG" || true
done
docker manifest push "$IMAGE:$TAG"
done
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
# This is currently needed for the relayer integration test framework.
# It just runs agoric/agoric-sdk with a "single-node" argument.
docker-ibc-alpha:
needs: [docker-sdk, snapshot]
runs-on: ubuntu-latest
if: ${{ needs.docker-sdk.outputs.tag }} != dev
steps:
- uses: actions/checkout@v2
- name: Save SDK_TAG
run: echo "SDK_TAG=${{ needs.snapshot.outputs.tag }}" >> $GITHUB_ENV
- name: Prefix tags
id: prefix-tags
run: |
IMAGE="agoric/agoric-sdk"
for TAG in ibc-alpha; do
PREFIXED="$PREFIXED$sep$IMAGE:$TAG"
sep=,
done
echo "::set-output name=tags::$PREFIXED"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
file: packages/deployment/Dockerfile.ibc-alpha
context: packages/deployment/docker
platforms: linux/amd64,linux/arm64/v8
push: true
tags: '${{ steps.prefix-tags.outputs.tags }}'
build-args: |
SDK_TAG=${{env.SDK_TAG}}
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
docker-solo:
needs: [docker-sdk, snapshot]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Save SDK_TAG
run: echo "SDK_TAG=${{ needs.snapshot.outputs.tag }}" >> $GITHUB_ENV
- name: Prefix tags
id: prefix-tags
run: |
IMAGE="agoric/cosmic-swingset-solo"
for TAG in ${{ needs.docker-sdk.outputs.tags }}; do
PREFIXED="$PREFIXED$sep$IMAGE:$TAG"
sep=,
done
echo "::set-output name=tags::$PREFIXED"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push
uses: docker/build-push-action@v2
with:
file: packages/solo/Dockerfile
context: packages/solo
platforms: linux/amd64,linux/arm64/v8
push: true
tags: '${{ steps.prefix-tags.outputs.tags }}'
build-args: |
TAG=${{env.SDK_TAG}}
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}