Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root: add --registry-mirror flag #836

Merged
merged 25 commits into from
Feb 19, 2020

Conversation

greut
Copy link
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.

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

greut commented Oct 25, 2019

Who could give me hand for the integration tests?

@tejal29
Copy link
Member

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
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@tandeday
Copy link

tandeday commented Dec 5, 2019

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

@cvgw
Copy link
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
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>
@@ -183,7 +184,6 @@ func TestRun(t *testing.T) {

func TestGitBuildcontext(t *testing.T) {
repo := "github.com/GoogleContainerTools/kaniko"
dockerfile := "integration/dockerfiles/Dockerfile_test_run_2"
Copy link
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
Member

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
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Copy link
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
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

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

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 join this conversation on GitHub. Already have an account? Sign in to comment
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