Skip to content

Allow overriding version/appversion on when oci registry is enabled#29

Open
tuxillo wants to merge 1 commit intobsord:masterfrom
tuxillo:fix-override-versions
Open

Allow overriding version/appversion on when oci registry is enabled#29
tuxillo wants to merge 1 commit intobsord:masterfrom
tuxillo:fix-override-versions

Conversation

@tuxillo
Copy link

@tuxillo tuxillo commented Mar 21, 2023

When enabling the OCI registry, it is not possible to override Helm chart's version and appversion. With this change it is made possible.

fi

if [ "$UPDATE_DEPENDENCIES" == "1" ] || [ "$UPDATE_DEPENDENCIES" == "True" ] || [ "$UPDATE_DEPENDENCIES" == "TRUE" ] || [ "$UPDATE_DEPENDENCIES" == "true" ]; then
if [ "$UPDATE_DEPENDENCIES" == "1" ] || [[ "$UPDATE_DEPENDENCIES" == [Tt][Rr][Uu][Ee] ]]; then

Choose a reason for hiding this comment

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

Very nice.

@almereyda
Copy link

With this change it is made possible.

Can this statement be validated with a test, or with an exemplary run in a public repository?

@tuxillo
Copy link
Author

tuxillo commented Mar 30, 2023

With this change it is made possible.

Can this statement be validated with a test, or with an exemplary run in a public repository?

I don't have any exemplary run in public repos, only in private ones. We could add some test for this, I guess, what do you suggest?

@almereyda
Copy link

I'm not yet a user of helm-push, and have no environment set up right now. Unfortunately the GitHub Actions documentation also doesn't mention examples on how to test a GitHub action sufficiently. The only reference I could find was:

But in the important sections it also says "Details to be added".

Maybe a screenshot will be enough to show that this works as intended, without causing any unintended side-effects?

Or it may be possible to run helm-push through a shim like https://github.com/nektos/act, and validate it in such an environment, locally?

@josemartins88
Copy link

🥇

@tuxillo
Copy link
Author

tuxillo commented Mar 30, 2023

Very nice recommendation @almereyda, thanks!

Given this workflow:

# Run when there are changes to a PR that is ready to review
name: pr

on:
  pull_request:
    types: [opened]
    branches: ["main"]

jobs:
  do_pr:
    runs-on: [ubuntu-latest]
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Push Helm with BSORD
        uses: bsord/helm-push@master
        with:
          useOCIRegistry: true
          registry-url: oci://ghcr.io/tuxillo/helm-push
          username: tuxillo
          access-token: ${{ secrets.GITHUB_TOKEN }}
          force: true
          version: 1.2.3
          appVersion: 1.2.3
          chart-folder: charts/test-chart
      - name: Push Helm with TUXILLO
        uses: tuxillo/helm-push@fix-override-versions
        with:
          useOCIRegistry: true
          registry-url: oci://ghcr.io/tuxillo/helm-push
          username: tuxillo
          access-token: ${{ secrets.GITHUB_TOKEN }}
          force: true
          version: 1.2.3
          appVersion: 1.2.3
          chart-folder: charts/test-chart

I get the following output:

