Skip to content

Commit 01a2177

Browse files
ALikhachevaugi
authored andcommitted
Use ComposeSettings#getEnvironment only as env variables override map
Reading all the environment variables at configuration time leads to marking each of them as configuration cache input, so Gradle will detect value changes and invalidate cache on any irrelevant variable value change #307
1 parent bbef0ca commit 01a2177

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/main/groovy/com/avast/gradle/dockercompose/ComposeExecutor.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ComposeExecutor {
4646
if (settings.dockerComposeWorkingDirectory.isPresent()) {
4747
e.setWorkingDir(settings.dockerComposeWorkingDirectory.get().asFile)
4848
}
49-
e.environment = settings.environment.get()
49+
e.environment = System.getenv() + settings.environment.get()
5050
def finalArgs = [settings.executable.get()]
5151
finalArgs.addAll(settings.composeAdditionalArgs.get())
5252
if (noAnsi) {

src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ abstract class ComposeSettings {
168168
executable.set('docker-compose')
169169
dockerExecutable.set('docker')
170170
}
171-
environment.set(System.getenv())
172171
dockerComposeStopTimeout.set(Duration.ofSeconds(10))
173172

174173
this.containerLogToDir.set(project.buildDir.toPath().resolve('containers-logs').toFile())

src/main/groovy/com/avast/gradle/dockercompose/DockerExecutor.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DockerExecutor {
2525
def settings = this.settings
2626
new ByteArrayOutputStream().withStream { os ->
2727
def er = exec.exec { ExecSpec e ->
28-
e.environment = settings.environment.get()
28+
e.environment = System.getenv() + settings.environment.get()
2929
def finalArgs = [settings.dockerExecutable.get()]
3030
finalArgs.addAll(args)
3131
e.commandLine finalArgs

0 commit comments

Comments
 (0)