Skip to content

Commit 0df723c

Browse files
authored
Update 'build and test' stage to use env credentials
1 parent 6f83518 commit 0df723c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Jenkinsfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ pipeline {
2828

2929
script {
3030
if (BRANCH == 'Dev') {
31-
sh 'cp backend/.env.dev backend/.env'
31+
withCredentials([file(credentialsId: 'env-dev', variable: 'ENV_FILE')]) {
32+
sh 'cp $ENV_FILE backend/.env'
33+
echo "Development environment file copied from credentials"
34+
}
3235
} else if (BRANCH == 'Main') {
33-
sh 'cp backend/.env.prod backend/.env'
36+
withCredentials([file(credentialsId: 'env-prod', variable: 'ENV_FILE')]) {
37+
sh 'cp $ENV_FILE backend/.env'
38+
echo "Production environment file copied from credentials"
39+
}
3440
}
3541
}
3642

0 commit comments

Comments
 (0)