merge: integrate latest master with Gitea Actions CI/CD
This commit is contained in:
@@ -10,21 +10,18 @@ jobs:
|
||||
steps:
|
||||
- name: Trigger BuildKit Build
|
||||
run: |
|
||||
echo "Triggering BuildKit build for commit: ${{ github.sha }}"
|
||||
echo "Building commit: \"
|
||||
|
||||
# Delete old job if exists
|
||||
kubectl delete job build-manoon-headless-action -n gitea --ignore-not-found=true
|
||||
# Delete old job
|
||||
kubectl delete job build-manoon-headless-action -n gitea --ignore-not-found=true 2>/dev/null || true
|
||||
|
||||
# Create build job
|
||||
cat << 'EOF' | kubectl apply -f -
|
||||
kubectl apply -f - << EOF
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: build-manoon-headless-action
|
||||
namespace: gitea
|
||||
labels:
|
||||
commit: ${{ github.sha }}
|
||||
triggered-by: gitea-actions
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 86400
|
||||
template:
|
||||
@@ -39,8 +36,7 @@ jobs:
|
||||
- |
|
||||
set -e
|
||||
git clone --depth 1 http://gitea:3000/unchained/manoon-headless.git /workspace
|
||||
cd /workspace && git checkout ${{ github.sha }}
|
||||
echo "Building commit: $(git rev-parse --short HEAD)"
|
||||
cd /workspace && git checkout echo "Building: $(git rev-parse --short HEAD)"
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
mountPath: /workspace
|
||||
@@ -54,14 +50,12 @@ jobs:
|
||||
set -e
|
||||
mkdir -p /root/.docker
|
||||
cp /docker-config/.dockerconfigjson /root/.docker/config.json
|
||||
echo "Building with BuildKit..."
|
||||
buildctl --addr tcp://buildkit.gitea.svc.cluster.local:1234 build \
|
||||
--frontend dockerfile.v0 \
|
||||
--local context=/workspace \
|
||||
--local dockerfile=/workspace \
|
||||
--output type=image,name=ghcr.io/unchainedio/manoon-headless:latest,push=true
|
||||
echo "Build complete! Triggering Flux..."
|
||||
kubectl annotate kustomization -n flux-system manoonoils-storefront --overwrite reconcile.fluxcd.io/requestedAt="$(date +%s)"
|
||||
kubectl annotate kustomization -n flux-system manoonoils-storefront --overwrite reconcile.fluxcd.io/requestedAt="\1775369769"
|
||||
echo "Done!"
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
@@ -77,6 +71,5 @@ jobs:
|
||||
secretName: ghcr-pull-secret
|
||||
EOF
|
||||
|
||||
echo "Build job created. Waiting for completion..."
|
||||
kubectl wait --for=condition=complete job/build-manoon-headless-action -n gitea --timeout=600s || echo "Build still running in background"
|
||||
echo "Build triggered successfully!"
|
||||
echo "Build job created!"
|
||||
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