DigitalOcean
Provides helpers for authenticating with DigitalOcean and connecting to DOKS clusters.
Usage
yaml
include:
- project: hosst/gitlab-pipelines
file: helpers/digitalocean.yamlVariables
| Variable | Default | Description |
|---|---|---|
DIGITALOCEAN_ACCESS_TOKEN | DigitalOcean personal access token — set as a masked CI/CD variable | |
DIGITALOCEAN_KUBERNETES_CLUSTER | $KUBERNETES_CLUSTER | DOKS cluster name |
Authentication (.doctl_auth)
Initialises doctl with the access token and verifies the connection. Skips silently if DIGITALOCEAN_ACCESS_TOKEN is not set.
Variables
Examples
yaml
my-job:
extends: .doctl_auth
script:
- doctl compute droplet listKubernetes access (.doctl_kubernetes)
Extends .doctl_auth. Saves the cluster kubeconfig so kubectl and helm commands work. Skips silently if DIGITALOCEAN_KUBERNETES_CLUSTER or DIGITALOCEAN_ACCESS_TOKEN is not set.
Variables
Examples
Typically called via !reference in a deploy job's before_script alongside other cloud provider helpers. Both DigitalOcean and Google helpers can be included at the same time — each skips silently if its required variables are not set.
yaml
deploy:
extends: .helm
before_script:
- !reference [.helm, before_script]
- !reference [.doctl_kubernetes, before_script]
script:
- helm upgrade $HELM_RELEASE $HELM_CHART --install --namespace $HELM_NAMESPACE