forked from google/android-cuttlefish
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-cache-and-deployment.yaml
More file actions
245 lines (241 loc) · 9.46 KB
/
Copy pathupdate-cache-and-deployment.yaml
File metadata and controls
245 lines (241 loc) · 9.46 KB
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
name: Update bazel cache and deploy artifacts
on:
workflow_call:
inputs:
update-cache:
required: true
type: boolean
deploy-channel:
required: false
type: string
secrets:
artifact-registry-uploader-json-creds:
required: true
jobs:
set-variables:
runs-on: ubuntu-22.04
outputs:
yyyymmddhhmm: ${{ steps.yyyymmddhhmm.outputs.time }}
steps:
- name: Set YYYYMMDDHHMM
id: yyyymmddhhmm
run: echo "time=$(date -u +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
- name: Echo YYYYMMDDHHMM
run: echo ${STEPS_YYYYMMDDHHMM_OUTPUTS_TIME}
env:
STEPS_YYYYMMDDHHMM_OUTPUTS_TIME: ${{ steps.yyyymmddhhmm.outputs.time }}
update-cvd-test-bazel-cache:
if: inputs.update-cache
runs-on: ubuntu-24.04
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
large-packages: false
swap-storage: false
tool-cache: true
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Mount bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
action-name: run-cvd-unit-tests
writable: true
- name: Run cvd unit tests
uses: ./.github/actions/run-cvd-unit-tests
update-bazel-cache-and-deploy-debian-package-amd64:
needs: [set-variables]
environment: deployment
runs-on: ubuntu-22.04
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # aka v1.3.1
with:
docker-images: false
swap-storage: false
- name: checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Mount bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
action-name: build-debian-packages
writable: '${{ inputs.update-cache }}'
- name: Build CF host debian packages
uses: ./.github/actions/build-debian-packages
with:
deploy-channel: ${{ inputs.deploy-channel }}
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
- name: Authentication on GCP project android-cuttlefish-artifacts
if: inputs.deploy-channel != ''
uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Deploy CF host debian packages
if: inputs.deploy-channel != ''
uses: ./.github/actions/deploy-debian-packages
with:
deploy-channel: ${{ inputs.deploy-channel }}
path: .
update-bazel-cache-and-deploy-debian-package-arm64:
needs: [set-variables]
environment: deployment
runs-on: ubuntu-22.04-arm
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # aka v1.3.1
with:
docker-images: false
swap-storage: false
- name: checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Mount bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
action-name: build-debian-packages
writable: '${{ inputs.update-cache }}'
- name: Build CF host debian packages
uses: ./.github/actions/build-debian-packages
with:
deploy-channel: ${{ inputs.deploy-channel }}
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
- name: Authentication on GCP project android-cuttlefish-artifacts
if: inputs.deploy-channel != ''
uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Deploy CF host debian packages
if: inputs.deploy-channel != ''
uses: ./.github/actions/deploy-debian-packages
with:
deploy-channel: ${{ inputs.deploy-channel }}
path: .
deploy-gigabyte-ampere-installer-arm64:
needs: [set-variables]
environment: deployment
runs-on: ubuntu-22.04
container:
image: debian@sha256:13f29b6806e531c3ff3b565bb6eed73f2132506c8c9d41bb996065ca20fb27f2 # debian:trixie-20260223 (amd64)
steps:
- name: checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Build Gigabyte Ampere installer
uses: ./.github/actions/build-gigabyte-ampere-cuttlefish-installer
- name: Authentication on GCP project android-cuttlefish-artifacts
if: inputs.deploy-channel != ''
uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Deploy Gigabyte Ampere server iso installer image.
if: inputs.deploy-channel != ''
uses: ./.github/actions/deploy-gigabyte-ampere-cuttlefish-installer
with:
deploy-channel: ${{ inputs.deploy-channel }}
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
path: ./gigabyte-ampere-cuttlefish-installer
deploy-docker-image-amd64:
if: inputs.deploy-channel != ''
needs: [set-variables, update-bazel-cache-and-deploy-debian-package-amd64]
environment: deployment
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Build docker image
run: container/image-builder.sh -m ${INPUTS_DEPLOY_CHANNEL}
env:
INPUTS_DEPLOY_CHANNEL: ${{ inputs.deploy-channel }}
- name: Authentication on GCP project android-cuttlefish-artifacts
uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Login to Artifact Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Deploy docker image
uses: ./.github/actions/deploy-docker-image
with:
arch: amd64
deploy-channel: ${{ inputs.deploy-channel }}
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
deploy-docker-image-arm64:
if: inputs.deploy-channel != ''
needs: [set-variables, update-bazel-cache-and-deploy-debian-package-arm64]
environment: deployment
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Build docker image
run: container/image-builder.sh -m ${INPUTS_DEPLOY_CHANNEL}
env:
INPUTS_DEPLOY_CHANNEL: ${{ inputs.deploy-channel }}
- name: Authentication on GCP project android-cuttlefish-artifacts
uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Login to Artifact Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Deploy docker image
uses: ./.github/actions/deploy-docker-image
with:
arch: arm64
deploy-channel: ${{ inputs.deploy-channel }}
yyyymmddhhmm: ${{ needs.set-variables.outputs.yyyymmddhhmm }}
deploy-docker-manifest:
if: inputs.deploy-channel != ''
needs: [set-variables, deploy-docker-image-amd64, deploy-docker-image-arm64]
environment: deployment
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Authentication on GCP project android-cuttlefish-artifacts
uses: 'google-github-actions/auth@v3'
with:
credentials_json: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Login to Artifact Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: us-docker.pkg.dev
username: _json_key
password: '${{ secrets.artifact-registry-uploader-json-creds }}'
- name: Deploy manifests
run: |
case "${INPUTS_DEPLOY_CHANNEL}" in
stable)
# Stable version tag : X.Y.Z
SEMVER=$(echo ${GITHUB_REF_NAME} | grep -oE '[0-9]+.[0-9]+.[0-9]+')
TAG="${SEMVER}"
;;
unstable)
# Unstable version tag : X.Y-<Github SHA 8 digit>
SEMVER=$(echo ${GITHUB_REF_NAME} | grep -oE '[0-9]+.[0-9]+')
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
TAG="${SEMVER}-${SHORT_SHA}"
;;
nightly)
# Nightly version tag : gitYYYYMMDDHHMM-<Github SHA 8 digit>
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
TAG="git${NEEDS_SET_VARIABLES_OUTPUTS_YYYYMMDDHHMM}-${SHORT_SHA}"
;;
*)
exit 1
;;
esac
IMAGE=us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration
for MANIFEST_TAG in ${TAG} ${INPUTS_DEPLOY_CHANNEL}; do
docker manifest create ${IMAGE}:${MANIFEST_TAG} \
--amend ${IMAGE}:${TAG}-amd64 \
--amend ${IMAGE}:${TAG}-arm64
docker manifest push ${IMAGE}:${MANIFEST_TAG}
done
env:
INPUTS_DEPLOY_CHANNEL: ${{ inputs.deploy-channel }}
NEEDS_SET_VARIABLES_OUTPUTS_YYYYMMDDHHMM: ${{ needs.set-variables.outputs.yyyymmddhhmm }}