Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add process specific working directories #1427

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,26 +955,24 @@ func testAcceptance(
helloCommand string
helloArgs []string
helloArgsPrefix string
imageWorkdir string
)
if imageManager.HostOS() == "windows" {
webCommand = ".\\run"
helloCommand = "cmd"
helloArgs = []string{"/c", "echo hello world"}
helloArgsPrefix = " "
imageWorkdir = "c:\\workspace"

} else {
webCommand = "./run"
helloCommand = "echo"
helloArgs = []string{"hello", "world"}
helloArgsPrefix = ""
imageWorkdir = "/workspace"
}

formats := []compareFormat{
{
extension: "txt",
compareFunc: assert.TrimmedEq,
outputArg: "human-readable",
},
{
extension: "json",
compareFunc: assert.EqualJSON,
Expand All @@ -995,7 +993,6 @@ func testAcceptance(
t.Logf("inspecting image %s format", format.outputArg)

output = pack.RunSuccessfully(inspectCmd, repoName, "--output", format.outputArg)

expectedOutput := pack.FixtureManager().TemplateFixture(
fmt.Sprintf("inspect_image_local_output.%s", format.extension),
map[string]interface{}{
Expand All @@ -1008,6 +1005,7 @@ func testAcceptance(
"hello_command": helloCommand,
"hello_args": helloArgs,
"hello_args_prefix": helloArgsPrefix,
"image_workdir": imageWorkdir,
},
)

Expand Down Expand Up @@ -1604,24 +1602,22 @@ func testAcceptance(
helloCommand string
helloArgs []string
helloArgsPrefix string
imageWorkdir string
)
if imageManager.HostOS() == "windows" {
webCommand = ".\\run"
helloCommand = "cmd"
helloArgs = []string{"/c", "echo hello world"}
helloArgsPrefix = " "
imageWorkdir = "c:\\workspace"
} else {
webCommand = "./run"
helloCommand = "echo"
helloArgs = []string{"hello", "world"}
helloArgsPrefix = ""
imageWorkdir = "/workspace"
}
formats := []compareFormat{
{
extension: "txt",
compareFunc: assert.TrimmedEq,
outputArg: "human-readable",
},
{
extension: "json",
compareFunc: assert.EqualJSON,
Expand Down Expand Up @@ -1655,6 +1651,7 @@ func testAcceptance(
"hello_command": helloCommand,
"hello_args": helloArgs,
"hello_args_prefix": helloArgsPrefix,
"image_workdir": imageWorkdir,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"default": true,
"args": [
"8080"
]
],
"working-dir": "{{ ( StringsEscapeBackslash .image_workdir ) }}"
},
{
"type": "hello",
Expand All @@ -42,7 +43,8 @@
"default": false,
"args": [
{{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }}
]
],
"working-dir": "{{ ( StringsEscapeBackslash .image_workdir ) }}"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ stack = "pack.test.stack"
command = "{{ ( StringsEscapeBackslash .web_command ) }}"
default = true
args = [ "8080" ]
working-dir = "{{ ( StringsEscapeBackslash .image_workdir ) }}"

[[local_info.processes]]
type = "hello"
shell = ""
command = "{{.hello_command}}"
default = false
args = [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) ",") }} ]
working-dir = "{{ ( StringsEscapeBackslash .image_workdir ) }}"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ local_info:
default: true
args:
- '8080'
working-dir: "{{ ( StringsEscapeBackslash .image_workdir ) }}"
- type: hello
shell: ''
command: "{{.hello_command}}"
default: false
args: [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) ",") }} ]
args: [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) ",") }} ]
working-dir: "{{ ( StringsEscapeBackslash .image_workdir ) }}"
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"default": true,
"args": [
"8080"
]
],
"working-dir": "{{ ( StringsEscapeBackslash .image_workdir ) }}"
},
{
"type": "hello",
Expand All @@ -38,7 +39,8 @@
"default": false,
"args": [
{{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }}
]
],
"working-dir": "{{ ( StringsEscapeBackslash .image_workdir ) }}"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ stack = "pack.test.stack"
command = "{{( StringsEscapeBackslash .web_command )}}"
default = true
args = [ "8080" ]
working-dir = "{{ ( StringsEscapeBackslash .image_workdir ) }}"

[[remote_info.processes]]
type = "hello"
shell = ""
command = "{{.hello_command}}"
default = false
args = [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }} ]
working-dir = "{{ ( StringsEscapeBackslash .image_workdir ) }}"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ remote_info:
default: true
args:
- '8080'
working-dir: "{{ ( StringsEscapeBackslash .image_workdir ) }}"
- type: hello
shell: ''
command: "{{.hello_command}}"
default: false
args: [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }} ]
working-dir: "{{ ( StringsEscapeBackslash .image_workdir ) }}"
52 changes: 26 additions & 26 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/BurntSushi/toml v1.1.0
github.com/Masterminds/semver v1.5.0
github.com/apex/log v1.9.0
github.com/buildpacks/imgutil v0.0.0-20220310160537-4dd8bc60eaff
github.com/buildpacks/imgutil v0.0.0-20220425182719-2edb52457eb0
github.com/buildpacks/lifecycle v0.14.0
github.com/docker/cli v20.10.14+incompatible
github.com/docker/docker v20.10.14+incompatible
Expand All @@ -20,71 +20,71 @@ require (
github.com/heroku/color v0.0.6
github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e
github.com/onsi/gomega v1.19.0
github.com/opencontainers/image-spec v1.0.2
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799
github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1
github.com/rivo/tview v0.0.0-20210624165335-29d673af0ce2
github.com/sabhiram/go-gitignore v0.0.0-20201211074657-223ce5d391b0
github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sclevine/spec v1.4.0
github.com/spf13/cobra v1.4.0
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/mod v0.5.1
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Microsoft/hcsshim v0.8.23 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/containerd/cgroups v1.0.1 // indirect
github.com/containerd/containerd v1.5.8 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.10.1 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/hcsshim v0.9.2 // indirect
github.com/bits-and-blooms/bitset v1.2.2 // indirect
github.com/containerd/cgroups v1.0.3 // indirect
github.com/containerd/containerd v1.6.3 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.11.4 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker-credential-helpers v0.6.4 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.15.2 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/sys/mount v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.4.1 // indirect
github.com/moby/sys/mount v0.3.2 // indirect
github.com/moby/sys/mountinfo v0.6.1 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runc v1.0.2 // indirect
github.com/opencontainers/selinux v1.8.2 // indirect
github.com/opencontainers/runc v1.1.1 // indirect
github.com/opencontainers/selinux v1.10.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.43.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731 // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading