Skip to content

Commit

Permalink
fix(build): force default tsuru working dir before running deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
nettoclaudio committed Jan 18, 2023
1 parent 5c6ef6e commit 7a4a0a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/build/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ var containerfileTemplate = template.Must(template.New("containerfile").
Parse(`
FROM {{ .Image }}
WORKDIR /home/application/current
COPY ./application.tar.gz /home/application/archive.tar.gz
RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid=1000,gid=1000 \
Expand All @@ -221,8 +223,6 @@ RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid
&& { sh -lc {{ shellQuote . }}; } \
{{- end }}
&& :
WORKDIR /home/application/current
`))

type BuildResponseOutputWriter struct {
Expand Down
8 changes: 4 additions & 4 deletions pkg/build/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ func TestBuildContainerfile(t *testing.T) {
expected: `
FROM tsuru/scratch:latest
WORKDIR /home/application/current
COPY ./application.tar.gz /home/application/archive.tar.gz
RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid=1000,gid=1000 \
[ -f /var/run/secrets/envs.sh ] && . /var/run/secrets/envs.sh \
&& /var/lib/tsuru/deploy archive file:///home/application/archive.tar.gz \
&& :
WORKDIR /home/application/current
`,
},
{
Expand All @@ -338,6 +338,8 @@ WORKDIR /home/application/current
expected: `
FROM tsuru/scratch:latest
WORKDIR /home/application/current
COPY ./application.tar.gz /home/application/archive.tar.gz
RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid=1000,gid=1000 \
Expand All @@ -346,8 +348,6 @@ RUN --mount=type=secret,id=tsuru-app-envvars,target=/var/run/secrets/envs.sh,uid
&& { sh -lc 'mkdir -p /tmp/foo'; } \
&& { sh -lc 'echo "Hello world" > /tmp/foo/bar'; } \
&& :
WORKDIR /home/application/current
`,
},
}
Expand Down

0 comments on commit 7a4a0a8

Please sign in to comment.