feature/DO-1628_CICD_msg_test (!84)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/84 Reviewed-by: Rustam Tagaev <rustam.tagaev@avroid.team> Reviewed-by: Denis Patrakeev <denis.patrakeev@avroid.team>
This commit is contained in:
@@ -14,13 +14,18 @@ properties([
|
|||||||
Git git = new Git(this, env.JENKINS_GIT_CREDENTIALS_SSH)
|
Git git = new Git(this, env.JENKINS_GIT_CREDENTIALS_SSH)
|
||||||
|
|
||||||
String repoPath = 'Apps-Backend/msg-messenger-core-api.git'
|
String repoPath = 'Apps-Backend/msg-messenger-core-api.git'
|
||||||
String publishBranch = 'develop'
|
|
||||||
|
Map envBranch = [
|
||||||
|
'DEV': 'develop',
|
||||||
|
'TEST': 'test'
|
||||||
|
]
|
||||||
String dockerGroup = 'cloud'
|
String dockerGroup = 'cloud'
|
||||||
String dockerProject = 'msg-messenger-core-api'
|
String dockerProject = 'msg-messenger-core-api'
|
||||||
String projectSettingFile = 'pyproject.toml'
|
String projectSettingFile = 'pyproject.toml'
|
||||||
Map gitVars = [:]
|
Map gitVars = [:]
|
||||||
String tag = ''
|
String tag = ''
|
||||||
String branch = git.getBranch()
|
String branch = git.getBranch()
|
||||||
|
String publishBranch = envBranch.find { it.value == branch }?.value
|
||||||
|
|
||||||
Map configuration = [
|
Map configuration = [
|
||||||
vaultUrl: env.JENKINS_VAULT_URL,
|
vaultUrl: env.JENKINS_VAULT_URL,
|
||||||
@@ -74,17 +79,17 @@ slaveTemplates.jnlp {
|
|||||||
"--build-arg PIP_INDEX_URL=${env.JENKINS_PIP_INDEX_URL} -f Dockerfile ."
|
"--build-arg PIP_INDEX_URL=${env.JENKINS_PIP_INDEX_URL} -f Dockerfile ."
|
||||||
)
|
)
|
||||||
|
|
||||||
if (branch == publishBranch) {
|
if (publishBranch.contains(branch)) {
|
||||||
buildImage.push()
|
buildImage.push()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('deploy application'){
|
stage('deploy application'){
|
||||||
if (branch == publishBranch){
|
if (publishBranch.contains(branch)){
|
||||||
build job: 'Cloud/Deploy/Backend/msg-messenger-core-api-deploy',
|
build job: 'Cloud/Deploy/Backend/msg-messenger-core-api-deploy',
|
||||||
parameters: [
|
parameters: [
|
||||||
string(name: 'ENV', value: 'DEV'),
|
string(name: 'ENV', value: envBranch.find { it.value == branch }?.key ),
|
||||||
string(name: 'APP_VERSION', value: tag)
|
string(name: 'APP_VERSION', value: tag)
|
||||||
],
|
],
|
||||||
wait: false
|
wait: false
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ String projectName = 'cloud' // Replace with your Harbor project name
|
|||||||
String repositoryName = 'msg-messenger-core-api' // Replace with your Harbor repository name
|
String repositoryName = 'msg-messenger-core-api' // Replace with your Harbor repository name
|
||||||
String k8sAppName = repositoryName
|
String k8sAppName = repositoryName
|
||||||
String pageSize = 100 // maximum number of artifacts to return 100
|
String pageSize = 100 // maximum number of artifacts to return 100
|
||||||
|
Map envBranch = [
|
||||||
|
'DEV': 'develop',
|
||||||
|
'TEST': 'test'
|
||||||
|
]
|
||||||
|
|
||||||
String apiUrl = "https://${JENKINS_DOCKER_REGISTRY}/api/v2.0/projects/${projectName}" +
|
String apiUrl = "https://${JENKINS_DOCKER_REGISTRY}/api/v2.0/projects/${projectName}" +
|
||||||
"/repositories/${repositoryName}/artifacts"
|
"/repositories/${repositoryName}/artifacts"
|
||||||
properties([
|
properties([
|
||||||
@@ -20,7 +25,7 @@ properties([
|
|||||||
parameters([
|
parameters([
|
||||||
choice(
|
choice(
|
||||||
name: 'ENV',
|
name: 'ENV',
|
||||||
choices: ['DEV'],
|
choices: envBranch.keySet().toList(),
|
||||||
description: 'Select one of environments'
|
description: 'Select one of environments'
|
||||||
),
|
),
|
||||||
[$class: 'ChoiceParameter',
|
[$class: 'ChoiceParameter',
|
||||||
@@ -70,10 +75,8 @@ return imageVersions
|
|||||||
])
|
])
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
String repoPath = 'Apps-Backend/msg-messenger-core-api.git'
|
String repoPath = 'Apps-Backend/msg-messenger-core-api.git'
|
||||||
String branch = 'develop'
|
String branch = envBranch.find { it.key == params.ENV }?.value
|
||||||
String valuesPath = ".helm/values.${params.ENV.toLowerCase()}.yaml"
|
String valuesPath = ".helm/values.${params.ENV.toLowerCase()}.yaml"
|
||||||
String namespace = "tavro-cloud-${params.ENV.toLowerCase()}"
|
String namespace = "tavro-cloud-${params.ENV.toLowerCase()}"
|
||||||
|
|
||||||
@@ -81,7 +84,7 @@ String namespace = "tavro-cloud-${params.ENV.toLowerCase()}"
|
|||||||
String helmChart = 'msg-messenger-core-api'
|
String helmChart = 'msg-messenger-core-api'
|
||||||
String helmRepoPath = "avroid/${helmChart}"
|
String helmRepoPath = "avroid/${helmChart}"
|
||||||
String helmRepo = "${env.JENKINS_NEXUS_URL}/repository/devops-helm-release"
|
String helmRepo = "${env.JENKINS_NEXUS_URL}/repository/devops-helm-release"
|
||||||
|
println(branch)
|
||||||
Git git = new Git(this, env.JENKINS_GIT_CREDENTIALS_SSH)
|
Git git = new Git(this, env.JENKINS_GIT_CREDENTIALS_SSH)
|
||||||
PodTemplates slaveTemplates = new PodTemplates(this, env.JENKINS_DOCKER_REGISTRY,
|
PodTemplates slaveTemplates = new PodTemplates(this, env.JENKINS_DOCKER_REGISTRY,
|
||||||
["${env.JENKINS_K8S_HARBOR_SECRET}"],
|
["${env.JENKINS_K8S_HARBOR_SECRET}"],
|
||||||
|
|||||||
Reference in New Issue
Block a user