Skip to content

Commit

Permalink
Merge branch 'main' into fix-unable-to-pull-insecure-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreilich authored May 19, 2021
2 parents 0423545 + 216a4d1 commit 43cc52b
Show file tree
Hide file tree
Showing 35 changed files with 311 additions and 127 deletions.
14 changes: 14 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

tasks:
- init: make build
github:
prebuilds:
master: true
branches: true
pullRequests: true
pullRequestsFromForks: true
addCheck: true

vscode:
extensions:
- golang.go
5 changes: 5 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
* `choco install cygwin make -y`
* `[Environment]::SetEnvironmentVariable("PATH", "C:\tools\cygwin\bin;$ENV:PATH", "MACHINE")`

Alternatively, you can use Gitpod to run pre-configured dev envrionment in the cloud right from your browser

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#/~https://github.com/buildpacks/pack)


### Windows Caveats

* Symlinks - Some of our tests attempt to create symlinks. On Windows, this requires the [permission to be provided](https://stackoverflow.com/a/24353758).
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![GitHub license](https://img.shields.io/github/license/buildpacks/pack)](/~https://github.com/buildpacks/pack/blob/main/LICENSE)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4748/badge)](https://bestpractices.coreinfrastructure.org/projects/4748)
[![Slack](https://img.shields.io/badge/slack-join-ff69b4.svg?logo=slack)](https://slack.buildpacks.io/)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#/~https://github.com/buildpacks/pack)

`pack` makes it easy for...
- [**App Developers**][app-dev] to use buildpacks to convert code into runnable images.
Expand Down
2 changes: 1 addition & 1 deletion acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@ func createStackImage(dockerCli client.CommonAPIClient, repoName string, dir str
defaultFilterFunc := func(file string) bool { return true }

ctx := context.Background()
buildContext := archive.ReadDirAsTar(dir, "/", 0, 0, -1, true, defaultFilterFunc)
buildContext := archive.ReadDirAsTar(dir, "/", 0, 0, -1, true, false, defaultFilterFunc)

res, err := dockerCli.ImageBuild(ctx, buildContext, dockertypes.ImageBuildOptions{
Tags: []string{repoName},
Expand Down
1 change: 1 addition & 0 deletions acceptance/buildpacks/archive_buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (a archiveBuildpack) createTgz(sourceDir string) (string, error) {
defaultGid,
defaultMode,
true,
false,
nil,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion acceptance/testdata/mock_stack/windows/run/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
}

for _, path := range paths {
contents, err := ioutil.ReadFile(path)
contents, err := ioutil.ReadFile(filepath.Clean(path))
if err != nil {
panic(err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion build.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func (c *Client) processAppPath(appPath string) (string, error) {
}

if !fi.IsDir() {
fh, err := os.Open(resolvedAppPath)
fh, err := os.Open(filepath.Clean(resolvedAppPath))
if err != nil {
return "", errors.Wrap(err, "read file")
}
Expand Down
39 changes: 19 additions & 20 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
defaultBuilderImage.Cleanup()
fakeDefaultRunImage.Cleanup()
fakeMirror1.Cleanup()
fakeMirror2.Cleanup()
h.AssertNilE(t, defaultBuilderImage.Cleanup())
h.AssertNilE(t, fakeDefaultRunImage.Cleanup())
h.AssertNilE(t, fakeMirror1.Cleanup())
h.AssertNilE(t, fakeMirror2.Cleanup())
os.RemoveAll(tmpDir)
fakeLifecycleImage.Cleanup()
h.AssertNilE(t, fakeLifecycleImage.Cleanup())
})

when("#Build", func() {
Expand Down Expand Up @@ -226,9 +226,9 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
remoteRunImage.Cleanup()
builderWithoutLifecycleImageOrCreator.Cleanup()
h.AssertNil(t, builtImage.Cleanup())
h.AssertNilE(t, remoteRunImage.Cleanup())
h.AssertNilE(t, builderWithoutLifecycleImageOrCreator.Cleanup())
h.AssertNilE(t, builtImage.Cleanup())
})

it("only prints app name and sha", func() {
Expand All @@ -254,7 +254,7 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
builtImage.Cleanup()
h.AssertNilE(t, builtImage.Cleanup())
})

it("only prints app name and sha", func() {
Expand Down Expand Up @@ -462,8 +462,8 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
customBuilderImage.Cleanup()
fakeRunImage.Cleanup()
h.AssertNilE(t, customBuilderImage.Cleanup())
h.AssertNilE(t, fakeRunImage.Cleanup())
})

it("it uses the provided builder", func() {
Expand All @@ -489,7 +489,7 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
fakeRunImage.Cleanup()
h.AssertNilE(t, fakeRunImage.Cleanup())
})

when("run image stack matches the builder stack", func() {
Expand Down Expand Up @@ -588,8 +588,8 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
fakeLocalMirror.Cleanup()
fakeLocalMirror1.Cleanup()
h.AssertNilE(t, fakeLocalMirror.Cleanup())
h.AssertNilE(t, fakeLocalMirror1.Cleanup())
})

when("Publish is true", func() {
Expand Down Expand Up @@ -1147,7 +1147,7 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
h.AssertNil(t, os.Remove(buildpackTgz))
h.AssertNilE(t, os.Remove(buildpackTgz))
})

it("buildpacks are added to ephemeral builder", func() {
Expand Down Expand Up @@ -1331,8 +1331,7 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {

it.After(func() {
os.Unsetenv("PACK_HOME")
err := os.RemoveAll(tmpDir)
h.AssertNil(t, err)
h.AssertNil(t, os.RemoveAll(tmpDir))
})

it("all buildpacks are added to ephemeral builder", func() {
Expand Down Expand Up @@ -1644,9 +1643,9 @@ func testBuild(t *testing.T, when spec.G, it spec.S) {
})

it.After(func() {
h.AssertNil(t, os.Unsetenv("HTTP_PROXY"))
h.AssertNil(t, os.Unsetenv("HTTPS_PROXY"))
h.AssertNil(t, os.Unsetenv("NO_PROXY"))
h.AssertNilE(t, os.Unsetenv("HTTP_PROXY"))
h.AssertNilE(t, os.Unsetenv("HTTPS_PROXY"))
h.AssertNilE(t, os.Unsetenv("NO_PROXY"))
})

it("defaults to the *_PROXY environment variables", func() {
Expand Down
3 changes: 2 additions & 1 deletion builder/config_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package builder
import (
"fmt"
"os"
"path/filepath"

"github.com/BurntSushi/toml"
"github.com/pkg/errors"
Expand Down Expand Up @@ -55,7 +56,7 @@ type LifecycleConfig struct {
// ReadConfig reads a builder configuration from the file path provided and returns the
// configuration along with any warnings encountered while parsing
func ReadConfig(path string) (config Config, warnings []string, err error) {
file, err := os.Open(path)
file, err := os.Open(filepath.Clean(path))
if err != nil {
return Config{}, nil, errors.Wrap(err, "opening config file")
}
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/golang/mock v1.5.0
github.com/google/go-cmp v0.5.5
github.com/google/go-containerregistry v0.4.1
github.com/google/go-containerregistry v0.5.1
github.com/google/go-github/v30 v30.1.0
github.com/heroku/color v0.0.6
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e
github.com/moby/sys/mount v0.2.0 // indirect
github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf // indirect
github.com/onsi/gomega v1.11.0
github.com/onsi/gomega v1.12.0
github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/runc v0.1.1 // indirect
github.com/opencontainers/selinux v1.6.0 // indirect
github.com/pelletier/go-toml v1.9.0
github.com/pelletier/go-toml v1.9.1
github.com/pkg/errors v0.9.1
github.com/sabhiram/go-gitignore v0.0.0-20201211074657-223ce5d391b0
github.com/sclevine/spec v1.4.0
Expand All @@ -37,10 +37,8 @@ require (
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/mod v0.4.2
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 // indirect
google.golang.org/genproto v0.0.0-20201022181438-0ff5f38871d5 // indirect
google.golang.org/grpc v1.33.1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
)
Expand Down
Loading

0 comments on commit 43cc52b

Please sign in to comment.