diff options
| author | jannfis <jann@mistrust.net> | 2020-09-25 17:45:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-25 17:45:00 +0200 |
| commit | d422020368c9e5ff5a9d823778a672120c7443bf (patch) | |
| tree | ddeb9a586e53c55fe1543081a168a00835f022bc | |
| parent | c9142d4d8a493316700ee682a80c8ef9bef1e053 (diff) | |
feat: Support for GitHub Container Registry (ghcr.io) (#96)
* feat: Support for GitHub Container Registry (ghcr.io)
* We now have 5 default registries instead of 4
* Add ghcr to allowed words for spelling
| -rw-r--r-- | .github/actions/spelling/allow.txt | 1 | ||||
| -rw-r--r-- | docs/configuration/registries.md | 21 | ||||
| -rw-r--r-- | pkg/registry/config_test.go | 2 | ||||
| -rw-r--r-- | pkg/registry/endpoints.go | 11 |
4 files changed, 26 insertions, 9 deletions
diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index a8ac238..587e4c4 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -60,6 +60,7 @@ func gcr Getenv gh +ghcr githash github goimports diff --git a/docs/configuration/registries.md b/docs/configuration/registries.md index e783355..70ebde9 100644 --- a/docs/configuration/registries.md +++ b/docs/configuration/registries.md @@ -4,9 +4,10 @@ Argo CD Image Updater comes with support for the following registries out of the box: * Docker Hub Registry -* Google Container Registry -* RedHat Quay Registry -* GitHub Docker Registry +* Google Container Registry (*gcr.io*) +* RedHat Quay Registry (*quay.io*) +* GitHub Docker Packages (*docker.pkg.github.com*) +* GitHub Container Registry (*ghcr.io*) Adding additional (and custom) container registries is supported by means of a configuration file. If you run Argo CD Image Updater within Kubernetes, you can @@ -36,10 +37,16 @@ registries: prefix: quay.io insecure: yes credentials: env:REGISTRY_SECRET +- name: GitHub Docker Packages + prefix: docker.pkg.github.com + api_url: https://docker.pkg.github.com + ping: no + tagsortmode: latest-first - name: GitHub Container Registry + prefix: ghcr.io api_url: https://docker.pkg.github.com ping: no - tagsortmode: latest_first + tagsortmode: latest-last ``` The above example defines access to three registries. The properties have the @@ -70,10 +77,10 @@ following semantics: `library/nginx:latest`. * `tagsortmode` (optional) defines whether and how the list of tags is sorted - chronologically by the registry. Valid values are `latest_first` (the last - pushed image will appear first in list), `latest_last` (the last pushed image + chronologically by the registry. Valid values are `latest-first` (the last + pushed image will appear first in list), `latest-last` (the last pushed image will appear last in list) or `none` (the default, list is not chronological - sorted). If `tagsortmode` is set to one of `latest_first` or `latest_last`, + sorted). If `tagsortmode` is set to one of `latest-first` or `latest-last`, Argo CD Image Updater will not request additional meta data from the registry if the `<image_alias>.sort-mode` is `latest` but will instead use the sorting from the tag list. diff --git a/pkg/registry/config_test.go b/pkg/registry/config_test.go index 29e6cfb..2d7ac26 100644 --- a/pkg/registry/config_test.go +++ b/pkg/registry/config_test.go @@ -77,7 +77,7 @@ func Test_LoadRegistryConfiguration(t *testing.T) { t.Run("Load from valid location", func(t *testing.T) { err := LoadRegistryConfiguration("../../config/example-config.yaml", false) require.NoError(t, err) - assert.Len(t, registries, 4) + assert.Len(t, registries, 5) reg, err := GetRegistryEndpoint("gcr.io") require.NoError(t, err) assert.Equal(t, "pullsecret:foo/bar", reg.Credentials) diff --git a/pkg/registry/endpoints.go b/pkg/registry/endpoints.go index e2e726b..9058ba2 100644 --- a/pkg/registry/endpoints.go +++ b/pkg/registry/endpoints.go @@ -84,7 +84,7 @@ var defaultRegistries map[string]*RegistryEndpoint = map[string]*RegistryEndpoin Cache: cache.NewMemCache(), }, "docker.pkg.github.com": { - RegistryName: "GitHub registry", + RegistryName: "GitHub packages", RegistryPrefix: "docker.pkg.github.com", RegistryAPI: "https://docker.pkg.github.com", Ping: false, @@ -92,6 +92,15 @@ var defaultRegistries map[string]*RegistryEndpoint = map[string]*RegistryEndpoin TagListSort: SortLatestFirst, Cache: cache.NewMemCache(), }, + "ghcr.io": { + RegistryName: "GitHub Container Registry", + RegistryPrefix: "ghcr.io", + RegistryAPI: "https://ghcr.io", + Ping: false, + Insecure: false, + TagListSort: SortLatestLast, + Cache: cache.NewMemCache(), + }, } var registries map[string]*RegistryEndpoint = make(map[string]*RegistryEndpoint) |
