Skip to content

Instantly share code, notes, and snippets.

@snambi
Created July 25, 2023 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snambi/d32452066433b365ff9d0db47e7c8a23 to your computer and use it in GitHub Desktop.
Save snambi/d32452066433b365ff9d0db47e7c8a23 to your computer and use it in GitHub Desktop.
Helm repository in gitlab

Create a personal token to deploy to helm repo

  • Go to Settings -> Access Tokens in your gitlab project
  • Add new token name, choose validtity, choose role as "maintainer", select scopes as "api, read_api"
  • Click on "create project access token"
  • Copy the created token in safe location.

Add gitlab package repo to helm

Get the project-id from gitlab project settings.

# Set the following environment variable
export HELM_REPO="https://gitlab.company.com/api/v4/projects/<project-id>/packages/helm/stable"

export HELM_REPO="https://gitlab.company.com/api/v4/projects/354/packages/helm/stable"

# add the repo to helm
helm repo add --username nambisankaran@company.com --password glpat-iu7Zu-rbSc88siQkzBjN  gitlab-helm $HELM_REPO

Upload helm packageto gitlab

This section is WIP.

# add cm-push plugin
helm plugin install https://github.com/chartmuseum/helm-push

# package helm charts
helm package helm-charts
Successfully packaged chart and saved it to: /Users/nsankar/Projects/charts/my-service-1.0.0.tgz

# push the package to gitlab helm repo
helm cm-push ./my-service-1.0.0.tgz gitlab
Pushing my-service-1.0.0.tgz to gitlab...
Done.

Download the dependenct charts from gitlab

## check whether dependency is available
helm dependency  list
NAME            	VERSION	REPOSITORY                                                            	STATUS
my-service	1.0.0  	https://gitlab.company.com/api/v4/projects/434/packages/helm/stable	missing

### update dependency
helm dependency  build
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "gitlab" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading my-service from repo https://gitlab.company.com/api/v4/projects/434/packages/helm/stable
Deleting outdated charts

### helm dependency update
helm dependency  list
NAME            	VERSION	REPOSITORY                                                            	STATUS
my-service	1.0.0  	https://gitlab.company.com/api/v4/projects/115/packages/helm/stable	ok

### run helm commands 
helm template . -f values-dev.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment