Skip to content

Commit 4c62859

Browse files
committed
Define docker tag format for stable/unstable channel
1 parent c2cb204 commit 4c62859

File tree

2 files changed

+46
-16
lines changed

2 files changed

+46
-16
lines changed

.github/actions/deploy-docker-image/action.yaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,34 @@ name: 'Deploy docker image cuttlefish-orchestration'
22
inputs:
33
arch:
44
required: true
5+
deploy-channel:
6+
required: true
57
runs:
68
using: "composite"
79
steps:
810
- name: Deploy docker image into Artifact Registry
911
run: |
10-
# TODO(b/440196950): Setup condition on this step when we build
11-
# stable/unstable versions here too.
12-
13-
# Stable/Unstable version tag : X.Y.Z
14-
# Nightly version tag : gitYYYYMMDD-<Github SHA 8 digit>
15-
DATE=$(date -u +'%Y%m%d')
16-
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
17-
TAG="git${DATE}-${SHORT_SHA}-${{ inputs.arch }}"
12+
case "${{ inputs.deploy-channel }}" in
13+
stable)
14+
# Stable version tag : X.Y.Z-<amd64|arm64>
15+
SEMVER=$(echo ${{ github.ref_name }} | grep -oE '[0-9]+.[0-9]+.[0-9]+'
16+
TAG="${SEMVER}-${{ inputs.arch }}"
17+
;;
18+
unstable)
19+
# Unstable version tag : X.Y-<Github SHA 8 digit>-<amd64|arm64>
20+
SEMVER=$(echo ${{ github.ref_name }} | grep -oE '[0-9]+.[0-9]+'
21+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
22+
TAG="${SEMVER}-${SHORT_SHA}-${{ inputs.arch }}"
23+
;;
24+
nightly)
25+
# Nightly version tag : gitYYYYMMDDHHMM-<Github SHA 8 digit>-<amd64|arm64>
26+
DATE=$(date -u +'%Y%m%d%H%M')
27+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
28+
TAG="git${DATE}-${SHORT_SHA}-${{ inputs.arch }}"
29+
*)
30+
exit 1
31+
;;
32+
esac
1833
REMOTE_IMAGE_TAG=us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration:${TAG}
1934
2035
docker tag cuttlefish-orchestration ${REMOTE_IMAGE_TAG}

.github/workflows/update-cache-and-deployment.yaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ jobs:
119119
uses: ./.github/actions/deploy-docker-image
120120
with:
121121
arch: amd64
122+
deploy-channel: ${{ inputs.deploy-channel }}
122123
deploy-docker-image-arm64:
123124
if: inputs.deploy-channel != ''
124125
needs: [update-bazel-cache-and-deploy-debian-package-arm64]
@@ -143,6 +144,7 @@ jobs:
143144
uses: ./.github/actions/deploy-docker-image
144145
with:
145146
arch: arm64
147+
deploy-channel: ${{ inputs.deploy-channel }}
146148
deploy-docker-manifest:
147149
if: inputs.deploy-channel != ''
148150
needs: [deploy-docker-image-amd64, deploy-docker-image-arm64]
@@ -163,14 +165,27 @@ jobs:
163165
password: '${{ secrets.artifact-registry-uploader-json-creds }}'
164166
- name: Deploy manifests
165167
run: |
166-
# TODO(b/440196950): Setup condition on this step when we build
167-
# stable/unstable versions here too.
168-
169-
# Stable/Unstable version tag : X.Y.Z
170-
# Nightly version tag : gitYYYYMMDD-<Github SHA 8 digit>
171-
DATE=$(date -u +'%Y%m%d')
172-
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
173-
TAG="git${DATE}-${SHORT_SHA}"
168+
case "${{ inputs.deploy-channel }}" in
169+
stable)
170+
# Stable version tag : X.Y.Z
171+
SEMVER=$(echo ${{ github.ref_name }} | grep -oE '[0-9]+.[0-9]+.[0-9]+'
172+
TAG="${SEMVER}"
173+
;;
174+
unstable)
175+
# Unstable version tag : X.Y-<Github SHA 8 digit>
176+
SEMVER=$(echo ${{ github.ref_name }} | grep -oE '[0-9]+.[0-9]+'
177+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
178+
TAG="${SEMVER}-${SHORT_SHA}"
179+
;;
180+
nightly)
181+
# Nightly version tag : gitYYYYMMDDHHMM-<Github SHA 8 digit>
182+
DATE=$(date -u +'%Y%m%d%H%M')
183+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
184+
TAG="git${DATE}-${SHORT_SHA}"
185+
*)
186+
exit 1
187+
;;
188+
esac
174189
IMAGE=us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration
175190
176191
for MANIFEST_TAG in ${TAG} ${{ inputs.deploy-channel }}; do

0 commit comments

Comments
 (0)