Commit dc8b51f2 authored by David Fernandez's avatar David Fernandez

Update the helm documentation

To properly state:
* that URL-encoded project ids only work with curl when pushing the helm
chart
* to properly document the channel parameter
* to document that the username is needed for authentication, even with
deploy tokens.

Changelog: other
parent 98a4386b
...@@ -25,8 +25,8 @@ Read more in the Helm documentation about these topics: ...@@ -25,8 +25,8 @@ Read more in the Helm documentation about these topics:
To authenticate to the Helm repository, you need either: To authenticate to the Helm repository, you need either:
- A [personal access token](../../../api/index.md#personalproject-access-tokens). - A [personal access token](../../../api/index.md#personalproject-access-tokens) with the scope set to `api`.
- A [deploy token](../../project/deploy_tokens/index.md). - A [deploy token](../../project/deploy_tokens/index.md) with the scope set to `read_package_registry`, `write_package_registry`, or both.
- A [CI/CD job token](../../../ci/jobs/ci_job_token.md). - A [CI/CD job token](../../../ci/jobs/ci_job_token.md).
## Publish a package ## Publish a package
...@@ -35,24 +35,35 @@ NOTE: ...@@ -35,24 +35,35 @@ NOTE:
You can publish Helm charts with duplicate names or versions. If duplicates exist, GitLab always You can publish Helm charts with duplicate names or versions. If duplicates exist, GitLab always
returns the chart with the latest version. returns the chart with the latest version.
Once built, a chart can be uploaded to the `stable` channel with `curl` or `helm-push`: Once built, a chart can be uploaded to the desired channel with `curl` or `helm-push`:
- With `curl`: - With `curl`:
```shell ```shell
curl --request POST \ curl --request POST \
--form 'chart=@mychart-0.1.0.tgz' \ --form 'chart=@mychart-0.1.0.tgz' \
--user <username>:<personal_access_token> \ --user <username>:<access_token> \
https://gitlab.example.com/api/v4/projects/1/packages/helm/api/stable/charts https://gitlab.example.com/api/v4/projects/<project_id>/packages/helm/api/<channel>/charts
``` ```
- `<username>`: the GitLab username or the deploy token username.
- `<access_token>`: the personal access token or the deploy token.
- `<project_id>`: the project ID (like `42`) or the
[URL-encoded](../../../api/index.md#namespaced-path-encoding) path of the project (like `group%2Fproject`).
- `<channel>`: the name of the channel (like `stable`).
- With the [`helm-push`](https://github.com/chartmuseum/helm-push/#readme) plugin: - With the [`helm-push`](https://github.com/chartmuseum/helm-push/#readme) plugin:
```shell ```shell
helm repo add --username <username> --password <personal_access_token> project-1 https://gitlab.example.com/api/v4/projects/1/packages/helm/stable helm repo add --username <username> --password <access_token> project-1 https://gitlab.example.com/api/v4/projects/<project_id>/packages/helm/<channel>
helm push mychart-0.1.0.tgz project-1 helm push mychart-0.1.0.tgz project-1
``` ```
- `<username>`: the GitLab username or the deploy token username.
- `<access_token>`: the personal access token or the deploy token.
- `<project_id>`: the project ID (like `42`).
- `<channel>`: the name of the channel (like `stable`).
## Use CI/CD to publish a Helm package ## Use CI/CD to publish a Helm package
To publish a Helm package automated through [GitLab CI/CD](../../../ci/index.md), you can use To publish a Helm package automated through [GitLab CI/CD](../../../ci/index.md), you can use
...@@ -69,18 +80,27 @@ stages: ...@@ -69,18 +80,27 @@ stages:
upload: upload:
stage: upload stage: upload
script: script:
- 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@mychart-0.1.0.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/stable/charts"' - 'curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@mychart-0.1.0.tgz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/<channel>/charts"'
``` ```
- `<username>`: the GitLab username or the deploy token username.
- `<access_token>`: the personal access token or the deploy token.
- `<channel>`: the name of the channel (like `stable`).
## Install a package ## Install a package
To install the latest version of a chart, use the following command: To install the latest version of a chart, use the following command:
```shell ```shell
helm repo add --username <username> --password <personal_access_token> project-1 https://gitlab.example.com/api/v4/projects/1/packages/helm/stable helm repo add --username <username> --password <access_token> project-1 https://gitlab.example.com/api/v4/projects/<project_id>/packages/helm/<channel>
helm install my-release project-1/mychart helm install my-release project-1/mychart
``` ```
- `<username>`: the GitLab username or the deploy token username.
- `<access_token>`: the personal access token or the deploy token.
- `<project_id>`: the project ID (like `42`).
- `<channel>`: the name of the channel (like `stable`).
If the repo has previously been added, you may need to run: If the repo has previously been added, you may need to run:
```shell ```shell
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment