61 lines
2.2 KiB
Groovy
61 lines
2.2 KiB
Groovy
pipeline {
|
|
agent any
|
|
options {
|
|
disableConcurrentBuilds()
|
|
buildDiscarder(logRotator(numToKeepStr: '10'))
|
|
}
|
|
parameters {
|
|
booleanParam(name: 'SKIP_TESTS', defaultValue: true, description: 'Skip tests')
|
|
string(
|
|
name: 'IMAGE_TAG', defaultValue: 'docker.charlyghislain.com/charlyghislaindotcom',
|
|
description: 'Image tag to push'
|
|
)
|
|
}
|
|
stages {
|
|
stage ('Build') {
|
|
steps {
|
|
nodejs(nodeJSInstallationName: 'node 10', configId: 'npm-global-config') { catchError {
|
|
ansiColor('xterm') {
|
|
sh '''
|
|
rm -rfv dist*
|
|
npm install
|
|
|
|
export DATE="$(date -Iseconds)"
|
|
export COMMIT="$(git rev-parse --short HEAD)"
|
|
echo '{"date":"'$DATE'","commit": "'$COMMIT'"}' > src/assets/buildinfo.json
|
|
|
|
./node_modules/.bin/ng build -c "production-fr"
|
|
./node_modules/.bin/ng build -c "production-en"
|
|
echo "$COMMIT" > dist/.version
|
|
'''
|
|
}
|
|
}}
|
|
stash(name: 'dist', includes: 'dist/**')
|
|
}
|
|
}
|
|
stage ('Publish') {
|
|
agent {
|
|
label 'docker'
|
|
}
|
|
steps {
|
|
container('docker') {
|
|
unstash(name: 'dist')
|
|
sh '''
|
|
export COMMIT="$(git rev-parse --short HEAD)"
|
|
docker build --build-arg CLANG=fr -t "${IMAGE_TAG}-fr:${COMMIT}" .
|
|
docker push "${IMAGE_TAG}-fr:${COMMIT}" .
|
|
docker build --build-arg CLANG=en -t "${IMAGE_TAG}-en:${COMMIT}" .
|
|
docker push "${IMAGE_TAG}-en:${COMMIT}" .
|
|
'''
|
|
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:"\"${env.COMMIT}\""),
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|