Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 5e09f2a

Browse files
author
Ulysses Souza
committed
Forbid variable substitution on image field
Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
1 parent 6c84a2b commit 5e09f2a

18 files changed

Lines changed: 169 additions & 78 deletions

File tree

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
# if you want to ignore files created by your editor/tools,
33
# please consider a global .gitignore https://help.github.com/articles/ignoring-files
44
*.tar.gz
5-
*.dockerapp
65
_build/
76
bin/
8-
!examples/*/*.dockerapp
9-
!e2e/**/*.dockerapp
10-
!integrations/**/*.dockerapp
117
.gradle
128
coverage.html
139
cover.out

e2e/commands_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ func TestInit(t *testing.T) {
9090
composeData := `version: "3.2"
9191
services:
9292
nginx:
93-
image: nginx:${NGINX_VERSION}
94-
command: nginx $NGINX_ARGS
93+
image: nginx:latest
94+
command: nginx $NGINX_ARGS ${NGINX_DRY_RUN}
9595
`
9696
meta := `# Version of the application
9797
version: 0.1.0
@@ -108,7 +108,7 @@ maintainers:
108108
- name: joe
109109
email: joe@joe.com
110110
`
111-
envData := "# some comment\nNGINX_VERSION=latest"
111+
envData := "# some comment\nNGINX_DRY_RUN=-t"
112112
dir := fs.NewDir(t, "app_input",
113113
fs.WithFile(internal.ComposeFileName, composeData),
114114
fs.WithFile(".env", envData),
@@ -130,7 +130,7 @@ maintainers:
130130
fs.WithMode(0755),
131131
fs.WithFile(internal.MetadataFileName, meta, fs.WithMode(0644)), // too many variables, cheating
132132
fs.WithFile(internal.ComposeFileName, composeData, fs.WithMode(0644)),
133-
fs.WithFile(internal.ParametersFileName, "NGINX_ARGS: FILL ME\nNGINX_VERSION: latest\n", fs.WithMode(0644)),
133+
fs.WithFile(internal.ParametersFileName, "NGINX_ARGS: FILL ME\nNGINX_DRY_RUN: -t\n", fs.WithMode(0644)),
134134
)
135135
assert.Assert(t, fs.Equal(dirName, manifest))
136136

e2e/testdata/attachments.dockerapp/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "3.7"
22
services:
33
front:
4-
image: nginx:${myapp.nginx_version}
4+
image: nginx:latest
55
deploy:
66
replicas: ${myapp.nginx_replicas}
77
debug:
@@ -26,4 +26,4 @@ services:
2626
command: monitor --source ${app.name}-${app.version} $$dollar
2727
x-enabled: "! ${myapp.debug}"
2828
app-watcher:
29-
image: $watcher.image
29+
image: watcher:latest

e2e/testdata/attachments.dockerapp/parameters.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
privileged: false
22
myapp:
33
debug: false
4-
nginx_version: latest
54
nginx_replicas: 2
6-
watcher:
7-
image: watcher:latest
85
read_only: true
96
stdin_open: true
107
tty: true

e2e/testdata/envvariables-inspect.golden

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ Service (1) Replicas Ports Image
66
----------- -------- ----- -----
77
test 1 alpine:latest
88

9-
Parameters (4) Value
10-
-------------- -----
11-
myapp.alpine_version latest
12-
myapp.command1 cat
13-
myapp.command2 foo
14-
myapp.command3 bar
9+
Parameters (3) Value
10+
-------------- -----
11+
myapp.command1 cat
12+
myapp.command2 foo
13+
myapp.command3 bar

e2e/testdata/init-singlefile.dockerapp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ maintainers:
1919
version: "3.2"
2020
services:
2121
nginx:
22-
image: nginx:${NGINX_VERSION}
23-
command: nginx $NGINX_ARGS
22+
image: nginx:latest
23+
command: nginx $NGINX_ARGS ${NGINX_DRY_RUN}
2424

2525
---
2626
# This section contains the default values for your application parameters.
2727
NGINX_ARGS: FILL ME
28-
NGINX_VERSION: latest
28+
NGINX_DRY_RUN: -t
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: "3.4"
22
services:
33
test:
4-
image: alpine:${myapp.alpine_version}
4+
image: alpine:latest
55
command: bash -c "${myapp.command1} ${myapp.command2} ${myapp.command3}"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
myapp:
2-
alpine_version: latest
32
command1: cat
43
command2: foo
54
command3: bar

e2e/testdata/simple/simple.dockerapp/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
version: "3.6"
22
services:
33
api:
4-
image: python:${versions.python}
4+
image: python:3.6
55
networks:
66
back:
77
front:
88
aliases:
99
- corp.app.api.com
1010
- ${api_host}
1111
web:
12-
image: nginx:${versions.nginx}
12+
image: nginx:latest
1313
networks:
1414
- front
1515
volumes:
1616
- static:/opt/${static_subdir}
1717
ports:
1818
- ${web_port}:80
1919
db:
20-
image: postgres:${versions.postgres}
20+
image: postgres:9.3
2121
networks:
2222
- back
2323
networks:
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
versions:
2-
python: '3.6'
3-
postgres: '9.3'
4-
nginx: latest
51
web_port: '8082'
62
api_host: coolapp.com
73
static_subdir: data/static

0 commit comments

Comments
 (0)