ci: fix kaniko base-image pulls via egress proxy, use alpine/git for clone, longer build timeout
Build and Deploy Platform / build-and-deploy (push) Waiting to run
Build and Deploy Platform / build-and-deploy (push) Waiting to run
- Kaniko needs the egress proxy to pull node:24-alpine from docker.io (envFrom registry-egress-proxy; NO_PROXY keeps harbor push direct) - Replace flaky apk-add-git init with alpine/git image - Dump kaniko logs into workflow output on build timeout/failure Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -64,17 +64,24 @@ jobs:
|
||||
- name: registry-pull-secret
|
||||
initContainers:
|
||||
- name: clone
|
||||
image: ${PULL_REGISTRY}/${PROJECT}/alpine:3
|
||||
# alpine/git ships git — no flaky apk install at build time
|
||||
image: ${PULL_REGISTRY}/proxy-dockerhub/alpine/git:2.43.0
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- apk add --no-cache git && git clone --depth=1 --branch main http://oauth2:${GITEA_TOKEN}@${GITEA_HOST}/${REPO_PATH} /workspace
|
||||
- git clone --depth=1 --branch main http://oauth2:${GITEA_TOKEN}@${GITEA_HOST}/${REPO_PATH} /workspace
|
||||
volumeMounts:
|
||||
- name: ws
|
||||
mountPath: /workspace
|
||||
containers:
|
||||
- name: kaniko
|
||||
image: ${PULL_REGISTRY}/${PROJECT}/kaniko-executor:v1.27.6-debug
|
||||
# Kaniko pulls base images (node:24-alpine) straight from
|
||||
# docker.io — needs the egress proxy. NO_PROXY keeps the
|
||||
# push to harbor-registry direct.
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: registry-egress-proxy
|
||||
args:
|
||||
- --dockerfile=/workspace/backend/Dockerfile
|
||||
- --context=dir:///workspace/backend
|
||||
@@ -97,7 +104,11 @@ jobs:
|
||||
path: config.json
|
||||
ENDJOB
|
||||
echo "Waiting for backend build job: ${JOB_NAME}"
|
||||
kubectl -n ${BUILD_NS} wait --for=condition=complete job/${JOB_NAME} --timeout=20m
|
||||
if ! kubectl -n ${BUILD_NS} wait --for=condition=complete job/${JOB_NAME} --timeout=40m; then
|
||||
echo "--- kaniko logs (tail) ---"
|
||||
kubectl -n ${BUILD_NS} logs job/${JOB_NAME} -c kaniko --tail=100 || true
|
||||
exit 1
|
||||
fi
|
||||
echo "Backend build done"
|
||||
|
||||
- name: Build frontend image (Kaniko Job)
|
||||
@@ -120,17 +131,20 @@ jobs:
|
||||
- name: registry-pull-secret
|
||||
initContainers:
|
||||
- name: clone
|
||||
image: ${PULL_REGISTRY}/${PROJECT}/alpine:3
|
||||
image: ${PULL_REGISTRY}/proxy-dockerhub/alpine/git:2.43.0
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- apk add --no-cache git && git clone --depth=1 --branch main http://oauth2:${GITEA_TOKEN}@${GITEA_HOST}/${REPO_PATH} /workspace
|
||||
- git clone --depth=1 --branch main http://oauth2:${GITEA_TOKEN}@${GITEA_HOST}/${REPO_PATH} /workspace
|
||||
volumeMounts:
|
||||
- name: ws
|
||||
mountPath: /workspace
|
||||
containers:
|
||||
- name: kaniko
|
||||
image: ${PULL_REGISTRY}/${PROJECT}/kaniko-executor:v1.27.6-debug
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: registry-egress-proxy
|
||||
args:
|
||||
- --dockerfile=/workspace/frontend/Dockerfile
|
||||
- --context=dir:///workspace/frontend
|
||||
@@ -154,7 +168,11 @@ jobs:
|
||||
path: config.json
|
||||
ENDJOB
|
||||
echo "Waiting for frontend build job: ${JOB_NAME}"
|
||||
kubectl -n ${BUILD_NS} wait --for=condition=complete job/${JOB_NAME} --timeout=20m
|
||||
if ! kubectl -n ${BUILD_NS} wait --for=condition=complete job/${JOB_NAME} --timeout=40m; then
|
||||
echo "--- kaniko logs (tail) ---"
|
||||
kubectl -n ${BUILD_NS} logs job/${JOB_NAME} -c kaniko --tail=100 || true
|
||||
exit 1
|
||||
fi
|
||||
echo "Frontend build done"
|
||||
|
||||
- name: Update GitOps repo and push
|
||||
|
||||
Reference in New Issue
Block a user