Jenkins file fix
This commit is contained in:
parent
38a1ca1c80
commit
3df67f9c19
56
Jenkinsfile
vendored
56
Jenkinsfile
vendored
|
@ -6,9 +6,19 @@ pipeline {
|
||||||
}
|
}
|
||||||
parameters {
|
parameters {
|
||||||
booleanParam(name: 'SKIP_TESTS', defaultValue: true, description: 'Skip tests')
|
booleanParam(name: 'SKIP_TESTS', defaultValue: true, description: 'Skip tests')
|
||||||
|
booleanParam(name: 'SKIP_PUBLISH', defaultValue: false, description: 'Skip docker image build&push')
|
||||||
|
booleanParam(name: 'SKIP_CLUSTER_UPDATE', defaultValue: false, description: 'Skip cluster state repo commit')
|
||||||
string(
|
string(
|
||||||
name: 'IMAGE_TAG', defaultValue: 'docker.charlyghislain.com/charlyghislaindotcom',
|
name: 'IMAGE', defaultValue: 'charlyghislaindotcom',
|
||||||
description: 'Image tag to push'
|
description: 'Image to push (suffixed -fr or -en)'
|
||||||
|
)
|
||||||
|
string(
|
||||||
|
name: 'REPO', defaultValue: 'docker.charlyghislain.com',
|
||||||
|
description: 'Repo to push'
|
||||||
|
)
|
||||||
|
credentials(
|
||||||
|
name: 'REPO_USERNAMEPASS_CREDENTIAL', defaultValue: 'jenkins-jenkins-nexus-credentials',
|
||||||
|
description: 'Cred for repo', credentialType: "Username with password"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
@ -34,27 +44,43 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ('Publish') {
|
stage ('Publish') {
|
||||||
|
when {
|
||||||
|
expression { return params.SKIP_PUBLISH != true }
|
||||||
|
}
|
||||||
agent {
|
agent {
|
||||||
label 'docker'
|
label 'docker'
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
container('docker') {
|
container('docker') {
|
||||||
unstash(name: 'dist')
|
unstash(name: 'dist')
|
||||||
sh '''
|
script {
|
||||||
export COMMIT="$(git rev-parse --short HEAD)"
|
VERSION = sh(script: 'head -n1 dist/.version', returnStdout: true).trim()
|
||||||
docker build --build-arg CLANG=fr -t "${IMAGE_TAG}-fr:${COMMIT}" .
|
def fr = docker.build("${params.REPO}/${params.IMAGE}-fr:${VERSION}", "--build-arg CLANG=fr .")
|
||||||
docker push "${IMAGE_TAG}-fr:${COMMIT}" .
|
def en = docker.build("${params.REPO}/${params.IMAGE}-en:${VERSION}", "--build-arg CLANG=en .")
|
||||||
docker build --build-arg CLANG=en -t "${IMAGE_TAG}-en:${COMMIT}" .
|
|
||||||
docker push "${IMAGE_TAG}-en:${COMMIT}" .
|
fr.push()
|
||||||
'''
|
fr.push('latest')
|
||||||
build job: 'infra/cluster-conf-update', parameters: [
|
en.push()
|
||||||
string(name:"STACK", value:"charlyghislaindotcom"),
|
en.push('latest')
|
||||||
string(name:"VALUES_FILE", value:"values.yaml"),
|
}
|
||||||
string(name:"VALUES_KEY", value:".deployment.imageTag"),
|
|
||||||
string(name:"VALUES_VALUE", value:"\"${env.COMMIT}\""),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage ('Update cluster') {
|
||||||
|
when {
|
||||||
|
allOf {
|
||||||
|
expression { return params.SKIP_PUBLISH != true }
|
||||||
|
expression { return params.SKIP_CLUSTER_UPDATE != true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
build job: 'infra/cluster-conf-update', parameters: [
|
||||||
|
string(name:"STACK", value:"charlyghislaindotcom"),
|
||||||
|
string(name:"VALUES_FILE", value:"values.yaml"),
|
||||||
|
string(name:"VALUES_KEY", value:".deployment.imageTag"),
|
||||||
|
string(name:"VALUES_VALUE", value:"\"${VERSION}\""),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ multibranchPipelineJob('charlyghislaindotcom/charlyghislaindotcom') {
|
||||||
branchSource {
|
branchSource {
|
||||||
source {
|
source {
|
||||||
git {
|
git {
|
||||||
id('lifeislife_lifeislife-front_repo') // IMPORTANT: use a constant and unique identifier
|
id('charlyghislaindotcom-front_repo') // IMPORTANT: use a constant and unique identifier
|
||||||
remote('ssh://git@gitea.charlyghislain.com:2022/cghislai/charlyghislaindotcom.git')
|
remote('ssh://git@gitea.charlyghislain.com:2022/cghislai/charlyghislaindotcom.git')
|
||||||
credentialsId('jenkins-jenkins-ssh-key')
|
credentialsId('jenkins-jenkins-ssh-key')
|
||||||
traits {
|
traits {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user