mirror of
https://github.com/cna-bootcamp/lifesub.git
synced 2025-12-06 08:06:24 +00:00
add cicd
This commit is contained in:
parent
c2c96f773a
commit
7f96247ea9
23
deployment/Jenkinsfile
vendored
23
deployment/Jenkinsfile
vendored
@ -24,10 +24,12 @@ podTemplate(
|
||||
def props
|
||||
def imageTag = getImageTag()
|
||||
def manifest = "deploy.yaml"
|
||||
def namespace
|
||||
|
||||
stage("Get Source") {
|
||||
checkout scm
|
||||
props = readProperties file: "deployment/deploy_env_vars"
|
||||
namespace = "${props.teamid}-${props.root_project}-ns"
|
||||
}
|
||||
|
||||
stage("Setup AKS") {
|
||||
@ -36,7 +38,7 @@ podTemplate(
|
||||
sh """
|
||||
az login --service-principal -u \$AZURE_CLIENT_ID -p \$AZURE_CLIENT_SECRET -t \$AZURE_TENANT_ID
|
||||
az aks get-credentials --resource-group ictcoe-edu --name ${props.teamid}-aks --overwrite-existing
|
||||
kubectl create namespace ${props.namespace} --dry-run=client -o yaml | kubectl apply -f -
|
||||
kubectl create namespace ${namespace} --dry-run=client -o yaml | kubectl apply -f -
|
||||
"""
|
||||
}
|
||||
}
|
||||
@ -84,6 +86,19 @@ podTemplate(
|
||||
|
||||
stage('Generate & Apply Manifest') {
|
||||
container('envsubst') {
|
||||
sh """
|
||||
export namespace=${namespace}
|
||||
export allowed_origins=${props.allowed_origins}
|
||||
export jwt_secret_key=${props.jwt_secret_key}
|
||||
export postgres_user=${props.postgres_user}
|
||||
export postgres_password=${props.postgres_password}
|
||||
export replicas=${props.replicas}
|
||||
export resources_requests_cpu=${props.resources_requests_cpu}
|
||||
export resources_requests_memory=${props.resources_requests_memory}
|
||||
export resources_limits_cpu=${props.resources_limits_cpu}
|
||||
export resources_limits_memory=${props.resources_limits_memory}
|
||||
"""
|
||||
|
||||
services.each { service ->
|
||||
sh """
|
||||
export ${service}_image_path=${props.registry}/${props.image_org}/${service}:${imageTag}
|
||||
@ -101,9 +116,9 @@ podTemplate(
|
||||
kubectl apply -f deployment/${manifest}
|
||||
|
||||
echo "Waiting for deployments to be ready..."
|
||||
kubectl -n ${props.namespace} wait --for=condition=available deployment/member --timeout=300s
|
||||
kubectl -n ${props.namespace} wait --for=condition=available deployment/mysub --timeout=300s
|
||||
kubectl -n ${props.namespace} wait --for=condition=available deployment/recommend --timeout=300s
|
||||
kubectl -n ${namespace} wait --for=condition=available deployment/member --timeout=300s
|
||||
kubectl -n ${namespace} wait --for=condition=available deployment/mysub --timeout=300s
|
||||
kubectl -n ${namespace} wait --for=condition=available deployment/recommend --timeout=300s
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
# Team Settings
|
||||
teamid=dg0200
|
||||
root_project=lifesub
|
||||
namespace=${teamid}-${root_project}-ns
|
||||
|
||||
# Container Registry Settings
|
||||
registry=${teamid}cr.azurecr.io
|
||||
registry=dg0200cr.azurecr.io
|
||||
image_org=lifesub
|
||||
|
||||
# Application Settings
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user