[pr/do_pr] 🚀  Start image=catthehacker/ubuntu:act-latest
[pr/do_pr]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform=linux/amd64 username= forcePull=true
[pr/do_pr]   🐳  docker create image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[pr/do_pr]   🐳  docker run image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[pr/do_pr]   ☁  git clone 'https://github.com/bsord/helm-push' # ref=master
[pr/do_pr]   ☁  git clone 'https://github.com/tuxillo/helm-push' # ref=fix-override-versions
[pr/do_pr] ⭐ Run Main Checkout code
[pr/do_pr]   🐳  docker cp src=/Users/antonioh/temp/helm/. dst=/Users/antonioh/temp/helm
[pr/do_pr]   ✅  Success - Main Checkout code
[pr/do_pr] ⭐ Run Main Push Helm with BSORD
[pr/do_pr]   🐳  docker build -t act-bsord-helm-push-master-dockeraction:latest --platform linux/amd64 /Users/antonioh/.cache/act/bsord-helm-push@master/
[pr/do_pr]   🐳  docker pull image=act-bsord-helm-push-master-dockeraction:latest platform=linux/amd64 username= forcePull=false
[pr/do_pr]   🐳  docker create image=act-bsord-helm-push-master-dockeraction:latest platform=linux/amd64 entrypoint=[] cmd=[]
[pr/do_pr]   🐳  docker run image=act-bsord-helm-push-master-dockeraction:latest platform=linux/amd64 entrypoint=[] cmd=[]
| OCI SPECIFIED, USING HELM OCI FEATURES
| Login Succeeded
| Packaging chart 'charts/test-chart'
| Successfully packaged chart and saved it to: /Users/antonioh/temp/helm/test-chart-0.1.0.tgz
| Pushing chart test-chart-0.1.0.tgz to 'oci://ghcr.io/tuxillo/helm-push'
| Pushed: ghcr.io/tuxillo/helm-push/test-chart:0.1.0
| Digest: sha256:14b5bccc0e0ea70985c1ee391a0f751e0107e5bdcbd820cd5c058ed335af59be
| Successfully pushed chart test-chart-0.1.0.tgz to 'oci://ghcr.io/tuxillo/helm-push'
[pr/do_pr]   ✅  Success - Main Push Helm with BSORD
[pr/do_pr] ⭐ Run Main Push Helm with TUXILLO
[pr/do_pr]   🐳  docker build -t act-tuxillo-helm-push-fix-override-versions-dockeraction:latest --platform linux/amd64 /Users/antonioh/.cache/act/tuxillo-helm-push@fix-override-versions/
[pr/do_pr]   🐳  docker pull image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform=linux/amd64 username= forcePull=false
[pr/do_pr]   🐳  docker create image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform=linux/amd64 entrypoint=[] cmd=[]
[pr/do_pr]   🐳  docker run image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform=linux/amd64 entrypoint=[] cmd=[]
| Version is defined, using as parameter.
| App version is defined, using as parameter.
| OCI SPECIFIED, USING HELM OCI FEATURES
| Login Succeeded
| Packaging chart 'charts/test-chart'
| Successfully packaged chart and saved it to: /Users/antonioh/temp/helm/test-chart-1.2.3.tgz
| Pushing chart test-chart-1.2.3.tgz to 'oci://ghcr.io/tuxillo/helm-push'
| Pushed: ghcr.io/tuxillo/helm-push/test-chart:1.2.3
| Digest: sha256:84869c128f633c3df84d3faaa81977330cc74633af759c235316a578880e6a96
| Successfully pushed chart test-chart-1.2.3.tgz to 'oci://ghcr.io/tuxillo/helm-push'
[pr/do_pr]   ✅  Success - Main Push Helm with TUXILLO
[pr/do_pr] 🏁  Job succeeded

@almereyda
Copy link

almereyda commented Mar 31, 2023

What happens when you don't specify version and/or appVersion?

Would you like to add that case, too?

Let's just make sure this doesn't break existing user's workflows.

@tuxillo
Copy link
Author

tuxillo commented Apr 3, 2023

Workflow:

# Run when there are changes to a PR that is ready to review
name: pr

on:
  pull_request:
    types: [opened]
    branches: ["main"]

jobs:
  do_pr:
    runs-on: [ubuntu-latest]
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Push Helm with BSORD
        uses: bsord/helm-push@master
        with:
          useOCIRegistry: true
          registry-url: oci://ghcr.io/tuxillo/helm-push
          username: tuxillo
          access-token: ${{ secrets.GITHUB_TOKEN }}
          force: true
          version: 1.2.3
          appVersion: 1.2.3
          chart-folder: charts/test-chart
      - name: Push Helm with TUXILLO
        uses: tuxillo/helm-push@fix-override-versions
        with:
          useOCIRegistry: true
          registry-url: oci://ghcr.io/tuxillo/helm-push
          username: tuxillo
          access-token: ${{ secrets.GITHUB_TOKEN }}
          force: true
          version: 1.2.3
          appVersion: 1.2.3
          chart-folder: charts/test-chart
      - name: Push Helm with TUXILLO no versions
        uses: tuxillo/helm-push@fix-override-versions
        with:
          useOCIRegistry: true
          registry-url: oci://ghcr.io/tuxillo/helm-push
          username: tuxillo
          access-token: ${{ secrets.GITHUB_TOKEN }}
          force: true
          chart-folder: charts/test-chart

Result:

