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

Publish the Helm chart tarball with each release #3849

Merged
merged 10 commits into from
Mar 30, 2021
Merged

Publish the Helm chart tarball with each release #3849

merged 10 commits into from
Mar 30, 2021

Conversation

bgoareguer
Copy link
Contributor

Fixes #3778

Pre-requisites:

  • The gh-pages branch needs to be created by hand
  • Github Pages need to be activated for the django-DefectDojo repository with gh-pages as source branch and / (root) as the folder

The Helm chart tarball is published as a release asset.
The gh-pages branch is used to store the Helm repository index. Each version of the chart points to the asset added to the corresponding release.

The resulting Helm repository should be added with the following command (not sure about the capital letters):

helm repo add defectdojo https://defectdojo.github.io/django-defectdojo

@madchap
Copy link
Collaborator

madchap commented Feb 24, 2021

I took a look tonight, I'd rather we try to use the action I suggested in the other PR.

That being said, your PR would not be working either because you also need to add the other helm repos for the build to work at least.

Cheers and thanks for the feature idea :)

Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

Needs at least helm repo add.

@madchap
Copy link
Collaborator

madchap commented Feb 27, 2021

I think this is more flexible and can offer what we'd want, compared to my testing done through https://github.com/DefectDojo/django-DefectDojo/pull/3923/files

If you could please make the suggested changes, I could test it further.

Cheers!

@bgoareguer bgoareguer requested a review from madchap March 1, 2021 13:59
@madchap madchap closed this Mar 2, 2021
@madchap madchap reopened this Mar 2, 2021
Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

I would think the last easy change :) Cheers.

@madchap madchap mentioned this pull request Mar 2, 2021
@bgoareguer bgoareguer requested a review from madchap March 2, 2021 10:46
@bgoareguer bgoareguer requested a review from madchap March 2, 2021 12:28
Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

lgtm now, we'll see how it rolls and tune if needed :) Thank you!

@madchap madchap requested a review from alles-klar March 4, 2021 22:55
@alles-klar
Copy link
Contributor

Hi @bgoareguer,
a great Idea. I have two generell questions to your implementation:

We are already using the gh-pages branch to publish our defectdojo documentation. I am not sure if it is a good idea to use this branch for publishing helm charts too. Can we use any other branch or is it not a problem?

There is already a predefined github action for publishing helm charts: https://github.com/stefanprodan/helm-gh-pages. Is there a reason for maintaining our own action?

@bgoareguer
Copy link
Contributor Author

Hi @alles-klar,

I didn't know about https://github.com/stefanprodan/helm-gh-pages. I think it can be reused here.

Github seems to allow only a single Github Pages site per Github project, so it is not possible to publish the Helm chart to a different branch.
Another option would be to create a dedicated Github project to host the Helm chart. This would require to store (inside the django-defectdojo project settings) a Github token that can push code to the project hosting the Helm chart.
Here is an example: aquasecurity/trivy#888

@madchap
Copy link
Collaborator

madchap commented Mar 16, 2021

I didn't know about https://github.com/stefanprodan/helm-gh-pages. I think it can be reused here.

I didn't know either, good find @alles-klar

Github seems to allow only a single Github Pages site per Github project, so it is not possible to publish the Helm chart to a different branch.

With the above action, it seems you can. Per their README:

branch The branch to publish charts, defaults to gh-pages

@bgoareguer
Copy link
Contributor Author

With the above action, it seems you can. Per their README:

branch The branch to publish charts, defaults to gh-pages

Sorry if I was unclear. Yes, the above action lets you publish the chart to any branch, but the restriction is on Github side: you can only have a single Github Pages site per project. You already configured Github Pages to serve the DefectDojo documentation from the gh-pages branch, so no other branch will be served by Github Pages.

@bgoareguer
Copy link
Contributor Author

I think that hosting the Helm chart in a dedicated project would be the cleanest solution.
What do you think?

@madchap
Copy link
Collaborator

madchap commented Mar 21, 2021

I just did a test without gh-pages (after reading an article), seems to work.

Checked out a new branch in my fork, packaged the last from dev today

$ helm package helm/defectdojo
$ helm repo index .

committed and pushed the resulting tgz and index.yaml file.

$ helm repo add test-wo-ghpages 'https://raw.githubusercontent.com/madchap/django-DefectDojo/test-helm-repo-not-ghpages'
"test-wo-ghpages" has been added to your repositories

$ helm repo update

Search for defectdojo helm chart

$ helm search repo defectdojo
NAME                      	CHART VERSION	APP VERSION	DESCRIPTION                                      
test-wo-ghpages/defectdojo	1.5.1        	1.14.0-dev 	A Helm chart for Kubernetes to install DefectDojo

Could that be a viable option? If so, we could just modify @bgoareguer 's method and just tweak it, and not reinvent any of any wheels.

@madchap
Copy link
Collaborator

madchap commented Mar 21, 2021

Idea of actual name for the official branch: defectdojo-charts

@madchap madchap added this to the 1.14.0 milestone Mar 24, 2021
@alles-klar
Copy link
Contributor

I like the idea @madchap!

Naming: Do we want to push more then the helm package to this branch? If not I suggest to name the branch "helm-charts" because the name doesn't have to contain "defectdojo" - it is already in the name of this repository.

Reinvent the wheel: We can start with the solution from @bgoareguer but in the feature I prefer to the predefined action https://github.com/stefanprodan/helm-gh-pages. Less code to maintain and easier to read.

@madchap
Copy link
Collaborator

madchap commented Mar 27, 2021

Reinvent the wheel: We can start with the solution from @bgoareguer but in the feature I prefer to the predefined action https://github.com/stefanprodan/helm-gh-pages. Less code to maintain and easier to read.

But incompatible with our documentation.

Let's start with that and see how it behaves for 1.14.0. I will make the small mods to the PR now.

@alles-klar
Copy link
Contributor

Ok, lets go.

Anyhow, a short paragraph in the documentation would be nice!

@madchap
Copy link
Collaborator

madchap commented Mar 28, 2021

Ok, lets go.

Anyhow, a short paragraph in the documentation would be nice!

Yep, pinged you on the companion PR ;-)

@madchap madchap closed this Mar 30, 2021
@madchap madchap reopened this Mar 30, 2021
@madchap madchap closed this Mar 30, 2021
@madchap madchap reopened this Mar 30, 2021
@madchap madchap merged commit dafa0f6 into DefectDojo:dev Mar 30, 2021
madchap added a commit to madchap/django-DefectDojo that referenced this pull request Mar 30, 2021
valentijnscholten pushed a commit that referenced this pull request Mar 30, 2021
* Revert "Update KUBERNETES.md (#4143)"

This reverts commit d3263f5.

* Revert "Publish the Helm chart tarball with each release (#3849)"

This reverts commit dafa0f6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants