deprected .env file baked into docker build and jenkins ci pipeline
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
Vendored
+6
-2
@@ -17,13 +17,17 @@ pipeline {
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh './gradlew build'
|
||||
withCredentials([file(credentialsId: 'smartguide-env', variable: 'INSE_ENV_FILE')]) {
|
||||
sh './gradlew build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh './gradlew :service:test'
|
||||
withCredentials([file(credentialsId: 'smartguide-env', variable: 'INSE_ENV_FILE')]) {
|
||||
sh './gradlew :service:test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,13 @@ task createImage(type: Exec) {
|
||||
commandLine 'docker', 'build', '--platform', "${targetPlatform}", '-t', "${imagePrefix}-service:${imageVersion}", '.'
|
||||
}
|
||||
|
||||
|
||||
task test(type: Exec) {
|
||||
dependsOn createImage
|
||||
commandLine 'docker', 'run', '--rm', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '--name', "${imageName}-service-test", "${imagePrefix}-service:${imageVersion}", 'test'
|
||||
def envFile = System.getenv('INSE_ENV_FILE')
|
||||
def envArgs = envFile ? ['--env-file', envFile] : []
|
||||
commandLine(['docker', 'run', '--rm', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'"] + envArgs +
|
||||
['--name', "${imageName}-service-test", "${imagePrefix}-service:${imageVersion}", 'test'])
|
||||
ignoreExitValue false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user