-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the support to the new --insecure-registry parameter Signed-off-by: Domenico Luciani <[email protected]> * Add the support to the new --insecure-registry parameter in the creator command Signed-off-by: Domenico Luciani <[email protected]> * Add keychain mock and handler test Signed-off-by: Domenico Luciani <[email protected]> * Add support for a single insecure registry Signed-off-by: Domenico Luciani <[email protected]> * Add support to multiple insecure registries Signed-off-by: Domenico Luciani <[email protected]> * Adjusted flag name Signed-off-by: Domenico Luciani <[email protected]> * Fix problem with the mock Signed-off-by: Domenico Luciani <[email protected]> * InsecureRegistry to InsecureRegistries Signed-off-by: Domenico Luciani <[email protected]> * Address comment on FlagTags parity Signed-off-by: Domenico Luciani <[email protected]> * Parse the InsecureRegistry env variable with comma separated values Signed-off-by: Domenico Luciani <[email protected]> * Changed InsecureRegistry to InsecureRegistries Signed-off-by: Domenico Luciani <[email protected]> * Changing name at the env variable Signed-off-by: Domenico Luciani <[email protected]> * Exporter now accept insecure registries Signed-off-by: Domenico Luciani <[email protected]> * Bump up toward the latest version of imgutil Signed-off-by: Domenico Luciani <[email protected]> * Remove legacy guard Signed-off-by: Domenico Luciani <[email protected]> * Add WithRegistrySetting with insecure registries into restorer Signed-off-by: Domenico Luciani <[email protected]> * Add support for insecure registries to the rebaser Signed-off-by: Domenico Luciani <[email protected]> * Add rebaser testdata directory to .gitignore Signed-off-by: Domenico Luciani <[email protected]> * Cleaned testdata directory Signed-off-by: Domenico Luciani <[email protected]> * Remove testdata rebaser entries from .gitignore Signed-off-by: Domenico Luciani <[email protected]> * Add support to insecure registies for the read-write registry check Signed-off-by: Domenico Luciani <[email protected]> * Move registryHandler into its own file into the image package Signed-off-by: Domenico Luciani <[email protected]> * Add dockerfile.windows Signed-off-by: Domenico Luciani <[email protected]> * Introducing GetInsecureRegistryOptions Signed-off-by: Domenico Luciani <[email protected]> * Fix linter problems Signed-off-by: Domenico Luciani <[email protected]> * Remove legacy guards and add test support to arm64 Signed-off-by: Domenico Luciani <[email protected]> * Remove duplication and utilize new GetInsecureRegistryOptions function Signed-off-by: Domenico Luciani <[email protected]> * Extract common code for getting insecure registry options from imageRef Signed-off-by: Domenico Luciani <[email protected]> * Added cli flags behind proper guards Signed-off-by: Domenico Luciani <[email protected]> * Bumped up to the imgutil latest version with the insecure adjustment and renamed the getInsecureRegistryOptions function Signed-off-by: Domenico Luciani <[email protected]> * Make the getInsecureOptions a static method as a temporary solution to remove duplications Signed-off-by: Domenico Luciani <[email protected]> * Added insecure registry to the runImage in the rebaser Signed-off-by: Domenico Luciani <[email protected]> * Bump up to the latest version of imgutil with the multiple registries fix Signed-off-by: Domenico Luciani <[email protected]> * Go mod tidy Signed-off-by: Domenico Luciani <[email protected]> * Remove insecure-registry filter based on the imageRef Signed-off-by: Domenico Luciani <[email protected]> * Remove reduntant for loop and added a test for multiple GetInsecureOptions Signed-off-by: Domenico Luciani <[email protected]> * Don't remove whitespaces between buildpacks names Signed-off-by: Domenico Luciani <[email protected]> * Add FlagInsecureRegistries behind 0.13 guards Signed-off-by: Domenico Luciani <[email protected]> --------- Signed-off-by: Domenico Luciani <[email protected]>
- Loading branch information
Domenico Luciani
authored
Sep 22, 2023
1 parent
5b02ac1
commit 7ffcd58
Showing
33 changed files
with
531 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//go:build acceptance | ||
// +build acceptance | ||
|
||
package acceptance | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/sclevine/spec" | ||
"github.com/sclevine/spec/report" | ||
|
||
"github.com/buildpacks/lifecycle/api" | ||
h "github.com/buildpacks/lifecycle/testhelpers" | ||
) | ||
|
||
var ( | ||
rebaserTest *PhaseTest | ||
rebaserPath string | ||
rebaserImage string | ||
) | ||
|
||
func TestRebaser(t *testing.T) { | ||
testImageDockerContextFolder := filepath.Join("testdata", "rebaser") | ||
rebaserTest = NewPhaseTest(t, "rebaser", testImageDockerContextFolder) | ||
rebaserTest.Start(t, updateTOMLFixturesWithTestRegistry) | ||
defer rebaserTest.Stop(t) | ||
|
||
rebaserImage = rebaserTest.testImageRef | ||
rebaserPath = rebaserTest.containerBinaryPath | ||
|
||
for _, platformAPI := range api.Platform.Supported { | ||
spec.Run(t, "acceptance-rebaser/"+platformAPI.String(), testRebaser(platformAPI.String()), spec.Sequential(), spec.Report(report.Terminal{})) | ||
} | ||
} | ||
|
||
func testRebaser(platformAPI string) func(t *testing.T, when spec.G, it spec.S) { | ||
return func(t *testing.T, when spec.G, it spec.S) { | ||
when("called with insecure registry flag", func() { | ||
it.Before(func() { | ||
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "") | ||
}) | ||
it("should do an http request", func() { | ||
insecureRegistry := "host.docker.internal" | ||
rebaserOutputImageName := insecureRegistry + "/bar" | ||
_, _, err := h.DockerRunWithError(t, | ||
rebaserImage, | ||
h.WithFlags( | ||
"--env", "CNB_PLATFORM_API="+platformAPI, | ||
"--env", "CNB_INSECURE_REGISTRIES="+insecureRegistry, | ||
), | ||
h.WithArgs(ctrPath(rebaserPath), rebaserOutputImageName), | ||
) | ||
|
||
h.AssertStringContains(t, err.Error(), "http://host.docker.internal") | ||
}) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
acceptance/testdata/exporter/container/layers/analyzed_insecure.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run-image] | ||
reference = "host.docker.internal/bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM ubuntu:bionic | ||
|
||
COPY ./container/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM mcr.microsoft.com/windows/nanoserver:1809 | ||
USER ContainerAdministrator | ||
|
||
COPY container / | ||
|
||
ENV CNB_USER_ID=1 | ||
|
||
ENV CNB_GROUP_ID=1 | ||
|
||
ENV CNB_PLATFORM_API=${cnb_platform_api} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.