Skip to content

Commit

Permalink
Merge pull request #11675 from baude/playkubebuildcontextdir
Browse files Browse the repository at this point in the history
Set context dir for play kube build
  • Loading branch information
openshift-merge-robot authored Sep 23, 2021
2 parents f690f78 + 2df0685 commit 800d594
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/domain/infra/abi/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ func (ic *ContainerEngine) getImageAndLabelInfo(ctx context.Context, cwd string,
buildOpts.Isolation = buildahDefine.IsolationChroot
buildOpts.CommonBuildOpts = commonOpts
buildOpts.Output = container.Image
buildOpts.ContextDirectory = filepath.Dir(buildFile)
if _, _, err := ic.Libpod.Build(ctx, *buildOpts, []string{buildFile}...); err != nil {
return nil, nil, err
}
Expand Down
19 changes: 17 additions & 2 deletions test/e2e/play_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ status: {}
FROM quay.io/libpod/alpine_nginx:latest
RUN apk update && apk add strace
LABEL homer=dad
COPY copyfile /copyfile
`
var prebuiltImage = `
FROM quay.io/libpod/alpine_nginx:latest
RUN apk update && apk add strace
LABEL marge=mom
`

var copyFile = `just a text file
`

It("Check that image is built using Dockerfile", func() {
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
Expand All @@ -97,7 +102,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Dockerfile"))
Expect(err).To(BeNil())

// Write a file to be copied
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
Expect(err).To(BeNil())
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expect(err).To(BeNil())
Expand Down Expand Up @@ -131,7 +138,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
Expect(err).To(BeNil())

// Write a file to be copied
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
Expect(err).To(BeNil())
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expect(err).To(BeNil())
Expand Down Expand Up @@ -172,6 +181,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
Expect(err).To(BeNil())
// Write a file to be copied
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
Expect(err).To(BeNil())

// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expand Down Expand Up @@ -215,6 +227,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
Expect(err).To(BeNil())
// Write a file to be copied
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
Expect(err).To(BeNil())

// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expand Down

0 comments on commit 800d594

Please sign in to comment.