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

fix: Push to ghcr without duplicating chart name #174

Merged
merged 1 commit into from
Dec 20, 2022

Conversation

viccuad
Copy link
Member

@viccuad viccuad commented Dec 16, 2022

Description

helm push expects helm push <path_to_chart> <registry>, not <registry>/chart_name.

Fixes overly long URIs for charts in ghcr:
https://github.com/kubewarden/helm-charts/pkgs/container/charts%2Fkubewarden-controller%2Fkubewarden-controller

Test

Tested by running the shellscript locally.

expand
$ bash foo.sh
+ chart_directory=release-packages
+ '[' '!' -d release-packages ']'
+ REGISTRY=ghcr.io/viccuad/test-charts
++ find release-packages -maxdepth 1 -mindepth 1 -type f
+ charts='release-packages/kubewarden-defaults-1.2.8.tgz
release-packages/kubewarden-crds-1.2.3.tgz
release-packages/kubewarden-controller-1.2.8.tgz'
+ for chart in $charts
++ helm show chart release-packages/kubewarden-defaults-1.2.8.tgz
++ yq .name
++ sed 's/"//g'
+ chart_name=kubewarden-defaults
++ helm show chart release-packages/kubewarden-defaults-1.2.8.tgz
++ yq .version
++ sed 's/"//g'
+ chart_version=1.2.8
+ package_file=release-packages/kubewarden-defaults-1.2.8.tgz
++ helm push release-packages/kubewarden-defaults-1.2.8.tgz oci://ghcr.io/viccuad/test-charts/charts
+ push_output='Pushed: ghcr.io/viccuad/test-charts/charts/kubewarden-defaults:1.2.8
Digest: sha256:ebb6d5bbe3ad23121546eefd2470421b30fb7c553eb064d066fa276cce822cea'
++ echo Pushed: ghcr.io/viccuad/test-charts/charts/kubewarden-defaults:1.2.8 Digest: sha256:ebb6d5bbe3ad23121546eefd2470421b30fb7c553eb064d066fa276cce822cea
++ sed -n 's/Pushed: \(.*\):.* Digest: \(.*\)$/\1\@\2/p'
+ chart_url=ghcr.io/viccuad/test-charts/charts/kubewarden-defaults@sha256:ebb6d5bbe3ad23121546eefd2470421b30fb7c553eb064d066fa276cce822cea
+ for chart in $charts
++ yq .name
++ helm show chart release-packages/kubewarden-crds-1.2.3.tgz
++ sed 's/"//g'
+ chart_name=kubewarden-crds
++ helm show chart release-packages/kubewarden-crds-1.2.3.tgz
++ yq .version
++ sed 's/"//g'
+ chart_version=1.2.3
+ package_file=release-packages/kubewarden-crds-1.2.3.tgz
++ helm push release-packages/kubewarden-crds-1.2.3.tgz oci://ghcr.io/viccuad/test-charts/charts
+ push_output='Pushed: ghcr.io/viccuad/test-charts/charts/kubewarden-crds:1.2.3
Digest: sha256:e885f550a9084f87d588035dbe5c62f4cb7106b1c7adaecd65045806972f0777'
++ echo Pushed: ghcr.io/viccuad/test-charts/charts/kubewarden-crds:1.2.3 Digest: sha256:e885f550a9084f87d588035dbe5c62f4cb7106b1c7adaecd65045806972f0777
++ sed -n 's/Pushed: \(.*\):.* Digest: \(.*\)$/\1\@\2/p'
+ chart_url=ghcr.io/viccuad/test-charts/charts/kubewarden-crds@sha256:e885f550a9084f87d588035dbe5c62f4cb7106b1c7adaecd65045806972f0777
+ for chart in $charts
++ helm show chart release-packages/kubewarden-controller-1.2.8.tgz
++ yq .name
++ sed 's/"//g'
+ chart_name=kubewarden-controller
++ helm show chart release-packages/kubewarden-controller-1.2.8.tgz
++ yq .version
++ sed 's/"//g'
+ chart_version=1.2.8
+ package_file=release-packages/kubewarden-controller-1.2.8.tgz
++ helm push release-packages/kubewarden-controller-1.2.8.tgz oci://ghcr.io/viccuad/test-charts/charts
+ push_output='Pushed: ghcr.io/viccuad/test-charts/charts/kubewarden-controller:1.2.8
Digest: sha256:03178179195d2514bf6c1165be542f517b4aa4dc50d93f93e5688068d9bb45a1'
++ echo Pushed: ghcr.io/viccuad/test-charts/charts/kubewarden-controller:1.2.8 Digest: sha256:03178179195d2514bf6c1165be542f517b4aa4dc50d93f93e5688068d9bb45a1
++ sed -n 's/Pushed: \(.*\):.* Digest: \(.*\)$/\1\@\2/p'
+ chart_url=ghcr.io/viccuad/test-charts/charts/kubewarden-controller@sha256:03178179195d2514bf6c1165be542f517b4aa4dc50d93f93e5688068d9bb45a1

Example: https://ghcr.io/viccuad/test-charts/charts/kubewarden-controller

Additional Information

Tradeoff

Potential improvement

helm push expects `helm push <path_to_chart> <registry>`, not
`<registry>/chart_name`.

Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
@viccuad viccuad requested a review from a team as a code owner December 16, 2022 15:46
@viccuad
Copy link
Member Author

viccuad commented Dec 16, 2022

TODO: once this is merged and new charts have been published, delete the old duplicated charts in ghcr.io.
See https://github.com/orgs/kubewarden/packages?tab=packages&q=charts.

@viccuad viccuad self-assigned this Dec 16, 2022
@viccuad viccuad changed the title fix: Push to ghcr without duplicating chart name fix!: Push to ghcr without duplicating chart name Dec 16, 2022
@viccuad viccuad changed the title fix!: Push to ghcr without duplicating chart name fix: Push to ghcr without duplicating chart name Dec 16, 2022
@flavio flavio merged commit d177461 into kubewarden:main Dec 20, 2022
@flavio
Copy link
Member

flavio commented Dec 20, 2022

TODO: once this is merged and new charts have been published, delete the old duplicated charts in ghcr.io. See https://github.com/orgs/kubewarden/packages?tab=packages&q=charts.

I've created #175 to keep track of that

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.

3 participants