Skip to content

Commit a4a7bb8

Browse files
committed
feat(ci): add tagging -latest for rest-ci components (#5823)
Adds tagging for rest-ci containers so there's an updated `<version>-latest` on each new release, simplifying security scanning. Note this completes the previous work that adds -latest tagging for core components. ## Related issues #5820 ## Type of Change - [ ] **Add** - New feature or capability - [ ] **Change** - Changes in existing functionality - [ ] **Fix** - Bug fixes - [ ] **Remove** - Removed features or deprecated functionality - [x] **Internal** - Internal changes (refactoring, tests, docs, etc.) ## Breaking Changes - [ ] **This PR contains breaking changes** ## Testing - [ ] Unit tests added/updated - [ ] Integration tests added/updated - [ ] Manual testing performed - [ ] No testing required (docs, internal refactor, etc.) ## Additional Notes
1 parent d5653c9 commit a4a7bb8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/rest-build-push-service.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,14 @@ jobs:
151151
fi
152152
# Per-arch tag; the bare manifest tag is assembled by the merge job.
153153
ARCH_TAG="${{ inputs.target_registry }}/${{ inputs.service_name }}:${PRIMARY_TAG}-${{ matrix.arch }}"
154+
# Moving major.minor tag (e.g. v2.2-latest), mirroring core ci.yaml's
155+
# major_minor_version. semantic_version is `git describe`, so this collapses
156+
# dev builds and releases in the same X.Y line onto one tag.
157+
MAJOR_MINOR=$(echo "${{ inputs.semantic_version }}" | cut -d. -f1,2)
154158
echo "primary_tag=$PRIMARY_TAG" >> $GITHUB_OUTPUT
155159
echo "arch_tag=$ARCH_TAG" >> $GITHUB_OUTPUT
156160
echo "artifact_version=$ARTIFACT_VERSION" >> $GITHUB_OUTPUT
161+
echo "major_minor_tag=$MAJOR_MINOR" >> $GITHUB_OUTPUT
157162
158163
- name: Build ${{ inputs.service_name }} (${{ matrix.arch }})
159164
uses: docker/build-push-action@v5
@@ -308,8 +313,10 @@ jobs:
308313
else
309314
PRIMARY_TAG="${{ inputs.branch_sha_tag }}"
310315
fi
316+
MAJOR_MINOR=$(echo "${{ inputs.semantic_version }}" | cut -d. -f1,2)
311317
echo "primary_tag=$PRIMARY_TAG" >> $GITHUB_OUTPUT
312318
echo "artifact_version=$ARTIFACT_VERSION" >> $GITHUB_OUTPUT
319+
echo "major_minor_tag=$MAJOR_MINOR" >> $GITHUB_OUTPUT
313320
314321
- name: Create and push multi-arch manifest
315322
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08
@@ -320,10 +327,14 @@ jobs:
320327
command: |
321328
REG="${{ inputs.target_registry }}/${{ inputs.service_name }}"
322329
TAG="${{ steps.docker-tags.outputs.primary_tag }}"
330+
MAJOR_MINOR="${{ steps.docker-tags.outputs.major_minor_tag }}"
323331
docker buildx imagetools create -t "${REG}:${TAG}" "${REG}:${TAG}-amd64" "${REG}:${TAG}-arm64"
324332
if [ "${{ inputs.is_main_branch }}" == "true" ]; then
325333
docker buildx imagetools create -t "${REG}:latest" "${REG}:${TAG}-amd64" "${REG}:${TAG}-arm64"
326334
fi
335+
if [ -n "${MAJOR_MINOR}" ]; then
336+
docker buildx imagetools create -t "${REG}:${MAJOR_MINOR}-latest" "${REG}:${TAG}-amd64" "${REG}:${TAG}-arm64"
337+
fi
327338
328339
- name: Export Docker image
329340
run: |

0 commit comments

Comments
 (0)