fix: use real BUILD_ID via env var, switch to Harbor registry
Some checks failed
Build & Deploy / build (push) Failing after 21s
Some checks failed
Build & Deploy / build (push) Failing after 21s
This commit is contained in:
@@ -5,7 +5,7 @@ on:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
REGISTRY: zot-registry.cicd.svc.cluster.local:5000
|
||||
REGISTRY: 192.168.1.212:1180/library
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -23,28 +23,31 @@ jobs:
|
||||
[ -d .git ] || git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-frontend.git .
|
||||
git pull
|
||||
|
||||
cat > package.json <<'EOF'
|
||||
SHORT_SHA=${GITHUB_SHA::8}
|
||||
cat > package.json <<EOF
|
||||
{
|
||||
"name": "demo-frontend",
|
||||
"version": "1.0.0",
|
||||
"scripts": {"build": "mkdir -p dist && echo '<html><body style=\"font-family:sans-serif;padding:40px;text-align:center\"><h1>Demo Frontend</h1><p>Build: $BUILD_ID</p></body></html>' > dist/index.html"}
|
||||
"scripts": {"build": "mkdir -p dist && echo '<html><body style=\"font-family:sans-serif;padding:40px;text-align:center\"><h1>Demo Frontend</h1><p>Build: ${SHORT_SHA}</p><p>Commit: ${GITHUB_SHA}</p><p>Time: \$(date)</p></body></html>' > dist/index.html"}
|
||||
}
|
||||
EOF
|
||||
|
||||
cat > Dockerfile <<'EOF'
|
||||
cat > Dockerfile <<EOF
|
||||
FROM nginx:alpine
|
||||
COPY dist/ /usr/share/nginx/html/
|
||||
EXPOSE 80
|
||||
EOF
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
BUILD_ID: ${{ github.sha }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
|
||||
- name: Build frontend
|
||||
run: |
|
||||
cd /root/.cache/demo-frontend
|
||||
npm install --silent
|
||||
npm run build
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
|
||||
- name: Docker build & push
|
||||
run: |
|
||||
@@ -59,15 +62,13 @@ jobs:
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
|
||||
- name: Patch ArgoCD Application
|
||||
- name: Patch ArgoCD
|
||||
run: |
|
||||
SHORT=${GITHUB_SHA::8}
|
||||
if kubectl -n argocd get application demo-frontend &>/dev/null; then
|
||||
kubectl -n argocd patch application demo-frontend --type merge \
|
||||
-p "{\"spec\":{\"source\":{\"helm\":{\"parameters\":[{\"name\":\"image.tag\",\"value\":\"${SHORT}\"}]}}}}"
|
||||
echo "✓ ArgoCD app patched"
|
||||
else
|
||||
echo "⚠ demo-frontend Application not found in argocd namespace (create it manually)"
|
||||
fi
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
|
||||
Reference in New Issue
Block a user