Skip to content

Commit

Permalink
Run analyze and export in container
Browse files Browse the repository at this point in the history
* provides PACK_REGISTRY_AUTH for authorization with registry
* mounts docker.sock and runs as root for daemon

Signed-off-by: Emily Casey <ecasey@pivotal.io>
Signed-off-by: Matthew McNew <mmcnew@pivotal.io>
  • Loading branch information
ekcasey authored and matthewmcnew committed Dec 11, 2018
1 parent 125c759 commit 39f6562
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 367 deletions.
20 changes: 13 additions & 7 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ func testPack(t *testing.T, when spec.G, it spec.S) {
})
it.After(func() {
repoName := fmt.Sprintf("pack.local/run/%x", md5.Sum([]byte(sourceCodePath)))
killDockerByRepoName(t, repoName)
h.AssertNil(t, h.DockerRmi(dockerCli, repoName))

if sourceCodePath != "" {
Expand Down Expand Up @@ -417,9 +416,14 @@ func testPack(t *testing.T, when spec.G, it spec.S) {
buildOutput, err := cmd.CombinedOutput()
h.AssertNil(t, err)
defer func(origID string) { h.AssertNil(t, h.DockerRmi(dockerCli, origID)) }(h.ImageID(t, repoName))
expectedDetectOutput := "First Mock Buildpack: pass | Second Mock Buildpack: pass | Third Mock Buildpack: pass"
if !strings.Contains(string(buildOutput), expectedDetectOutput) {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, expectedDetectOutput, buildOutput)
if !strings.Contains(string(buildOutput), "First Mock Buildpack: pass") {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, "First Mock Buildpack: pass", buildOutput)
}
if !strings.Contains(string(buildOutput), "Second Mock Buildpack: pass") {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, "Second Mock Buildpack: pass", buildOutput)
}
if !strings.Contains(string(buildOutput), "Third Mock Buildpack: pass") {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, "Third Mock Buildpack: pass", buildOutput)
}

t.Log("run app container")
Expand Down Expand Up @@ -451,9 +455,11 @@ func testPack(t *testing.T, when spec.G, it spec.S) {
if !strings.Contains(string(buildOutput), latestInfo) {
t.Fatalf(`expected build output to contain "%s", got "%s"`, latestInfo, buildOutput)
}
expectedDetectOutput = "Latest First Mock Buildpack: pass | Third Mock Buildpack: pass"
if !strings.Contains(string(buildOutput), expectedDetectOutput) {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, expectedDetectOutput, buildOutput)
if !strings.Contains(string(buildOutput), "Latest First Mock Buildpack: pass") {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, "Latest First Mock Buildpack: pass", buildOutput)
}
if !strings.Contains(string(buildOutput), "Third Mock Buildpack: pass") {
t.Fatalf(`Expected build output to contain detection output "%s", got "%s"`, "Third Mock Buildpack: pass", buildOutput)
}

t.Log("run app container")
Expand Down
2 changes: 1 addition & 1 deletion acceptance/testdata/mock_buildpacks/first-latest/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -o errexit
set -o nounset
set -o pipefail

launch_dir=$3
launch_dir=$4

mkdir "$launch_dir/first-layer"
echo "Latest First Dep Contents" > "$launch_dir/first-layer/first-dep"
Expand Down
3 changes: 2 additions & 1 deletion acceptance/testdata/mock_buildpacks/first/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -o errexit
set -o nounset
set -o pipefail

launch_dir=$3
launch_dir=$4

mkdir "$launch_dir/first-layer"
echo "First Dep Contents" > "$launch_dir/first-layer/first-dep"
Expand All @@ -15,4 +15,5 @@ ln -snf "$launch_dir/first-layer/first-dep" first-dep
touch "$launch_dir/first-layer.toml"
echo 'processes = [{ type = "web", command = "./run"}]' > "$launch_dir/launch.toml"

ls -al
echo "---> Done"
2 changes: 1 addition & 1 deletion acceptance/testdata/mock_buildpacks/second/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o errexit
set -o nounset
set -o pipefail

launch_dir=$3
launch_dir=$4

mkdir "$launch_dir/second-layer"
echo "Second Dep Contents" > "$launch_dir/second-layer/second-dep"
Expand Down
3 changes: 2 additions & 1 deletion acceptance/testdata/mock_buildpacks/third/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o errexit
set -o nounset
set -o pipefail

launch_dir=$3
launch_dir=$4

mkdir "$launch_dir/third-layer"
echo "Third Dep Contents" > "$launch_dir/third-layer/third-dep"
Expand All @@ -14,4 +14,5 @@ ln -snf "$launch_dir/third-layer/third-dep" third-dep
touch "$launch_dir/third-layer.toml"
echo 'processes = [{ type = "web", command = "./run"}]' > "$launch_dir/launch.toml"

ls -al
echo "---> Done"
Loading

0 comments on commit 39f6562

Please sign in to comment.