Files
manoon-headless/.gitea/workflows/build.yaml
Unchained 6563f0c966
Some checks failed
Build and Deploy / build (push) Has been cancelled
fix: use full cluster DNS for gitea service
- Change gitea URL from http://gitea:3000 to http://gitea.gitea.svc.cluster.local:3000
- Add set -x for debugging
- Add explicit clone exit code checking
2026-04-05 11:43:57 +02:00

94 lines
3.6 KiB
YAML

name: Build and Deploy
on:
push:
branches: [master, main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Trigger BuildKit Build
run: |
echo "Building commit: ${GITHUB_SHA}"
# Delete old job
kubectl delete job build-manoon-headless-action -n gitea --ignore-not-found=true 2>/dev/null || true
# Create build job
kubectl apply -f - << EOF
apiVersion: batch/v1
kind: Job
metadata:
name: build-manoon-headless-action
namespace: gitea
spec:
ttlSecondsAfterFinished: 86400
template:
spec:
restartPolicy: Never
initContainers:
- name: clone
image: alpine/git:latest
command:
- sh
- -c
- |
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
cd /workspace
echo "Successfully cloned: $(git rev-parse --short HEAD)"
volumeMounts:
- name: workspace
mountPath: /workspace
containers:
- name: build
image: moby/buildkit:latest
command:
- sh
- -c
- |
set -e
mkdir -p /root/.docker
cp /docker-config/.dockerconfigjson /root/.docker/config.json
buildctl --addr tcp://buildkit.gitea.svc.cluster.local:1234 build \
--frontend dockerfile.v0 \
--local context=/workspace \
--local dockerfile=/workspace \
--opt build-arg:NEXT_PUBLIC_SALEOR_API_URL=https://api.manoonoils.com/graphql/ \
--opt build-arg:NEXT_PUBLIC_SITE_URL=https://manoonoils.com \
--opt build-arg:NEXT_PUBLIC_OPENPANEL_CLIENT_ID=fa61f8ae-0b5d-4187-a9b1-5a04b0025674 \
--opt build-arg:NEXT_PUBLIC_RYBBIT_HOST=https://rybbit.nodecrew.me \
--opt build-arg:NEXT_PUBLIC_RYBBIT_SITE_ID=1 \
--output type=image,name=ghcr.io/unchainedio/manoon-headless:latest,push=true
kubectl annotate kustomization -n flux-system manoonoils-storefront --overwrite reconcile.fluxcd.io/requestedAt=$(date +%s)
echo "Done!"
volumeMounts:
- name: workspace
mountPath: /workspace
- name: docker-config
mountPath: /docker-config
readOnly: true
volumes:
- name: workspace
emptyDir: {}
- name: docker-config
secret:
secretName: ghcr-pull-secret
EOF
echo "Build job created!"
kubectl wait --for=condition=complete job/build-manoon-headless-action -n gitea --timeout=600s || echo "Build running in background"