Skip to content

Commit

Permalink
backport: bug fixes for 0.21 (#793)
Browse files Browse the repository at this point in the history
* fix: auth check (#773)

* fix: auth check

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fix: auth check

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* chore: skip integration tests for now (#780)

Signed-off-by: Lance Ball <lball@redhat.com>

* fix: error type-check condition (#786)

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fix: use domain qualified registry for springboot (#789)

The builder image name should include the registry name. Also it seems
that the tiny builder doesn't actually work. We need base.

Fixes: #775

Signed-off-by: Lance Ball <lball@redhat.com>

* fix: use paketo base image for springboot (#792)

The build actually seems to require `base` vs `tiny.

Signed-off-by: Lance Ball <lball@redhat.com>

Co-authored-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
lance and matejvasek committed Jan 27, 2022
1 parent a579391 commit 947f982
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
6 changes: 5 additions & 1 deletion docker/creds/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func CheckAuth(ctx context.Context, registry string, credentials docker.Credenti
serverAddress = "https://" + serverAddress
}

url := fmt.Sprintf("%s/v2", serverAddress)
url := fmt.Sprintf("%s/v2/", serverAddress)

authenticator := &authn.Basic{
Username: credentials.Username,
Expand All @@ -55,6 +55,10 @@ func CheckAuth(ctx context.Context, registry string, credentials docker.Credenti

tr, err := transport.NewWithContext(ctx, reg, authenticator, trans, nil)
if err != nil {
var transportErr *transport.Error
if errors.As(err, &transportErr) && transportErr.StatusCode == 401 {
return ErrUnauthorized
}
return err
}

Expand Down
1 change: 1 addition & 0 deletions docker/creds/credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func startServer(t *testing.T) (addr, addrTLS string, stopServer func()) {
addrTLS = listenerTLS.Addr().String()

handler := http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
// TODO add also test for token based auth
resp.Header().Add("WWW-Authenticate", "basic")
if user, pwd, ok := req.BasicAuth(); ok {
if user == "testuser" && pwd == "testpwd" {
Expand Down
2 changes: 1 addition & 1 deletion pkged.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/springboot/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
builders:
default: paketobuildpacks/builder:tiny
default: gcr.io/paketo-buildpacks/builder:base
buildEnvs:
- name: BP_NATIVE_IMAGE
value: "true"
12 changes: 6 additions & 6 deletions test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ function unit_tests() {
}

function integration_tests() {
header "Running func integration tests"
make test-integration || failed=1
header "Skipping func integration tests"
# make test-integration || failed=1

if (( failed )); then
results_banner "Integration tests failed"
exit ${failed}
fi
# if (( failed )); then
# results_banner "Integration tests failed"
# exit ${failed}
# fi
}

main $@

0 comments on commit 947f982

Please sign in to comment.