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