WARN  ⚠ You are using Apple M1 chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[pr/do_pr] 🚀  Start image=catthehacker/ubuntu:act-latest
[pr/do_pr]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[pr/do_pr]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[pr/do_pr]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[pr/do_pr]   ☁  git clone 'https://github.com/bsord/helm-push' # ref=master
[pr/do_pr]   ☁  git clone 'https://github.com/tuxillo/helm-push' # ref=fix-override-versions
[pr/do_pr]   ☁  git clone 'https://github.com/tuxillo/helm-push' # ref=fix-override-versions
[pr/do_pr] ⭐ Run Main Checkout code
[pr/do_pr]   🐳  docker cp src=/Users/antonioh/temp/helm/. dst=/Users/antonioh/temp/helm
[pr/do_pr]   ✅  Success - Main Checkout code
[pr/do_pr] ⭐ Run Main Push Helm with BSORD
[pr/do_pr]   🐳  docker build -t act-bsord-helm-push-master-dockeraction:latest /Users/antonioh/.cache/act/bsord-helm-push@master/
[pr/do_pr]   🐳  docker pull image=act-bsord-helm-push-master-dockeraction:latest platform= username= forcePull=false
[pr/do_pr]   🐳  docker create image=act-bsord-helm-push-master-dockeraction:latest platform= entrypoint=[] cmd=[]
[pr/do_pr]   🐳  docker run image=act-bsord-helm-push-master-dockeraction:latest platform= entrypoint=[] cmd=[]
| OCI SPECIFIED, USING HELM OCI FEATURES
| Login Succeeded
| Packaging chart 'charts/test-chart'
| Successfully packaged chart and saved it to: /Users/antonioh/temp/helm/test-chart-0.1.0.tgz
| Pushing chart test-chart-0.1.0.tgz to 'oci://ghcr.io/tuxillo/helm-push'
| Pushed: ghcr.io/tuxillo/helm-push/test-chart:0.1.0
| Digest: sha256:29dc0a769fdb8f03d59567a5dc3e50b0fa5cc64174a53b5a2143ca2d68348bbe
| Successfully pushed chart test-chart-0.1.0.tgz to 'oci://ghcr.io/tuxillo/helm-push'
[pr/do_pr]   ✅  Success - Main Push Helm with BSORD
[pr/do_pr] ⭐ Run Main Push Helm with TUXILLO
[pr/do_pr]   🐳  docker build -t act-tuxillo-helm-push-fix-override-versions-dockeraction:latest /Users/antonioh/.cache/act/tuxillo-helm-push@fix-override-versions/
[pr/do_pr]   🐳  docker pull image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform= username= forcePull=false
[pr/do_pr]   🐳  docker create image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform= entrypoint=[] cmd=[]
[pr/do_pr]   🐳  docker run image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform= entrypoint=[] cmd=[]
| Version is defined, using as parameter.
| App version is defined, using as parameter.
| OCI SPECIFIED, USING HELM OCI FEATURES
| Login Succeeded
| Packaging chart 'charts/test-chart'
| Successfully packaged chart and saved it to: /Users/antonioh/temp/helm/test-chart-1.2.3.tgz
| Pushing chart test-chart-1.2.3.tgz to 'oci://ghcr.io/tuxillo/helm-push'
| Pushed: ghcr.io/tuxillo/helm-push/test-chart:1.2.3
| Digest: sha256:2c781d449f42a7a910a6eec0fd866f2e16dee16e8cdb45a87e92a2f058e3d514
| Successfully pushed chart test-chart-1.2.3.tgz to 'oci://ghcr.io/tuxillo/helm-push'
[pr/do_pr]   ✅  Success - Main Push Helm with TUXILLO
[pr/do_pr] ⭐ Run Main Push Helm with TUXILLO no versions
[pr/do_pr]   🐳  docker build -t act-tuxillo-helm-push-fix-override-versions-dockeraction:latest /Users/antonioh/.cache/act/tuxillo-helm-push@fix-override-versions/
[pr/do_pr]   🐳  docker pull image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform= username= forcePull=false
[pr/do_pr]   🐳  docker create image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform= entrypoint=[] cmd=[]
[pr/do_pr]   🐳  docker run image=act-tuxillo-helm-push-fix-override-versions-dockeraction:latest platform= entrypoint=[] cmd=[]
| OCI SPECIFIED, USING HELM OCI FEATURES
| Login Succeeded
| Packaging chart 'charts/test-chart'
| Successfully packaged chart and saved it to: /Users/antonioh/temp/helm/test-chart-0.1.0.tgz
| Pushing chart test-chart-0.1.0.tgz to 'oci://ghcr.io/tuxillo/helm-push'
| Pushed: ghcr.io/tuxillo/helm-push/test-chart:0.1.0
| Digest: sha256:88dc7599edda61365d7cedbb20ab8e7996be6db7fc6590b8558b920c19a2ea17
| Successfully pushed chart test-chart-0.1.0.tgz to 'oci://ghcr.io/tuxillo/helm-push'
[pr/do_pr]   ✅  Success - Main Push Helm with TUXILLO no versions

@tuxillo
Copy link
Author

tuxillo commented Apr 18, 2023

Anything else required?

@tuxillo
Copy link
Author

tuxillo commented Jul 8, 2023

Can we have this integrated? 😃

@tuxillo
Copy link
Author

tuxillo commented Sep 16, 2023

Any chance this can be merged?

@bscholtes1A
Copy link

bscholtes1A commented Sep 30, 2023

@bsord Could someone please take care of merging this PR?

@bsord
Copy link
Owner

bsord commented Oct 1, 2023 via email

@fredleger
Copy link
Contributor

@bsord happy to help you reviewing PRs if you still want maintainers

@tuxillo
Copy link
Author

tuxillo commented Feb 1, 2024

folks, any news?

@tuxillo
Copy link
Author

tuxillo commented Feb 6, 2025

whatever happened to this one 😄

@josemartins88
Copy link

Please, let's get this merged !

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.

6 participants