öoämj
This commit is contained in:
@@ -51,17 +51,25 @@ jobs:
|
|||||||
TAG=$(echo "$TAGS_JSON" | jq -r 'if type == "array" then .[] | select(.commit.sha == "'"$GITHUB_SHA"'") | .name else empty end' | head -1)
|
TAG=$(echo "$TAGS_JSON" | jq -r 'if type == "array" then .[] | select(.commit.sha == "'"$GITHUB_SHA"'") | .name else empty end' | head -1)
|
||||||
if [ -n "$TAG" ]; then
|
if [ -n "$TAG" ]; then
|
||||||
echo "artifact_exists=true" >> "$GITHUB_OUTPUT"
|
echo "artifact_exists=true" >> "$GITHUB_OUTPUT"
|
||||||
echo "Commit already tagged as $TAG, skipping build"
|
echo "artifact_tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Build skipped: commit already tagged as $TAG"
|
||||||
else
|
else
|
||||||
echo "artifact_exists=false" >> "$GITHUB_OUTPUT"
|
echo "artifact_exists=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Build required: no tag for this commit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Report check status
|
- name: Report check status
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ needs.check.outputs.version }}"
|
VERSION="${{ steps.check.outputs.version }}"
|
||||||
|
ARTIFACT_EXISTS="${{ steps.check.outputs.artifact_exists }}"
|
||||||
|
ARTIFACT_TAG="${{ steps.check.outputs.artifact_tag }}"
|
||||||
if [ "${{ steps.check.outcome }}" = "success" ]; then
|
if [ "${{ steps.check.outcome }}" = "success" ]; then
|
||||||
bash scripts/report-status.sh success "Check version $VERSION" ci-check
|
if [ "${ARTIFACT_EXISTS}" = "true" ]; then
|
||||||
|
bash scripts/report-status.sh success "Skip build: version $VERSION exists as $ARTIFACT_TAG" ci-check
|
||||||
|
else
|
||||||
|
bash scripts/report-status.sh success "Build version $VERSION required" ci-check
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
bash scripts/report-status.sh failure "Check version $VERSION FAILED" ci-check
|
bash scripts/report-status.sh failure "Check version $VERSION FAILED" ci-check
|
||||||
exit 1
|
exit 1
|
||||||
@@ -79,6 +87,9 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
needs: [check, quality-gate]
|
needs: [check, quality-gate]
|
||||||
|
if: |
|
||||||
|
needs.check.outputs.artifact_exists == 'false' &&
|
||||||
|
needs.quality-gate.result == 'success'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
docker:
|
docker:
|
||||||
@@ -106,11 +117,12 @@ jobs:
|
|||||||
- name: Report docker build status
|
- name: Report docker build status
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
VERSION="${{ needs.check.outputs.version }}"
|
||||||
BUILD_EXIT="${{ steps.build.outputs.exit-code }}"
|
BUILD_EXIT="${{ steps.build.outputs.exit-code }}"
|
||||||
if [ "${BUILD_EXIT}" = "0" ]; then
|
if [ "${BUILD_EXIT}" = "0" ]; then
|
||||||
bash scripts/report-status.sh success "Docker build OK" ci-docker-build
|
bash scripts/report-status.sh success "Docker build $VERSION OK" ci-docker-build
|
||||||
else
|
else
|
||||||
bash scripts/report-status.sh failure "Docker build FAILED" ci-docker-build
|
bash scripts/report-status.sh failure "Docker build $VERSION FAILED" ci-docker-build
|
||||||
fi
|
fi
|
||||||
exit ${BUILD_EXIT}
|
exit ${BUILD_EXIT}
|
||||||
|
|
||||||
@@ -164,11 +176,12 @@ jobs:
|
|||||||
- name: Report docker push status
|
- name: Report docker push status
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
VERSION="${{ needs.check.outputs.version }}"
|
||||||
PUSH_EXIT="${{ steps.push.outputs.exit-code }}"
|
PUSH_EXIT="${{ steps.push.outputs.exit-code }}"
|
||||||
if [ "${PUSH_EXIT}" = "0" ]; then
|
if [ "${PUSH_EXIT}" = "0" ]; then
|
||||||
bash scripts/report-status.sh success "Docker push OK" ci-docker-push
|
bash scripts/report-status.sh success "Docker push $VERSION OK" ci-docker-push
|
||||||
else
|
else
|
||||||
bash scripts/report-status.sh failure "Docker push FAILED" ci-docker-push
|
bash scripts/report-status.sh failure "Docker push $VERSION FAILED" ci-docker-push
|
||||||
fi
|
fi
|
||||||
exit ${PUSH_EXIT}
|
exit ${PUSH_EXIT}
|
||||||
|
|
||||||
@@ -210,12 +223,13 @@ jobs:
|
|||||||
- name: Report docker tag status
|
- name: Report docker tag status
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
|
VERSION="${{ needs.check.outputs.version }}"
|
||||||
TAG_STATUS="${{ steps.tag.outputs.status }}"
|
TAG_STATUS="${{ steps.tag.outputs.status }}"
|
||||||
TAG_MESSAGE="${{ steps.tag.outputs.message }}"
|
TAG_MESSAGE="${{ steps.tag.outputs.message }}"
|
||||||
if [ "${TAG_STATUS}" = "success" ]; then
|
if [ "${TAG_STATUS}" = "success" ]; then
|
||||||
bash scripts/report-status.sh success "${TAG_MESSAGE}" ci-docker-tag
|
bash scripts/report-status.sh success "Tag $VERSION OK" ci-docker-tag
|
||||||
else
|
else
|
||||||
TAG_EXIT="${{ steps.tag.outputs.exit-code }}"
|
TAG_EXIT="${{ steps.tag.outputs.exit-code }}"
|
||||||
bash scripts/report-status.sh failure "${TAG_MESSAGE}" ci-docker-tag
|
bash scripts/report-status.sh failure "Tag $VERSION FAILED" ci-docker-tag
|
||||||
exit ${TAG_EXIT}
|
exit ${TAG_EXIT}
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user