struj
CI / Load gitea-env.conf to pipeline env (push) Successful in 14s
ci-check Build version 0.1.0 required
ci-docker-build Docker build 0.1.0 OK
ci-docker-push Docker push 0.1.0 FAILED
CI / Build & Push Artifact (push) Failing after 1m10s

This commit is contained in:
moilanik
2026-06-15 10:46:06 +03:00
parent f32b345f58
commit c233ef8975
+25 -9
View File
@@ -31,6 +31,8 @@ concurrency:
jobs: jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
artifact_exists: ${{ steps.set-outputs.outputs.artifact_exists }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -69,6 +71,12 @@ jobs:
echo "gitea-ci-library - Uusi vapaa versio: $FULL_VERSION" echo "gitea-ci-library - Uusi vapaa versio: $FULL_VERSION"
fi fi
- name: Set job outputs
id: set-outputs
run: |
source /tmp/build-ctx/build.env
echo "artifact_exists=$ARTIFACT_EXISTS" >> "$GITHUB_OUTPUT"
- name: Upload build env artifact - name: Upload build env artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@@ -102,10 +110,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# needs: [check, quality-gate] # needs: [check, quality-gate]
needs: [check] needs: [check]
# LÖYSÄTTY EHTO: Vaaditaan vain, että check-job meni onnistuneesti läpi. # Skipataan koko build jos artefakti löytyy jo
# Quality gate vastuulla on räjäyttää koko job jos se ei mene läpi! if: needs.check.outputs.artifact_exists != 'true'
# Tämä sallii sen, että quality-gate voi olla Gitean muuttujissa tyhjä, eikä build-job enää ohitu (skip).
if: always()
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -115,6 +121,16 @@ jobs:
name: build-context name: build-context
path: /tmp/build-ctx path: /tmp/build-ctx
- name: Check if build needed
id: gatekeeper
run: |
source /tmp/build-ctx/build.env
if [ "${ARTIFACT_EXISTS}" = "true" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Set Gitea status to PENDING - name: Set Gitea status to PENDING
if: steps.gatekeeper.outputs.skip == 'false' if: steps.gatekeeper.outputs.skip == 'false'
run: | run: |
@@ -130,7 +146,7 @@ jobs:
--label "git.commit=${{ github.sha }}" \ --label "git.commit=${{ github.sha }}" \
--label "git.commitBy=${{ github.actor }}" \ --label "git.commitBy=${{ github.actor }}" \
--label "build.date=${NOW}" \ --label "build.date=${NOW}" \
-t "minimal:${NEXT_VERSION}" . -t "gitea-ci-library-test-minimal:${NEXT_VERSION}" .
- name: Report status SUCCESS - name: Report status SUCCESS
if: steps.gatekeeper.outputs.skip == 'false' && success() if: steps.gatekeeper.outputs.skip == 'false' && success()
@@ -149,7 +165,7 @@ jobs:
run: | run: |
source /tmp/build-ctx/build.env source /tmp/build-ctx/build.env
mkdir -p /tmp/image mkdir -p /tmp/image
docker save "minimal:${NEXT_VERSION}" -o /tmp/image/artifact.tar docker save "gitea-ci-library-test-minimal:${NEXT_VERSION}" -o /tmp/image/artifact.tar
- name: Upload Docker image artifact - name: Upload Docker image artifact
if: steps.gatekeeper.outputs.skip == 'false' && success() if: steps.gatekeeper.outputs.skip == 'false' && success()
@@ -161,7 +177,7 @@ jobs:
push: push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [check, build] needs: [check, build]
if: always() if: needs.check.outputs.artifact_exists != 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -208,7 +224,7 @@ jobs:
docker load -i /tmp/image/artifact.tar docker load -i /tmp/image/artifact.tar
REGISTRY=$(echo "${{ gitea.server_url }}" | sed -e 's|^https://||' -e 's|^http://||') REGISTRY=$(echo "${{ gitea.server_url }}" | sed -e 's|^https://||' -e 's|^http://||')
IMAGE="$REGISTRY/${{ gitea.repository }}:${NEXT_VERSION}" IMAGE="$REGISTRY/${{ gitea.repository }}:${NEXT_VERSION}"
docker tag "minimal:$NEXT_VERSION" "$IMAGE" docker tag "gitea-ci-library-test-minimal:${NEXT_VERSION}" "$IMAGE"
echo "$GITEA_TOKEN" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin echo "$GITEA_TOKEN" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
docker push "$IMAGE" docker push "$IMAGE"
docker logout "$REGISTRY" docker logout "$REGISTRY"
@@ -228,7 +244,7 @@ jobs:
tag-commit: tag-commit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [check, push] needs: [check, push]
if: always() if: needs.check.outputs.artifact_exists != 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4