From 7c7611b723194a72983be2dcfbf98bc04f204b79 Mon Sep 17 00:00:00 2001 From: Unchained Date: Sun, 5 Apr 2026 11:50:23 +0200 Subject: [PATCH] fix: simplify build workflow YAML syntax - Use 'command' and 'args' instead of multiline command - Use quoted heredoc delimiter to prevent variable expansion - Simplify clone and build scripts --- .gitea/workflows/build.yaml | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 984928d..9f8e5c9 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -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" + kubectl wait --for=condition=complete job/build-manoon-headless-action -n gitea --timeout=600s || echo "Build running in background" \ No newline at end of file