Skip to content

Commit

Permalink
Fix K8s env propagation
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Nov 10, 2024
1 parent a2a9c4e commit 76f0a45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ class K8sServiceImpl implements K8sService {
for( Tuple2 entry : env ) {
final String k = entry.v1
final String v = entry.v2
container.withEnv(new V1EnvVar().name(k).value(v))
container.addToEnv(new V1EnvVar().name(k).value(v))
}

// spec section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ class K8sServiceImplTest extends Specification {
getCacheDirectory() >> Path.of('/build/cache/dir')
getRequestsCpu() >> '2'
getRequestsMemory() >> '4Gi'
getEnvironmentAsTuples() >> [new Tuple2<String, String>('GITHUB_TOKEN', '123abc')]
getEnvironmentAsTuples() >> [new Tuple2<String, String>('FOO', 'abc'), new Tuple2<String, String>('BAR', 'xyz')]
}

when:
Expand All @@ -697,7 +697,7 @@ class K8sServiceImplTest extends Specification {
job.spec.template.spec.containers[0].args == args
job.spec.template.spec.containers[0].resources.requests.get('cpu') == new Quantity('2')
job.spec.template.spec.containers[0].resources.requests.get('memory') == new Quantity('4Gi')
job.spec.template.spec.containers[0].env == [ new V1EnvVar().name('GITHUB_TOKEN').value('123abc') ]
job.spec.template.spec.containers[0].env == [ new V1EnvVar().name('FOO').value('abc'), new V1EnvVar().name('BAR').value('xyz') ]
job.spec.template.spec.volumes.size() == 1
job.spec.template.spec.volumes[0].persistentVolumeClaim.claimName == 'bar'
job.spec.template.spec.restartPolicy == 'Never'
Expand Down

0 comments on commit 76f0a45

Please sign in to comment.