@@ -9,6 +9,8 @@ object ContinuousIntegration {
99 lazy val ciSettings : Seq [Setting [_]] = List (
1010 srcCiResources := sourceDirectory.value / " ci" / " resources" ,
1111 targetCiResources := target.value / " ci" / " resources" ,
12+ envFile := srcCiResources.value / " env.temp" , // generated by resources/acquire_b2c_token.sh
13+
1214 vaultToken := userHome / " .vault-token" ,
1315 copyCiResources := {
1416 IO .copyDirectory(srcCiResources.value, targetCiResources.value)
@@ -26,7 +28,12 @@ object ContinuousIntegration {
2628 if (vaultToken.value.isDirectory) {
2729 sys.error(s """ The vault token file " ${vaultToken.value}" should not be a directory. """ )
2830 }
29- val cmd = List (
31+
32+ // Only include the local file argument if the file exists (local development w/ acquire_b2c_token.sh)
33+ // Don't include it otherwise (CI/CD and other development)
34+ val localEnvFileArgs = if (envFile.value.exists()) List (" -e" , s " ENV_FILE= ${envFile.value}" ) else List ()
35+
36+ val cmd : List [String ] = List .concat(List (
3037 " docker" ,
3138 " run" ,
3239 " --rm" ,
@@ -35,7 +42,9 @@ object ContinuousIntegration {
3542 " -v" ,
3643 s " ${srcCiResources.value}: ${srcCiResources.value}" ,
3744 " -v" ,
38- s " ${targetCiResources.value}: ${targetCiResources.value}" ,
45+ s " ${targetCiResources.value}: ${targetCiResources.value}" ),
46+ localEnvFileArgs,
47+ List (
3948 " -e" ,
4049 " ENVIRONMENT=not_used" ,
4150 " -e" ,
@@ -44,7 +53,7 @@ object ContinuousIntegration {
4453 s " OUT_PATH= ${targetCiResources.value}" ,
4554 " broadinstitute/dsde-toolbox:dev" ,
4655 " render-templates.sh"
47- )
56+ ))
4857 val result = cmd ! log
4958 if (result != 0 ) {
5059 sys.error(
@@ -70,6 +79,7 @@ object ContinuousIntegration {
7079 private val srcCiResources : SettingKey [File ] = settingKey[File ](" Source directory for CI resources" )
7180 private val targetCiResources : SettingKey [File ] = settingKey[File ](" Target directory for CI resources" )
7281 private val vaultToken : SettingKey [File ] = settingKey[File ](" File with the vault token" )
82+ private val envFile : SettingKey [File ] = settingKey[File ](" File with the environment variables needed to render CI resources." )
7383
7484 /**
7585 * For "reasons" these projects are excluded from the root aggregation in build.sbt.
0 commit comments