fix: add Harbor login step and image.registry patch in CI workflow
Some checks failed
Build & Deploy Go API / build (push) Failing after 3s
Some checks failed
Build & Deploy Go API / build (push) Failing after 3s
This commit is contained in:
@@ -22,6 +22,11 @@ jobs:
|
||||
[ -d .git ] || git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-go-api.git .
|
||||
git pull
|
||||
|
||||
- name: Login to Harbor
|
||||
run: docker login 192.168.1.212:1180 -u admin -p "$HARBOR_PASSWORD"
|
||||
env:
|
||||
HARBOR_PASSWORD: ${{ secrets.HARBOR_PASSWORD }}
|
||||
|
||||
- name: Build & push image
|
||||
run: |
|
||||
cd /root/.cache/demo-go-api
|
||||
@@ -35,16 +40,18 @@ jobs:
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
REGISTRY: ${{ env.REGISTRY }}
|
||||
|
||||
- name: Patch ArgoCD
|
||||
run: |
|
||||
SHORT=${GITHUB_SHA::8}
|
||||
if kubectl -n argocd get application demo-go-api &>/dev/null; then
|
||||
kubectl -n argocd patch application demo-go-api --type merge \
|
||||
-p "{\"spec\":{\"source\":{\"helm\":{\"parameters\":[{\"name\":\"image.tag\",\"value\":\"${SHORT}\"}]}}}}"
|
||||
-p "{\"spec\":{\"source\":{\"helm\":{\"parameters\":[{\"name\":\"image.registry\",\"value\":\"${REGISTRY}\"},{\"name\":\"image.tag\",\"value\":\"${SHORT}\"}]}}}}"
|
||||
echo "✓ ArgoCD patched"
|
||||
else
|
||||
echo "⚠ demo-go-api Application not yet created"
|
||||
fi
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
REGISTRY: ${{ env.REGISTRY }}
|
||||
|
||||
Reference in New Issue
Block a user