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: add skippackaging option to helm target #1641

Merged
merged 2 commits into from
Sep 30, 2023

Conversation

aroberts87
Copy link
Contributor

On Helm chart updates, provide the option to skip the packaging phase of the update. This provides the end user with two main benefits:

  1. Users will be able to leverage updatecli to update the metadata on their chart(s) while leveraging other mechanisms to handle the actual packaging and publishing, such as the chart-releaser-action action.
  2. When using the helmchart target with an scmid defined, the compressed binary files for the chart dependencies will not be committed into the repository.

Test

Note: I spent some time looking in the existing tests, but didn't see an obvious way to test if files had been created on disk within the current paradigm. I'm open to suggestions or thoughts about how to handle this though. What I can offer however, are the tests I ran locally to validate both the new functionality and existing (default) behavior.

Steps

  1. Create a test Helm chart
  2. Update Chart.yaml to include at least one dependency, ensuring the version picked is outdated
  3. Adjust the config.yaml target spec to use skippackaging: true or skippackaging: false based on desired test
  4. Run updatecli --config config.yaml apply
Skip Packaging Test

Create a test Helm chart

?> helm create test-chart
?> cd test-chart
?> ls
charts  Chart.yaml  config.yaml  templates  values.yaml
?> ls charts/
?>

Chart.yaml before running updatecli

apiVersion: v2
name: test-chart
description: A Helm chart for Kubernetes
type: application
version: 0.5.0
appVersion: "1.16.0"
dependencies:
  - name: prometheus
    repository: https://prometheus-community.github.io/helm-charts
    version: 22.0.0

config.yaml

name: test

sources:
  getProm:
    name: "get prometheus chart version"
    kind: helmchart
    spec:
      url: https://prometheus-community.github.io/helm-charts
      name: prometheus

targets:
  prom:
    name: "bump prom"
    sourceid: getProm
    kind: helmchart
    spec:
      file: "Chart.yaml"
      key: "$.dependencies[0].version"
      name: "."
      skippackaging: true
      versionincrement: auto

Chart.yaml after running updatecli

apiVersion: v2
name: main
description: A Helm chart for Kubernetes
type: application
version: 1.0.0
appVersion: "1.16.0"
dependencies:
  - name: prometheus
    repository: https://prometheus-community.github.io/helm-charts
    version: 25.0.0

Chart state after running updatecli

  ?> ls
  charts  Chart.yaml  config.yaml  templates  values.yaml
  ?> ls charts/
  ?>
Don't Skip Packaging Test

Create a test Helm chart

?> helm create test-chart
?> cd test-chart
?> ls
charts  Chart.yaml  config.yaml  templates  values.yaml
?> ls charts/
?>

Chart.yaml before running updatecli

apiVersion: v2
name: test-chart
description: A Helm chart for Kubernetes
type: application
version: 0.5.0
appVersion: "1.16.0"
dependencies:
  - name: prometheus
    repository: https://prometheus-community.github.io/helm-charts
    version: 22.0.0

config.yaml

name: test

sources:
  getProm:
    name: "get prometheus chart version"
    kind: helmchart
    spec:
      url: https://prometheus-community.github.io/helm-charts
      name: prometheus

targets:
  prom:
    name: "bump prom"
    sourceid: getProm
    kind: helmchart
    spec:
      file: "Chart.yaml"
      key: "$.dependencies[0].version"
      name: "."
      versionincrement: auto

Chart.yaml after running updatecli

apiVersion: v2
name: main
description: A Helm chart for Kubernetes
type: application
version: 1.0.0
appVersion: "1.16.0"
dependencies:
  - name: prometheus
    repository: https://prometheus-community.github.io/helm-charts
    version: 25.0.0

Chart state after running updatecli

  ?> ls
Chart.lock  charts  Chart.yaml  config.yaml  templates  values.yaml
  ?> ls charts/
  ls charts/
prometheus-25.0.0.tgz

Additional Information

Tradeoff

  • N/A

Potential improvement

  • Still bundle/package the chart dependencies, but do not commit them to the repository. Users would then only need to publish the new chart instead of package+publish.

On Helm chart updates, provide the option to skip the packaging
of the updated chart. This will enable users to utilize `updatecli`
to do the desired version adjustments on the chart(s) while utilizing
other mechanisms to handle the actual packaging and publishing.
@aroberts87
Copy link
Contributor Author

@olblak - Would you mind giving me some guidance on the Check Spelling failure? It looks like the action failed to download some dictionaries, but I'm not sure if I did something (or didn't do something) to cause that failure. Thanks!
https://github.com/updatecli/updatecli/actions/runs/6357208974/attempts/1#summary-17268028523

Copy link
Member

@olblak olblak left a comment

Choose a reason for hiding this comment

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

Thanks for the pullrequest, the usecase makes sense to me

@olblak olblak added enhancement New feature or request resource-helm labels Sep 30, 2023
@olblak
Copy link
Member

olblak commented Sep 30, 2023

@olblak - Would you mind giving me some guidance on the Check Spelling failure? It looks like the action failed to download some dictionaries, but I'm not sure if I did something (or didn't do something) to cause that failure. Thanks! https://github.com/updatecli/updatecli/actions/runs/6357208974/attempts/1#summary-17268028523

Yesterday, I update check-spelling a bit too quickly to the latest version but it turns out, their are breaking changes that I need to handle.
I am reverting that upgrade for now

@olblak olblak merged commit 3e0c1ef into updatecli:main Sep 30, 2023
6 checks passed
@aroberts87 aroberts87 deleted the feat/helm-skip-packaging branch October 2, 2023 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resource-helm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants