fix: simplify build workflow YAML syntax
All checks were successful
Build and Deploy / build (push) Successful in 10m0s
All checks were successful
Build and Deploy / build (push) Successful in 10m0s
- Use 'command' and 'args' instead of multiline command - Use quoted heredoc delimiter to prevent variable expansion - Simplify clone and build scripts
This commit is contained in:
@@ -16,7 +16,7 @@ jobs:
|
|||||||
kubectl delete job build-manoon-headless-action -n gitea --ignore-not-found=true 2>/dev/null || true
|
kubectl delete job build-manoon-headless-action -n gitea --ignore-not-found=true 2>/dev/null || true
|
||||||
|
|
||||||
# Create build job
|
# Create build job
|
||||||
kubectl apply -f - << EOF
|
cat << 'JOBEOF' | kubectl apply -f -
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: Job
|
kind: Job
|
||||||
metadata:
|
metadata:
|
||||||
@@ -30,24 +30,14 @@ jobs:
|
|||||||
initContainers:
|
initContainers:
|
||||||
- name: clone
|
- name: clone
|
||||||
image: alpine/git:latest
|
image: alpine/git:latest
|
||||||
command:
|
workingDir: /workspace
|
||||||
- sh
|
command: ["/bin/sh", "-c"]
|
||||||
- -c
|
args:
|
||||||
- |
|
- |
|
||||||
set -ex
|
set -ex
|
||||||
echo "Cloning repository..."
|
echo "Cloning repository..."
|
||||||
rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true
|
rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true
|
||||||
CLONE_OUTPUT=$(git clone --depth 1 http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git /workspace 2>&1)
|
git clone --depth 1 http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git /workspace
|
||||||
CLONE_EXIT_CODE=$?
|
|
||||||
echo "$CLONE_OUTPUT"
|
|
||||||
if [ $CLONE_EXIT_CODE -ne 0 ]; then
|
|
||||||
echo "ERROR: Clone failed with exit code $CLONE_EXIT_CODE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -d /workspace/.git ]; then
|
|
||||||
echo "ERROR: Clone failed - .git directory not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd /workspace
|
cd /workspace
|
||||||
echo "Successfully cloned: $(git rev-parse --short HEAD)"
|
echo "Successfully cloned: $(git rev-parse --short HEAD)"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@@ -56,9 +46,8 @@ jobs:
|
|||||||
containers:
|
containers:
|
||||||
- name: build
|
- name: build
|
||||||
image: moby/buildkit:latest
|
image: moby/buildkit:latest
|
||||||
command:
|
command: ["/bin/sh", "-c"]
|
||||||
- sh
|
args:
|
||||||
- -c
|
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
mkdir -p /root/.docker
|
mkdir -p /root/.docker
|
||||||
@@ -87,7 +76,7 @@ jobs:
|
|||||||
- name: docker-config
|
- name: docker-config
|
||||||
secret:
|
secret:
|
||||||
secretName: ghcr-pull-secret
|
secretName: ghcr-pull-secret
|
||||||
EOF
|
JOBEOF
|
||||||
|
|
||||||
echo "Build job created!"
|
echo "Build job created!"
|
||||||
kubectl wait --for=condition=complete job/build-manoon-headless-action -n gitea --timeout=600s || echo "Build running in background"
|
kubectl wait --for=condition=complete job/build-manoon-headless-action -n gitea --timeout=600s || echo "Build running in background"
|
||||||
Reference in New Issue
Block a user