Merge branch 'dev' into 8863-estilosOrderCatalog
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
31c6b03262
|
@ -108,7 +108,6 @@ pipeline {
|
|||
}
|
||||
stage('E2E') {
|
||||
environment {
|
||||
CREDS = credentials('docker-registry')
|
||||
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
|
||||
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
|
||||
}
|
||||
|
@ -118,23 +117,24 @@ pipeline {
|
|||
sh 'rm -rf test/cypress/screenshots'
|
||||
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
|
||||
|
||||
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||
|
||||
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} pull back"
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} pull db"
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
|
||||
|
||||
def modules = sh(script: "node test/cypress/docker/find/find.js ${env.COMPOSE_TAG}", returnStdout: true).trim()
|
||||
def modules = sh(
|
||||
script: "node test/cypress/docker/find/find.js ${env.COMPOSE_TAG}",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "E2E MODULES: ${modules}"
|
||||
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
|
||||
sh "sh test/cypress/docker/cypressParallel.sh 1 '${modules}'"
|
||||
|
||||
script {
|
||||
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||
sh "docker compose ${env.COMPOSE_PARAMS} up -d"
|
||||
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
|
||||
sh "sh test/cypress/docker/cypressParallel.sh 1 '${modules}'"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
|
||||
sh "docker compose ${env.COMPOSE_PARAMS} down -v"
|
||||
archiveArtifacts artifacts: 'test/cypress/screenshots/**/*', allowEmptyArchive: true
|
||||
junit(
|
||||
testResults: 'junit/e2e-*.xml',
|
||||
|
@ -153,17 +153,8 @@ pipeline {
|
|||
VERSION = readFile 'VERSION.txt'
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sh 'quasar build'
|
||||
|
||||
def baseImage = "salix-frontend:${env.VERSION}"
|
||||
def image = docker.build(baseImage, ".")
|
||||
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
|
||||
image.push()
|
||||
image.push(env.BRANCH_NAME)
|
||||
if (IS_LATEST) image.push('latest')
|
||||
}
|
||||
}
|
||||
sh 'quasar build'
|
||||
dockerBuild 'salix-frontend', '.'
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
|
@ -186,3 +177,53 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
def dockerBuild(imageName, context, dockerfile = null) {
|
||||
if (dockerfile == null)
|
||||
dockerfile = "${context}/Dockerfile"
|
||||
|
||||
def certDir = '/home/jenkins/.buildkit/certs'
|
||||
def buildxArgs = [
|
||||
"--name=buildkitd",
|
||||
"--driver=remote",
|
||||
"--driver-opt="
|
||||
+ "cacert=${certDir}/ca.pem,"
|
||||
+ "cert=${certDir}/cert.pem,"
|
||||
+ "key=${certDir}/key.pem,"
|
||||
+ "servername=buildkitd",
|
||||
"tcp://buildkitd:1234"
|
||||
]
|
||||
|
||||
def cacheImage = "${env.REGISTRY_CACHE}/${imageName}"
|
||||
def pushImage = "${env.REGISTRY}/${imageName}"
|
||||
def baseImage = "${pushImage}:${env.VERSION}"
|
||||
|
||||
def buildArgs = [
|
||||
context,
|
||||
"--push",
|
||||
"--builder=buildkitd",
|
||||
"--file=${dockerfile}",
|
||||
"--cache-from=type=registry,ref=${cacheImage}:cache-${env.BRANCH_NAME}",
|
||||
"--cache-from=type=registry,ref=${cacheImage}:cache-dev",
|
||||
"--cache-to=type=registry,ref=${cacheImage}:cache-${env.BRANCH_NAME},mode=max",
|
||||
"--tag=${pushImage}:${env.BRANCH_NAME}"
|
||||
]
|
||||
|
||||
def isLatest = ['master', 'main'].contains(env.BRANCH_NAME)
|
||||
if (isLatest)
|
||||
buildArgs.push("--tag=${pushImage}:latest")
|
||||
|
||||
// FIXME: Nested docker.withRegistry() does not work
|
||||
// https://issues.jenkins.io/browse/JENKINS-59777
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'registry-cache',
|
||||
usernameVariable: 'CACHE_USR',
|
||||
passwordVariable: 'CACHE_PSW')
|
||||
]) {
|
||||
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
|
||||
sh 'echo "$CACHE_PSW" | docker login --username "$CACHE_USR" --password-stdin "http://$REGISTRY_CACHE"'
|
||||
sh "docker buildx create ${buildxArgs.join(' ')}"
|
||||
docker.build(baseImage, buildArgs.join(' '))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
version: '3.7'
|
||||
services:
|
||||
back:
|
||||
image: 'registry.verdnatura.es/salix-back:${COMPOSE_TAG:-dev}'
|
||||
|
|
Loading…
Reference in New Issue