argo-helm/CONTRIBUTING.md

191 lines
7.4 KiB
Markdown
Raw Permalink Normal View History

2019-09-20 00:36:12 +00:00
# Contributing
Argo Helm is a collection of **community maintained** charts. Therefore we rely on you to test your changes sufficiently.
## Pull Requests
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests. See the above stated requirements for PR on this project.
### Pull Request Title Linting
We lint the title of your pull request to ensure it follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This is done using GitHub actions and the [action-semantic-pull-request](.github/workflows/pr-title.yml) workflow. We require the scope of the change to be included in the title. The scope should be the name of the chart you are changing. For example, if you are changing the `argo-cd` chart, the title of your pull request should be `fix(argo-cd): Fix typo in values.yaml`.
## Documentation
The documentation for each chart is generated with [helm-docs](https://github.com/norwoodj/helm-docs). This way we can ensure that values are consistent with the chart documentation.
We have a script on the repository which will execute the helm-docs docker container, so that you don't have to worry about downloading the binary etc. Simply execute the script (Bash compatible, might require sudo privileges):
```shell
./scripts/helm-docs.sh
```
> **Note**
> When creating your own `README.md.gotmpl`, don't forget to add it to your `.helmignore` file.
### Updating a chart README.md
When updating the `README.md.gotmpl` inside a chart directory you must to run the `helm-docs` script to generate the updated `README.md` file. To reiterate, you should not edit the `README.md` file manually. It will be generated by the following command:
```shell
./scripts/helm-docs.sh
```
> **Note**
> If you see changes to unrelated chart `README.md` files you may have accidentally updated a `README.md.gotmpl` file in another chart's folder unintentionally or someone else failed to run this script. Please revert those changes if you do not intend them to be a part of your pull request.
## Versioning
Each chart's version follows the [semver standard](https://semver.org/).
New charts should start at version `1.0.0`, if it's considered stable. If it isn't considered stable, it must be released as `prerelease`.
Any breaking changes to a chart (backwards incompatible) require:
* Bump of the current Major version of the chart
* State possible manual changes for this chart version in the `Upgrading` section of the chart's `README.md.gotmpl`
### New Application Versions
Helm charts are intended to be created for all non-patched releases of Argo CD, Workflows, Rollouts, and Events. Associated dependencies, such as Redis, will use the version recommended by the associated release.
When selecting new application versions ensure you make the following changes:
* `values.yaml`: Bump all instances of the container image version
* `Chart.yaml`: Ensure `appVersion` matches the above container image and bump `version`
Please ensure chart version changes adhere to semantic versioning standards:
* Major: Large chart rewrites, major non-backwards compatible or destructive changes
* Minor: New chart functionality (sidecars), major application updates or minor non-backwards compatible changes
* Patch: App version patch updates, backwards compatible optional chart features
### Immutability
Each release for each chart must be immutable. Any change to a chart (even just documentation) requires a version bump. Trying to release the same version twice will result in an error.
### Chart Versioning
Currently we require a chart version bump for every change to a chart, including updating information for older versions. This may change in the future.
### Artifact Hub Annotations
Since we release our charts on Artifact Hub we encourage making use of the provided chart annotations for Artifact Hub.
* [https://artifacthub.io/docs/topics/annotations/helm/](https://artifacthub.io/docs/topics/annotations/helm/)
#### Changelog
We want to deliver transparent chart releases for our chart consumers. Therefore we require a changelog per new chart release.
Changes on a chart must be documented in a chart specific changelog in the `Chart.yaml` [Annotation Section](https://helm.sh/docs/topics/charts/#the-chartyaml-file).
A new `artifacthub.io/changes` needs to be written covering only the changes since the previous release.
Each change requires a new bullet point following the pattern. See more information [Artifact Hub annotations in Helm Chart.yaml file](https://artifacthub.io/docs/topics/annotations/helm/).
```yaml
- kind: {type}
description: {description}
```
You can use the following template:
```yaml
name: argo-cd
version: 5.19.12
...
annotations:
artifacthub.io/changes: |
- kind: added
description: Something New was added
- kind: changed
description: Changed Something within this chart
- kind: changed
description: Changed Something else within this chart
- kind: deprecated
description: Something deprecated
- kind: removed
description: Something was removed
- kind: fixed
description: Something was fixed
- kind: security
description: Some Security Patch was included
```
## Testing
### Testing Argo Workflows Changes
2019-09-20 00:36:12 +00:00
Minimally:
```shell
feat(argo-workflows): Multiple workflow namespaces (#824) * allow workflow to be run in multiple namespaces, bump chart version Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * update helm install instructions Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * fix indents Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * add newlines Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * bump chart version Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * default to "argo" namespace for workflow service account Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * simplify setting service account, fix syntactical error in defaulting to "argo" namespace Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * Bump only the chart version, revert bumping the controller version: 3.0.8 does not exist yet as a workflow-controller image version Signed-off-by: reinvantveer <reinvantveer@gmail.com> * don't set a namespace if there isn't one provided Signed-off-by: reinvantveer <reinvantveer@gmail.com> * bump version Signed-off-by: reinvantveer <reinvantveer@gmail.com> * re-use controller.workflowNamespaces instead of introducing workflow.namespaces Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * re-use controller.workflowNamespaces instead of introducing workflow.namespaces Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * re-use controller.workflowNamespaces instead of introducing workflow.namespaces Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * re-use controller.workflowNamespaces instead of introducing workflow.namespaces, add additional inline comments on rbac.create effect Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * compress namespaces from controller.workflowNamespaces and workflow.namespace into single loop iteration Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * compress namespaces from controller.workflowNamespaces and workflow.namespace into single loop iteration Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * compress namespaces from controller.workflowNamespaces and workflow.namespace into single loop iteration Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * dro now-redundant branch for controller.workflowNamespaces Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * use template helper "argo-workflows.fullname" instead of release name in order to be able to override the service account name Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * add missing "template" keyword Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * drop redundant $namespace assignment that was already moved inside the "range" function Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * replace "define" templates with simple values now that controller.workflowNamespaces and workflow.namespace are unified into a single "range" iteration Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * drop redundant $namespace assignment that was already moved inside the "range" function Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * inline "define" templates with simple values now that controller.workflowNamespaces and workflow.namespace are unified into a single "range" iteration Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * inline "define" templates with simple values now that controller.workflowNamespaces and workflow.namespace are unified into a single "range" iteration Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * add missing "$" to denote target for templating the workflows fullname helper Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * restore `with` blocks for service account name and service account annotations Signed-off-by: reinvantveer <reinvantveer@gmail.com> * drop validations: considering cases of `workflowNamespaces`, `namespace` and `singleNamespace` Signed-off-by: reinvantveer <reinvantveer@gmail.com> * include case for single namespaces with default ("") namespace, otherwise (ternary) combine the workflow namespace and workflowNamespaces from the controller settings into a list to iterate over Signed-off-by: reinvantveer <reinvantveer@gmail.com> * wrap namespace configuration in `with` block to prevent setting it to "" Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * fix append vs. concat bug: append workflowNamespace to (possibly 0-lenght) list of controller.workflowNamespaces Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl> * fix namespace range with additional check for either single namespace being false, or append to the workflow namespaces: the first non-null (coalesce) from the workflow namespace or the namespace Argo is being deployed to. Signed-off-by: reinvantveer <reinvantveer@gmail.com> * add changelog entries Signed-off-by: reinvantveer <reinvantveer@gmail.com> * unwrap (inline) with-block for service account name Signed-off-by: reinvantveer <reinvantveer@gmail.com> Co-authored-by: Vlad Losev <vladlosev@users.noreply.github.com>
2021-07-20 18:18:26 +00:00
helm install charts/argo-workflows -n argo
2019-09-20 00:36:12 +00:00
argo version
```
Follow [these](https://argo-workflows.readthedocs.io/en/stable/quick-start/#submitting-an-example-workflow) instructions for running a hello world workflow.
2019-09-20 00:36:12 +00:00
### Testing Argo CD Changes
2019-09-20 00:36:12 +00:00
Clean-up:
```shell
2019-09-20 00:36:12 +00:00
helm delete argo-cd --purge
kubectl delete crd -l app.kubernetes.io/part-of=argocd
2019-09-20 00:36:12 +00:00
```
Pre-requisites:
```shell
helm repo add redis-ha https://dandydeveloper.github.io/charts/
helm dependency update
```
2019-09-20 00:36:12 +00:00
Minimally:
```shell
helm install argocd argo/argo-cd -n argocd --create-namespace
2019-11-05 00:17:25 +00:00
kubectl port-forward service/argo-cd-argocd-server -n argocd 8080:443
2019-09-20 00:36:12 +00:00
```
In a new terminal:
```shell
argocd version --server localhost:8080 --insecure
2019-09-20 00:36:12 +00:00
# reset password to 'Password1!'
kubectl -n argocd patch secret argocd-secret \
-p '{"stringData": {
"admin.password": "$2a$10$hDj12Tw9xVmvybSahN1Y0.f9DZixxN8oybyA32Uy/eqWklFU4Mo8O",
"admin.passwordMtime": "'$(date +%FT%T%Z)'"
2019-09-20 00:36:12 +00:00
}}'
argocd login localhost:8080 --username admin --password 'Password1!'
2019-11-05 00:17:25 +00:00
# WARNING: server certificate had error: x509: certificate signed by unknown authority. Proceed insecurely (y/n)? y
2019-09-20 00:36:12 +00:00
```
Create and sync app:
```shell
2019-09-20 00:36:12 +00:00
argocd app create guestbook --dest-namespace default --dest-server https://kubernetes.default.svc --path guestbook --project default --repo https://github.com/argoproj/argocd-example-apps.git
argocd app sync guestbook
```
### Testing Charts
As part of the Continuous Integration system we run Helm's [Chart Testing](https://github.com/helm/chart-testing) tool.
The checks for Chart Testing are stricter than the standard Helm requirements. For example, fields normally considered optional like `maintainer` are required in the standard spec and must be valid GitHub usernames.
Linting configuration can be found in [ct-lint.yaml](./.github/configs/ct-lint.yaml)
The linting can be invoked manually with the following command:
```shell
./scripts/lint.sh
```
2019-09-20 00:36:12 +00:00
## Publishing Changes
Changes are automatically publish whenever a commit is merged to the `main` branch by the CI job (see `./.github/workflows/publish.yml`).