release
This commit is contained in:
parent
8e87cfed5b
commit
970ef22d9c
8
.github/workflows/cicd.yaml
vendored
8
.github/workflows/cicd.yaml
vendored
@ -1,9 +1,9 @@
|
||||
name: Frontend CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
# Temporarily disabled
|
||||
# on:
|
||||
# push:
|
||||
# branches: [ main ]
|
||||
env:
|
||||
PROJECT_FOLDER: "."
|
||||
BUILD_FOLDER: "deployment"
|
||||
|
||||
88
deployment/Jenkinsfile_ArgoCD
Normal file
88
deployment/Jenkinsfile_ArgoCD
Normal file
@ -0,0 +1,88 @@
|
||||
def PIPELINE_ID = "${env.BUILD_NUMBER}"
|
||||
|
||||
def getImageTag() {
|
||||
def dateFormat = new java.text.SimpleDateFormat('yyyyMMddHHmmss')
|
||||
def currentDate = new Date()
|
||||
return dateFormat.format(currentDate)
|
||||
}
|
||||
|
||||
podTemplate(
|
||||
label: "${PIPELINE_ID}",
|
||||
serviceAccount: 'jenkins',
|
||||
containers: [
|
||||
containerTemplate(name: 'node', image: 'node:20-slim', ttyEnabled: true, command: 'cat'),
|
||||
containerTemplate(name: 'podman', image: "mgoltzsche/podman", ttyEnabled: true, command: 'cat', privileged: true),
|
||||
containerTemplate(name: 'git', image: 'alpine/git:latest', command: 'cat', ttyEnabled: true)
|
||||
],
|
||||
volumes: [
|
||||
emptyDirVolume(mountPath: '/root/.azure', memory: false)
|
||||
]
|
||||
) {
|
||||
node(PIPELINE_ID) {
|
||||
def props
|
||||
def imageTag = getImageTag()
|
||||
def manifestRepo = 'https://github.com/cna-bootcamp/lifesub-manifest.git'
|
||||
def manifestBranch = 'main'
|
||||
|
||||
stage("Get Source") {
|
||||
checkout scm
|
||||
props = readProperties file: "deployment/deploy_env_vars"
|
||||
}
|
||||
|
||||
stage('Build & Push Image') {
|
||||
container('podman') {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'acr-credentials',
|
||||
usernameVariable: 'USERNAME',
|
||||
passwordVariable: 'PASSWORD'
|
||||
)]) {
|
||||
def imagePath = "${props.registry}/${props.image_org}/lifesub-web:${imageTag}"
|
||||
|
||||
sh """
|
||||
podman login ${props.registry} --username \$USERNAME --password \$PASSWORD
|
||||
|
||||
podman build \
|
||||
--build-arg PROJECT_FOLDER="." \
|
||||
--build-arg REACT_APP_MEMBER_URL="${props.react_app_member_url}" \
|
||||
--build-arg REACT_APP_MYSUB_URL="${props.react_app_mysub_url}" \
|
||||
--build-arg REACT_APP_RECOMMEND_URL="${props.react_app_recommend_url}" \
|
||||
--build-arg BUILD_FOLDER="deployment" \
|
||||
--build-arg EXPORT_PORT="${props.export_port}" \
|
||||
-f deployment/Dockerfile-lifesub-web \
|
||||
-t ${imagePath} .
|
||||
|
||||
podman push ${imagePath}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Update Manifest') {
|
||||
container('git') {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'github-credentials',
|
||||
usernameVariable: 'GIT_USERNAME',
|
||||
passwordVariable: 'GIT_PASSWORD'
|
||||
)]) {
|
||||
// Configure Git
|
||||
sh """
|
||||
git config --global user.email "jenkins@example.com"
|
||||
git config --global user.name "Jenkins"
|
||||
|
||||
# Clone manifest repository
|
||||
git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/cna-bootcamp/lifesub-manifest.git
|
||||
cd lifesub-manifest
|
||||
|
||||
# Update image tag in deployment yaml
|
||||
sed -i 's|image: ${props.registry}/${props.image_org}/lifesub-web:.*|image: ${props.registry}/${props.image_org}/lifesub-web:${imageTag}|' lifesub-web/deployments/lifesub-web-deployment.yaml
|
||||
|
||||
# Commit and push changes
|
||||
git add .
|
||||
git commit -m "Update lifesub-web image to ${imageTag}"
|
||||
git push origin ${manifestBranch}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user