fix(ci): remove redundant image tag determination logic from multiple workflows

This commit is contained in:
GitHub Actions
2026-02-04 14:24:11 +00:00
parent e8584f17c0
commit b043a97539
4 changed files with 69 additions and 32 deletions

View File

@@ -11,15 +11,7 @@ on:
workflow_dispatch:
inputs:
image_tag:
<<<<<<< HEAD
description: 'Docker image tag to test (e.g., pr-123-abc1234, latest)'
=======
<<<<<<< HEAD
description: 'Docker image tag to test (e.g., pr-123-abc1234)'
=======
description: 'Docker image tag to test (e.g., pr-123-abc1234, latest)'
>>>>>>> 8edde88f (fix(ci): add image_tag input for manual triggers in integration workflows)
>>>>>>> 05695af2 ( git status)
required: false
type: string
@@ -43,7 +35,7 @@ jobs:
# Determine the correct image tag based on trigger context
# For PRs: pr-{number}-{sha}, For branches: {sanitized-branch}-{sha}
- name: Determine image tag
id: determine-tag
id: image
env:
EVENT: ${{ github.event.workflow_run.event }}
REF: ${{ github.event.workflow_run.head_branch }}
@@ -109,7 +101,7 @@ jobs:
max_attempts: 3
retry_wait_seconds: 10
command: |
IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/charon:${{ steps.determine-tag.outputs.tag }}"
IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/charon:${{ steps.image.outputs.tag }}"
echo "Pulling image: $IMAGE_NAME"
docker pull "$IMAGE_NAME"
docker tag "$IMAGE_NAME" charon:local
@@ -121,12 +113,12 @@ jobs:
if: steps.pull_image.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHA: ${{ steps.determine-tag.outputs.sha }}
SHA: ${{ steps.image.outputs.sha }}
run: |
echo "⚠️ Registry pull failed, falling back to artifact..."
# Determine artifact name based on source type
if [[ "${{ steps.determine-tag.outputs.source_type }}" == "pr" ]]; then
if [[ "${{ steps.image.outputs.source_type }}" == "pr" ]]; then
PR_NUM=$(echo '${{ toJson(github.event.workflow_run.pull_requests) }}' | jq -r '.[0].number')
ARTIFACT_NAME="pr-image-${PR_NUM}"
else
@@ -150,7 +142,7 @@ jobs:
# Validate image freshness by checking SHA label
- name: Validate image SHA
env:
SHA: ${{ steps.determine-tag.outputs.sha }}
SHA: ${{ steps.image.outputs.sha }}
run: |
LABEL_SHA=$(docker inspect charon:local --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' | cut -c1-7)
echo "Expected SHA: $SHA"