fix(woodpecker): use exit code 78 to skip builds instead of evaluate
- Replace evaluate when conditions with exit code 78 - Exit 78 in detect-changes step skips subsequent steps - Woodpecker treats exit 78 as skip signal
This commit is contained in:
parent
14d820cf57
commit
09a8b833a0
1 changed files with 8 additions and 20 deletions
|
|
@ -52,18 +52,18 @@ steps:
|
|||
echo "✅ Service ${SERVICE} has code changes"
|
||||
fi
|
||||
|
||||
# Create marker file
|
||||
# Create marker file and exit with appropriate code
|
||||
if [ "$SHARED_CHANGED" = "true" ] || [ "$SERVICE_CHANGED" = "true" ]; then
|
||||
echo "SHOULD_BUILD=true" > .build-${SERVICE}
|
||||
echo "SHOULD_BUILD=true" >> ${CI_ENV}
|
||||
echo "🚀 Will build ${SERVICE}"
|
||||
exit 0
|
||||
else
|
||||
echo "SHOULD_BUILD=false" > .build-${SERVICE}
|
||||
echo "SHOULD_BUILD=false" >> ${CI_ENV}
|
||||
echo "⏭️ Skipping ${SERVICE} - no changes detected"
|
||||
# Exit with code 78 to skip subsequent steps for this service
|
||||
exit 78
|
||||
fi
|
||||
|
||||
# Export for other steps
|
||||
cat .build-${SERVICE} >> ${CI_ENV}
|
||||
|
||||
- name: build
|
||||
image: woodpeckerci/plugin-docker-buildx:5.0.0
|
||||
settings:
|
||||
|
|
@ -82,8 +82,6 @@ steps:
|
|||
password:
|
||||
from_secret: GHCR_TOKEN
|
||||
platforms: linux/amd64
|
||||
when:
|
||||
- evaluate: 'env.SHOULD_BUILD == "true"'
|
||||
|
||||
- name: deploy
|
||||
image: bitnami/kubectl:latest
|
||||
|
|
@ -95,12 +93,6 @@ steps:
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check if we should deploy
|
||||
if [ "${SHOULD_BUILD}" != "true" ]; then
|
||||
echo "⏭️ Skipping deployment for ${SERVICE} - no changes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Setup kubeconfig
|
||||
mkdir -p ~/.kube
|
||||
echo "$KUBE_CONFIG" | base64 -d > ~/.kube/config
|
||||
|
|
@ -123,16 +115,13 @@ steps:
|
|||
|
||||
# Show deployment status
|
||||
kubectl get deployment/nxtgauge-rust-${DEPLOYMENT_NAME} -n ${NAMESPACE}
|
||||
when:
|
||||
- evaluate: 'env.SHOULD_BUILD == "true"'
|
||||
|
||||
- name: notify-success
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo "✅ Pipeline completed successfully for ${SERVICE}"
|
||||
when:
|
||||
- evaluate: 'env.SHOULD_BUILD == "true"'
|
||||
- status: success
|
||||
status: success
|
||||
|
||||
- name: notify-failure
|
||||
image: alpine:latest
|
||||
|
|
@ -140,5 +129,4 @@ steps:
|
|||
- echo "❌ Pipeline failed for ${SERVICE}"
|
||||
- echo "Check logs for details"
|
||||
when:
|
||||
- evaluate: 'env.SHOULD_BUILD == "true"'
|
||||
- status: failure
|
||||
status: failure
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue