Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

root: add --registry-mirror flag#836

Merged
tejal29 merged 25 commits intoGoogleContainerTools:masterfrom
greut:registry-mirror
Feb 19, 2020
Merged

root: add --registry-mirror flag#836
tejal29 merged 25 commits intoGoogleContainerTools:masterfrom
greut:registry-mirror

Conversation

@greut
Copy link
Copy Markdown
Contributor

@greut greut commented Oct 25, 2019

Fixes #406.

Description

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

Describe any changes here so maintainer can include it in the release notes, or delete this block.

- --registry-mirror <url> to override the default docker.io registry.

greut added 2 commits October 25, 2019 11:34
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@greut
Copy link
Copy Markdown
Contributor Author

greut commented Oct 25, 2019

Who could give me hand for the integration tests?

@tejal29
Copy link
Copy Markdown
Contributor

tejal29 commented Nov 7, 2019

@greut currently our integration tests are not sophisticated :)
Thank you for your contribution!
you can add a test case here to use the flag --registry-mirror https://github.com/GoogleContainerTools/kaniko/blob/master/integration/integration_test.go#L169

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@greut greut marked this pull request as ready for review November 8, 2019 15:16
greut added 2 commits November 8, 2019 16:17
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@tandeday
Copy link
Copy Markdown

tandeday commented Dec 5, 2019

We need this. What is necessary for this to move on?

@cvgw
Copy link
Copy Markdown
Contributor

cvgw commented Dec 21, 2019

Integration tests failure

Building kaniko image
Building cache warmer image
Building onbuild base image
Pushing onbuild base image
Building hardlink base image
Pushing hardlink base image
Building kaniko image using registry-mirror
Building kaniko image using registry-mirror failed: exit status 125unknown flag: --registry-mirror
See 'docker build --help'.

@googlebot googlebot added the cla: yes CLA signed by all commit authors label Dec 22, 2019
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@greut
Copy link
Copy Markdown
Contributor Author

greut commented Dec 22, 2019

@cvgw Indeed, I didn't take the proper time to understand how the integration test where meant to be written. Let me know if makes more sense now.

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Comment thread integration/integration_test.go Outdated

func TestGitBuildcontext(t *testing.T) {
repo := "github.com/GoogleContainerTools/kaniko"
dockerfile := "integration/dockerfiles/Dockerfile_test_run_2"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causing the integration tests to fail as the references to dockerfile have not been updated

# github.com/GoogleContainerTools/kaniko/integration [github.com/GoogleContainerTools/kaniko/integration.test]
./integration_test.go:193:10: undefined: dockerfile
./integration_test.go:206:10: undefined: dockerfile
./integration_test.go:248:10: undefined: dockerfile
./integration_test.go:286:2: undefined: dockerfile
./integration_test.go:291:10: undefined: dockerfile

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@tejal29
Copy link
Copy Markdown
Contributor

tejal29 commented Jan 29, 2020

@tejal29 sorry to confuse the cla bot a bit more.

no worries @greut I will take this home!

@tejal29 tejal29 removed the cla: no CLA not signed by all commit authors label Jan 29, 2020
@googlebot googlebot added the cla: no CLA not signed by all commit authors label Jan 29, 2020
@tejal29 tejal29 force-pushed the registry-mirror branch 4 times, most recently from 0ab552a to 2dadde9 Compare January 30, 2020 05:09
Comment thread integration/integration_test.go
Comment thread pkg/util/image_util.go
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Copy link
Copy Markdown
Contributor

@samos123 samos123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@samos123
Copy link
Copy Markdown
Contributor

Kokoro failure is safe to ignore since Kokoro doesn't use the pull request branch for test cases dockerfiles. See error in kokoro here:

== RUN   TestBuildViaRegistryMirror
--- FAIL: TestBuildViaRegistryMirror (10.54s)
    integration_test.go:296: Failed to build image gcr.io/kaniko-test/docker-dockerfile_registry_mirror with docker command "[docker build -t gcr.io/kaniko-test/docker-dockerfile_registry_mirror -f integration/dockerfiles/Dockerfile_registry_mirror github.com/GoogleContainerTools/kaniko]": exit status 1 unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /tmpfs/tmp/docker-build-git816172650/integration/dockerfiles/Dockerfile_registry_mirror: no such file or directory
    integration_test.go:313: Failed to build image gcr.io/kaniko-test/docker-dockerfile_registry_mirror with kaniko command "[docker run --net=host -v /home/kbuilder/.config/gcloud:/root/.config/gcloud executor-image -f integration/dockerfiles/Dockerfile_registry_mirror -d gcr.io/kaniko-test/kaniko-dockerfile_registry_mirror --registry-mirror us-mirror.gcr.io -c git://github.com/GoogleContainerTools/kaniko]": exit status 1 Enumerating objects: 17206, done.
        Total 17206 (delta 0), reused 0 (delta 0), pack-reused 17206
        Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile

@tejal29 tejal29 added cla: yes CLA signed by all commit authors and removed cla: no CLA not signed by all commit authors labels Feb 19, 2020
@googlebot
Copy link
Copy Markdown

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@tejal29 tejal29 merged commit ca728a4 into GoogleContainerTools:master Feb 19, 2020
@greut greut deleted the registry-mirror branch February 19, 2020 20:01
@darewreck54
Copy link
Copy Markdown

darewreck54 commented Oct 30, 2020

@greut Is it possible to support multiple registry-mirrors. If one fails, then it would use another one or the default. This is useful for use cases such as docker hub limitation with API calls. We could leverage off google mirror cache and if it doesn't have it go to docker hub to pull it into the cache.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

candidate-release cla: yes CLA signed by all commit authors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

does kaniko support docker registry mirrors ?

8 participants