-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
[ci.jenkins.io] Set up an ECR pull through cache #4321
Comments
First step: let's create the ECR pull through cache registry. A good source of knowledge to get started is the EKS Blueprint ECR Pattern with its Terraform source code in https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/main/patterns/ecr-pull-through-cache It requires to provide a couple username/token as input parameter to Terraform's project (through the pipeline) and we'll start by creating the ECR before trying to access it in the private subnets (in agent VMs). |
…hrough cache in Terraform AWS (#6200) Ref. jenkins-infra/helpdesk#4321 Blocks jenkins-infra/terraform-aws-sponsorship#122
Update: we now have an ECR cache with pull through rules. Next step: we need to set up access from EC2 agents |
Damn, the ECR only works with.. custom image names. It's not transparent 🤦 : https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache-working-pulling.html#:~:text=Quay-,Docker%20Hub,-GitHub%20Container%20Registry
=> We could use it for the EKS cluster (for faster pulls) but it makes no sense for the ci.jenkins.io VM agents (ATH, Docker builds, etc.) as it would force users to have a different image name between CI and other environments (dev., CD, etc.). I guess we have to run a registry in mirror mode instead: https://docs.docker.com/docker-hub/image-library/mirror/ or any other alternative |
It definitely doesn't work with |
Test in progress (had the same thought process and want to know if it works because it would be really useful) |
So it does not work as ECR requires authentication, which does not work for registry mirrors:
|
Ah damn, I guess needs a proxy in front |
Yup, but given the additional setup, worth hosting a Docker Registry in the EKS cluster in Mirror mode and expose it with the same method as ACP to agents in private agents. Just ran a quick test with https://github.com/twuni/docker-registry.helm/tree/main and it works nice and easy. |
Update: the issue body has been updated to explain the choice of Docker registry. (edit) The chart https://github.com/twuni/docker-registry.helm does not work well with a PVC disk of type Task list:
|
#6201) Ref. jenkins-infra/helpdesk#4321 (comment) Requires jenkins-infra/charts-secrets@689f2c7 Tested once manually.
Based on jenkins-infra/docker-registry chart Ref. jenkins-infra/helpdesk#4321 Tested locally Requires the security groups to be set up (both 8080 and 5000 ports may be used): jenkins-infra/terraform-aws-sponsorship@6fe51ca
…olume permissions on init (#6224) Ref. jenkins-infra/helpdesk#4321 Fixup of #6222 When testing the new registry mirror, we ended with errors HTTP/500 responded to Docker Engine when trying to get images with the following log on Registry side: ``` time="2025-02-13T09:53:00.527942139Z" level=error msg="response completed with error" err.code=unknown err.detail="filesystem: mkdir /var/lib/registry/docker: permission denied" err.message="unknown error" go.version=go1.20.8 http.request.host="k8s-hubmirro-hubmirro-f5b8613a86-574b882e7a7e93d0.elb.us-east-2.amazonaws.com:5000" http.request.id=a88445fd-0208-4477-b353-84a5b7910e21 http.request.method=HEAD http.request.remoteaddr="10.0.131.247:29797" http.request.uri="/v2/library/busybox/manifests/latest" http.request.useragent="docker/27.5.1 go/go1.22.11 git-commit/4c9b3b0 kernel/6.8.0-1021-aws os/linux arch/amd64 UpstreamClient(Docker-Client/27.5.1 \(linux\))" http.response.contenttype="application/json; charset=utf-8" http.response.duration=321.168629ms http.response.status=500 http.response.written=164 vars.name="library/busybox" vars.reference=latest ``` This PR uses an init container, like ACP is doing, to fix permission on startup. This is consider a ugly hack as the "init container" should be a feature of the `jenkins-infra/docker-registry` Helm Chart (to manage the UID, mount path, etc. as part of the templating)
Update:
|
During the last summer, we had to setup a Docker "Pull Through" caching registry in Azure to avoid builds breaking due to HTTP/429 rate limit from DockerHub: #4192 (comment)
(edit) we changed the plan from "using ECR (see below)" to a "using self-hosted" Docker registry in [mirror mode]. Mainly because ECR does not allow transparent proxying and we don't want having to change all Docker images name in all ATH/plugins tests + Jenkins Docker images.
Plan with a self hosted Docker registry, following the Official Docker Mirror documentation:
nlb-ip
internal AWS LB (same as ACP).We can use this on the Jenkins and Jenkins BOM node pools for faster autoscaling
Let's get started with the Helm chart https://github.com/twuni/docker-registry.helm: audited it and it looks fine for a beginning
filesystem
driver is recommended in https://distribution.github.io/distribution/recipes/mirror/#what-about-my-disk for this use case (e.g. proxy mirror).Nice to have (but not mandatory) in the future:
(old plan with ECR)
Same can be done on AWS with ECR: https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache.html
Moving ci.jenkins.io to AWS needs the same kind setup:
The text was updated successfully, but these errors were encountered: