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

feat: Support GitLab Container Registry #2348

Conversation

jopemachine
Copy link
Member

@jopemachine jopemachine commented Jun 28, 2024

Partially fix #2337.

Test

Manually tested it using the following methods.

In this PR, the cr.backend.ai/stable/python:3.9-ubuntu20.04 image is used as a placeholder for testing.

Prerequisite

Note: The example given refers to GitLab Hosted Registry, but it also works in an on-premises environment.

  1. Tag and push the cr.backend.ai/stable/python image to your GitLab package for testing.
❯ docker tag cr.backend.ai/stable/python:3.9-ubuntu20.04 registry.gitlab.com/<gitlab_username>/python:3.9-ubuntu20.04
❯ docker push registry.gitlab.com/<gitlab_username>/python:3.9-ubuntu20.04
  1. Enter the following command for putting the necessary key-values in etcd.
❯ ./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com "https://registry.gitlab.com"; \
./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/type "gitlab"; \
./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/gitlab_url "https://gitlab.com"; \
./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/project "<gitlab_username>"; \
./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/gitlab_project "<project_name>"; \
./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/username "<gitlab_username>"; \
./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/password "<gitlab_PAT>"
  1. Insert the following value into the container_registry column of the groups table.
{
	"registry": "registry.gitlab.com",
	"project": "<gitlab_username>"
}
  1. Add registry.gitlab.com value to allowed_docker_registries column of domains table using below command
❯ ./backend.ai admin domain update default --allowed-docker-registries=registry.gitlab.com

Test scenarios

Verify that the container registry added in this PR is functioning based on several scenarios.

If there are additional scenarios that need testing, please leave a comment.

1. Image Rescan

Image rescanning should work through the following command.

❯ ./backend.ai mgr image rescan registry.gitlab.com

2. Create a session from the pulled image

Run a session using the downloaded image.

❯ ./backend.ai session create registry.gitlab.com/<gitlab_username>/python:3.9-ubuntu20.04

3. Commit the changes and push it to the container registry.

For committing a session, it is necessary to assume that the your "GitLab ID" is included in config/docker/registry/registry.gitlab.com in etcd.

Enter the key value using the following command.

❯ ./backend.ai mgr etcd put config/docker/registry/registry.gitlab.com/project "<gitlab_username>"

Commit the changes using the convert-to-image command and push them to the container registry.

❯ ./backend.ai session convert-to-image <session_id> test_imgname

∙ Request to commit Session(name or id: ce592e27-b90a-4859-92b1-360fdd6d8464)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:01<00:00,  2.02it/s]
✓ Session export process completed.

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue

Copy link

graphite-app bot commented Jun 28, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Member Author

jopemachine commented Jun 28, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jopemachine and the rest of your teammates on Graphite Graphite

@github-actions github-actions bot added comp:manager Related to Manager component size:M 30~100 LoC labels Jun 28, 2024
@jopemachine jopemachine changed the title Support GitLab Container Registry feat: Support GitLab Container Registry Jun 28, 2024
@jopemachine jopemachine linked an issue Jun 28, 2024 that may be closed by this pull request
@github-actions github-actions bot added the type:feature Add new features label Jun 28, 2024
@github-actions github-actions bot added this to the 24.03 milestone Jun 28, 2024
@jopemachine jopemachine force-pushed the topic/06-26-feat_support_github_container_registry branch from 9b1a455 to 0515970 Compare July 15, 2024 07:35
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from 0291e41 to 443cb4b Compare July 15, 2024 07:35
@jopemachine jopemachine marked this pull request as ready for review July 15, 2024 08:27
@jopemachine jopemachine force-pushed the topic/06-26-feat_support_github_container_registry branch from 0515970 to f760569 Compare July 24, 2024 08:00
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from fdf7a62 to 5942be0 Compare July 24, 2024 08:01
@jopemachine jopemachine force-pushed the topic/06-26-feat_support_github_container_registry branch from f760569 to a9cb945 Compare July 25, 2024 08:21
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from 5942be0 to e25bf17 Compare July 25, 2024 08:21
@jopemachine jopemachine force-pushed the topic/06-26-feat_support_github_container_registry branch from a9cb945 to aa11f50 Compare July 26, 2024 03:08
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from e25bf17 to a5dadb1 Compare July 26, 2024 03:08
@kyujin-cho kyujin-cho force-pushed the topic/06-26-feat_support_github_container_registry branch from aa11f50 to a54cdc2 Compare August 1, 2024 01:39
@kyujin-cho kyujin-cho force-pushed the topic/06-28-support_gitlab_container_registry branch 2 times, most recently from 8994110 to 79604b6 Compare August 1, 2024 03:07
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from 79604b6 to 0fc60a8 Compare August 1, 2024 04:55
@kyujin-cho kyujin-cho force-pushed the topic/06-28-support_gitlab_container_registry branch 2 times, most recently from f254106 to 5b5e659 Compare August 1, 2024 05:41
Copy link
Member

@kyujin-cho kyujin-cho left a comment

Choose a reason for hiding this comment

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

What is the meaning of project directive on Gitlab registry etcd config? By the description it looks pretty similar with username config.

@jopemachine jopemachine force-pushed the topic/06-26-feat_support_github_container_registry branch from 52810f8 to f1a4645 Compare August 1, 2024 06:43
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from 5b5e659 to 643e57e Compare August 1, 2024 06:43
@jopemachine jopemachine force-pushed the topic/06-26-feat_support_github_container_registry branch from f1a4645 to 0a1729a Compare August 5, 2024 00:48
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from 643e57e to e88690a Compare August 5, 2024 00:49
@jopemachine jopemachine force-pushed the topic/06-28-support_gitlab_container_registry branch from bfcbdba to 9ec3ff9 Compare August 5, 2024 00:57
@jopemachine
Copy link
Member Author

Closed as #1917 stack was merged.

@jopemachine jopemachine closed this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:manager Related to Manager component size:M 30~100 LoC type:feature Add new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for GitLab, GitHub and AWS ECR container registry
2 participants