fix: simplify build workflow YAML syntax
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:
Unchained
2026-04-05 11:50:23 +02:00
parent 6563f0c966
commit 7c7611b723

View File

@@ -16,7 +16,7 @@ jobs:
kubectl delete job build-manoon-headless-action -n gitea --ignore-not-found=true 2>/dev/null || true
# Create build job
kubectl apply -f - << EOF
cat << 'JOBEOF' | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
@@ -30,24 +30,14 @@ jobs:
initContainers:
- name: clone
image: alpine/git:latest
command:
- sh
- -c
workingDir: /workspace
command: ["/bin/sh", "-c"]
args:
- |
set -ex
echo "Cloning repository..."
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)
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
git clone --depth 1 http://gitea.gitea.svc.cluster.local:3000/unchained/manoon-headless.git /workspace
cd /workspace
echo "Successfully cloned: $(git rev-parse --short HEAD)"
volumeMounts:
@@ -56,9 +46,8 @@ jobs:
containers:
- name: build
image: moby/buildkit:latest
command:
- sh
- -c
command: ["/bin/sh", "-c"]
args:
- |
set -e
mkdir -p /root/.docker
@@ -87,7 +76,7 @@ jobs:
- name: docker-config
secret:
secretName: ghcr-pull-secret
EOF
JOBEOF
echo "Build job created!"
kubectl wait --for=condition=complete job/build-manoon-headless-action -n gitea --timeout=600s || echo "Build running in background"