Skip to content

Commit 4d5cf86

Browse files
fix: Determine version variable from build.args Value, not Key
1 parent 04a7d42 commit 4d5cf86

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ HELM_VERSION=3.8.1
1919
HTTPIE_VERSION=2.6.0
2020
HTTP_VERSION=${HTTPIE_VERSION}
2121
JAVA_VERSION=17.0.2
22+
LATEX_ALPINE_VERSION=${ALPINE_VERSION}
2223
LUA_IMAGE=nickblah/lua
2324
LUA_VERSION=5.4.3
2425
NODE_VERSION=17.7.2

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ services:
103103
context: apps/alpine
104104
dockerfile: ../alpine/Dockerfile
105105
args:
106-
ALPINE_VERSION: "${ALPINE_VERSION}"
106+
ALPINE_VERSION: "${LATEX_ALPINE_VERSION}"
107107
ALPINE_PACKAGES: "texlive-full py-pygments gnuplot make git"
108108
entrypoint: [ "pdflatex" ]
109109
lua:

lib/dockerized.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,6 @@ func setCommandVersion(dockerizedDockerComposeFilePath string, commandName strin
404404
variablesUsed = append(variablesUsed, variable)
405405
}
406406

407-
for _, entryPointArgument := range rawService.Entrypoint {
408-
for _, entryPointVariable := range ExtractVariablesFromString(entryPointArgument) {
409-
variablesUsed = append(variablesUsed, entryPointVariable)
410-
}
411-
}
412-
413407
if len(variablesUsed) == 0 {
414408
fmt.Printf("Error: Version selection for %s is currently not supported.\n", commandName)
415409
os.Exit(1)
@@ -431,7 +425,7 @@ func setCommandVersion(dockerizedDockerComposeFilePath string, commandName strin
431425
)
432426
os.Exit(1)
433427
} else if len(versionVariablesUsed) > 1 {
434-
fmt.Println("Multiple version variables found:")
428+
fmt.Printf("Error: To specify the version of %s, please set one of:\n", commandName)
435429
for _, versionVariable := range versionVariablesUsed {
436430
fmt.Println(" " + versionVariable)
437431
}
@@ -782,14 +776,22 @@ func ExtractVariables(rawService types.ServiceConfig) []string {
782776
usedVariables = append(usedVariables, envKey)
783777
}
784778
if rawService.Build != nil {
785-
for argKey := range rawService.Build.Args {
786-
usedVariables = append(usedVariables, argKey)
779+
for _, argValue := range rawService.Build.Args {
780+
for _, argValueVariable := range ExtractVariablesFromString(*argValue) {
781+
usedVariables = append(usedVariables, argValueVariable)
782+
}
787783
}
788784
}
789785
for _, imageVariable := range ExtractVariablesFromString(rawService.Image) {
790786
usedVariables = append(usedVariables, imageVariable)
791787
}
792788

789+
for _, entryPointArgument := range rawService.Entrypoint {
790+
for _, entryPointVariable := range ExtractVariablesFromString(entryPointArgument) {
791+
usedVariables = append(usedVariables, entryPointVariable)
792+
}
793+
}
794+
793795
usedVariables = unique(usedVariables)
794796
sort.Strings(usedVariables)
795797

0 commit comments

Comments
 (0)