Skip to content

Add support for other GitHub user packages - not just self-owned#19

Open
hedrickbt wants to merge 4 commits intowilldurand:mainfrom
hedrickbt:main
Open

Add support for other GitHub user packages - not just self-owned#19
hedrickbt wants to merge 4 commits intowilldurand:mainfrom
hedrickbt:main

Conversation

@hedrickbt
Copy link
Copy Markdown

@hedrickbt hedrickbt commented Feb 17, 2024

You can supply a GITHUB_USERS environment variable that contains a comma delimited list of GitHub users.
Ex: export GITHUB_USERS="blakeblackshear,someotherusername"

By doing so not only will container registry proxy list the packages from your own GitHub account, but also the packages available in the other user accounts.

I have provided an updated Docker image for testing
hedrickbt/container-registry-proxy:main.bth
https://hub.docker.com/repository/docker/hedrickbt/container-registry-proxy/general

TESTS
Multiple users, but one is a duplicate
export GITHUB_USERS="blakeblackshear,blakeblackshear"
2024/02/17 18:06:52 starting container registry proxy on 127.0.0.1:10000
2024/02/17 18:06:57 Catalog Request GET -> /v2/_catalog
2024/02/17 18:06:57 GitHub Users ,blakeblackshear,blakeblackshear
2024/02/17 18:06:57 ListPackages for "" found 0 new packages
2024/02/17 18:06:57 ListPackages for "blakeblackshear" found 1 new packages
2024/02/17 18:06:58 ListPackages for "blakeblackshear" found 0 new packages

If you don't export GITHUB_USERS, it will only do the default, self, packages
unset GITHUB_USERS
2024/02/17 18:12:23 starting container registry proxy on 127.0.0.1:10000
2024/02/17 18:12:29 Catalog Request GET -> /v2/_catalog
2024/02/17 18:12:29 GitHub Users
2024/02/17 18:12:29 ListPackages for "" found 0 new packages

If at least 1 username does not get an error for the package list, , it will be returned to synology
export GITHUB_USERS="blakeblackshear2,blakeblackshear"
2024/02/17 18:18:04 starting container registry proxy on 127.0.0.1:10000
2024/02/17 18:18:20 Catalog Request GET -> /v2/_catalog
2024/02/17 18:18:20 GitHub Users ,blakeblackshear2,blakeblackshear
2024/02/17 18:18:20 ListPackages for "" found 0 new packages
2024/02/17 18:18:20 WARN ListPackages for "blakeblackshear2" error: GET https://api.github.com/users/blakeblackshear2/packages?package_type=container: 404 Not Found []
2024/02/17 18:18:21 ListPackages for "blakeblackshear" found 1 new packages

If every single username, including the default user "", fails a generic error will be shown by Synology. Ex invalid github token.
2024/02/17 18:21:27 starting container registry proxy on 127.0.0.1:10000
2024/02/17 18:21:33 Catalog Request GET -> /v2/_catalog
2024/02/17 18:21:33 GitHub Users ,blakeblackshear2,blakeblackshear2
2024/02/17 18:21:33 WARN ListPackages for "" error: GET https://api.github.com/user/packages?package_type=container: 401 Bad credentials []
2024/02/17 18:21:33 WARN ListPackages for "blakeblackshear2" error: GET https://api.github.com/users/blakeblackshear2/packages?package_type=container: 401 Bad credentials []
2024/02/17 18:21:34 WARN ListPackages for "blakeblackshear2" error: GET https://api.github.com/users/blakeblackshear2/packages?package_type=container: 401 Bad credentials []
2024/02/17 18:21:34 Not Found GET /v1/search?q=library/&n=50&page=1 -> https://ghcr.io

…you use a devcontainer since the binary built in the devcontainer is mounted back to the original filesystem.
…omma delimited list of GitHub username to pull packages for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant