Skip to content

Commit 4e8cf8f

Browse files
authored
Fix a panic that could occur when context was omitted (#83)
I could have sworn the context property was required, but evidently it isn't and we weren't handling the case when it was missing. This PR updates things to set a default location of the current directory if the context is absent. Some unit tests are also added. Fixes #78.
1 parent 44e082a commit 4e8cf8f

File tree

27 files changed

+137
-66
lines changed

27 files changed

+137
-66
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Fixed the default value for `ACTIONS_CACHE_URL` when using GitHub action caching. (https://github.com/pulumi/pulumi-docker-build/pull/80)
66
- Fixed Java SDK publishing. (https://github.com/pulumi/pulumi-docker-build/pull/89)
7+
- Fixed a panic that could occur when `context` was omitted. (https://github.com/pulumi/pulumi-docker-build/pull/83)
78

89
## 0.0.2 (2024-04-25)
910

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ define example
107107
--language $(1) \
108108
--out ${WORKING_DIR}/examples/$(1)
109109
cp -r ${WORKING_DIR}/examples/app ${WORKING_DIR}/examples/$(1)/app
110+
cp ${WORKING_DIR}/examples/yaml/.dockerignore ${WORKING_DIR}/examples/$(1)/.dockerignore
110111
endef
111112

112113
up::

examples/dotnet/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
command-output
2+
tmp

examples/dotnet/Program.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,6 @@ COPY hello.c ./
239239
RUN echo ""This uses an inline Dockerfile! 👍""
240240
",
241241
},
242-
Context = new DockerBuild.Inputs.BuildContextArgs
243-
{
244-
Location = "./app",
245-
},
246242
});
247243

248244
var dockerLoad = new DockerBuild.Image("dockerLoad", new()

examples/go/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
command-output
2+
tmp

examples/go/main.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,6 @@ func main() {
207207
Dockerfile: &dockerbuild.DockerfileArgs{
208208
Inline: pulumi.String("FROM alpine\nRUN echo \"This uses an inline Dockerfile! 👍\"\n"),
209209
},
210-
Context: &dockerbuild.BuildContextArgs{
211-
Location: pulumi.String("./app"),
212-
},
213210
})
214211
if err != nil {
215212
return err

examples/java/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
command-output
2+
tmp

examples/java/src/main/java/generated_program/App.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ public static void stack(Context ctx) {
185185
RUN echo "This uses an inline Dockerfile! 👍"
186186
""")
187187
.build())
188-
.context(BuildContextArgs.builder()
189-
.location("./app")
190-
.build())
191188
.build());
192189

193190
var dockerLoad = new Image("dockerLoad", ImageArgs.builder()

examples/nodejs/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
command-output
2+
tmp

examples/nodejs/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ const inline = new docker_build.Image("inline", {
154154
RUN echo "This uses an inline Dockerfile! 👍"
155155
`,
156156
},
157-
context: {
158-
location: "./app",
159-
},
160157
});
161158
const dockerLoad = new docker_build.Image("dockerLoad", {
162159
push: false,

0 commit comments

Comments
 (0)