updated Jenkinsfile for Gitops Workflow
This commit is contained in:
parent
d63f7b6b1c
commit
915bd2659f
|
|
@ -62,11 +62,11 @@ pipeline {
|
||||||
echo "Updating deployment manifests in GitOps repo..."
|
echo "Updating deployment manifests in GitOps repo..."
|
||||||
withCredentials([usernamePassword(credentialsId: 'gitea-token-gitops', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) {
|
withCredentials([usernamePassword(credentialsId: 'gitea-token-gitops', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) {
|
||||||
sh '''
|
sh '''
|
||||||
# Install yq kalau belum terpasang
|
# Install yq lokal (tanpa root)
|
||||||
if ! command -v yq &> /dev/null; then
|
if ! command -v ./yq &> /dev/null; then
|
||||||
echo "Installing yq..."
|
echo "Installing yq locally..."
|
||||||
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
|
wget -qO ./yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
|
||||||
chmod +x /usr/local/bin/yq
|
chmod +x ./yq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone repo GitOps
|
# Clone repo GitOps
|
||||||
|
|
@ -74,10 +74,10 @@ pipeline {
|
||||||
git -c http.sslVerify=false clone -b $GITOPS_BRANCH https://$GITEA_USER:$GITEA_PASS@git.winteraccess.id/syifa/datasiswa-gitops.git gitops
|
git -c http.sslVerify=false clone -b $GITOPS_BRANCH https://$GITEA_USER:$GITEA_PASS@git.winteraccess.id/syifa/datasiswa-gitops.git gitops
|
||||||
cd gitops
|
cd gitops
|
||||||
|
|
||||||
# Update image tag dengan yq
|
# Update image tag pakai yq lokal
|
||||||
echo "Updating image tags..."
|
echo "Updating image tags..."
|
||||||
yq e -i ".spec.template.spec.containers[] |= select(.name == \\"backend\\").image = env(BACKEND_TAG)" ${DEPLOY_OVERLAY}/patch-deployment.yaml
|
../yq e -i ".spec.template.spec.containers[] |= select(.name == \\"backend\\").image = env(BACKEND_TAG)" ${DEPLOY_OVERLAY}/patch-deployment.yaml
|
||||||
yq e -i ".spec.template.spec.containers[] |= select(.name == \\"frontend\\").image = env(FRONTEND_TAG)" ${DEPLOY_OVERLAY}/patch-deployment.yaml
|
../yq e -i ".spec.template.spec.containers[] |= select(.name == \\"frontend\\").image = env(FRONTEND_TAG)" ${DEPLOY_OVERLAY}/patch-deployment.yaml
|
||||||
|
|
||||||
# Commit & push perubahan
|
# Commit & push perubahan
|
||||||
git config user.name "jenkins"
|
git config user.name "jenkins"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue