Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit 13e25c6

Browse files
committed
Remove 'latest' tag, use immutable version tags only
- Removed 'latest' tag for production safety - Uses git tag if available (e.g., v0.6.0-patched-1) - Falls back to SHA-based tag for untagged commits - Matches best practice for prod/preprod deployments
1 parent c2cf8c1 commit 13e25c6

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/build-and-push.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ jobs:
3939
id: metadata
4040
run: |
4141
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
42-
IMAGE_TAG="${GRAFANA_VERSION}-quickwit-0.6.0-patched-${SHORT_SHA}"
42+
43+
# Use git tag if available, otherwise use short SHA
44+
if git describe --exact-match --tags HEAD 2>/dev/null; then
45+
GIT_TAG=$(git describe --exact-match --tags HEAD)
46+
# Strip 'v' prefix if present
47+
VERSION=${GIT_TAG#v}
48+
IMAGE_TAG="${GRAFANA_VERSION}-quickwit-${VERSION}"
49+
else
50+
IMAGE_TAG="${GRAFANA_VERSION}-quickwit-0.6.0-patched-${SHORT_SHA}"
51+
fi
4352
4453
echo "githash=${{ github.sha }}" >> $GITHUB_OUTPUT
4554
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
@@ -141,23 +150,24 @@ jobs:
141150
github.event_name == 'workflow_dispatch' && github.event.inputs.force_publish == 'true' ||
142151
github.event.action == 'closed' && github.event.pull_request.merged == true ||
143152
github.ref == 'refs/heads/main' ||
144-
github.ref == 'refs/heads/disable-field-caps-all-fields'
153+
github.ref == 'refs/heads/disable-field-caps-all-fields' ||
154+
startsWith(github.ref, 'refs/tags/')
145155
run: |
146156
aws ecr get-login-password --region $AWS_REGION_MGT | docker login --username AWS --password-stdin $DOCKER_REGISTRY_MGT
147157
148158
docker tag ${{ env.ECR_REPOSITORY }}:${{ steps.metadata.outputs.image_tag }} \
149159
$DOCKER_REGISTRY_MGT/${{ env.ECR_REPOSITORY }}:${{ steps.metadata.outputs.image_tag }}
150160
151-
docker tag ${{ env.ECR_REPOSITORY }}:latest \
152-
$DOCKER_REGISTRY_MGT/${{ env.ECR_REPOSITORY }}:latest
153-
154161
docker push $DOCKER_REGISTRY_MGT/${{ env.ECR_REPOSITORY }}:${{ steps.metadata.outputs.image_tag }}
155-
docker push $DOCKER_REGISTRY_MGT/${{ env.ECR_REPOSITORY }}:latest
156162
157163
SUMMARY=$'# Published Grafana Quickwit Image to ECR\n'
158-
SUMMARY+=$'## Images\n'
159-
SUMMARY+=$'* '"$DOCKER_REGISTRY_MGT"'/${{ env.ECR_REPOSITORY }}:'"${{ steps.metadata.outputs.image_tag }}"$'\n'
160-
SUMMARY+=$'* '"$DOCKER_REGISTRY_MGT"'/${{ env.ECR_REPOSITORY }}:latest'$'\n'
164+
SUMMARY+=$'## Image\n'
165+
SUMMARY+=$'```\n'
166+
SUMMARY+=$''$DOCKER_REGISTRY_MGT'/${{ env.ECR_REPOSITORY }}:${{ steps.metadata.outputs.image_tag }}\n'
167+
SUMMARY+=$'```\n'
168+
SUMMARY+=$'\n## Usage in Deployments\n'
169+
SUMMARY+=$'**Preprod**: Update gitops to use this tag for testing\n'
170+
SUMMARY+=$'**Prod**: Promote this tag after preprod validation\n'
161171
SUMMARY+=$'\n## Details\n'
162172
SUMMARY+=$'* **Grafana Version**: ${{ env.GRAFANA_VERSION }}\n'
163173
SUMMARY+=$'* **Quickwit Plugin**: 0.6.0-patched (field_caps disabled)\n'

0 commit comments

Comments
 (0)