doc/user/project/integrations/harbor.md
{{< details >}}
{{< /details >}}
You can use Harbor as the container registry for your GitLab project.
Harbor is an open-source registry that can help you manage artifacts across cloud-native compute platforms like Kubernetes and Docker.
The Harbor integration can help you if you need GitLab CI/CD and a container image repository.
In the Harbor instance, ensure that:
GitLab supports integrating Harbor projects at the group or project level. Complete these steps in GitLab:
In the top bar, select Search or go to and find your project.
Select Settings > Integrations.
Select Harbor.
Under Enable integration, select the Active checkbox.
Provide the Harbor configuration information:
https://harbor.example.net.testproject.Select Save changes.
After the Harbor integration is activated:
$HARBOR_USERNAME, $HARBOR_HOST, $HARBOR_OCI, $HARBOR_PASSWORD, $HARBOR_URL, and $HARBOR_PROJECT are created for CI/CD use.For each API request through the Harbor integration, the credentials for your connection to the Harbor API use
the username:password combination. The following are suggestions for safe use:
Malicious code pushed to your .gitlab-ci.yml file could compromise your variables, including
$HARBOR_PASSWORD, and send them to a third-party server. For more details, see
CI/CD variable security.
Helm supports OCI registries by default. OCI is supported in Harbor 2.0 and later. Read more about OCI in Helm's blog and documentation.
helm:
stage: helm
image:
name: dtzar/helm-kubectl:latest
entrypoint: ['']
variables:
# Enable OCI support (not required since Helm v3.8.0)
HELM_EXPERIMENTAL_OCI: 1
script:
# Log in to the Helm registry
- helm registry login "${HARBOR_URL}" -u "${HARBOR_USERNAME}" -p "${HARBOR_PASSWORD}"
# Package your Helm chart, which is in the `test` directory
- helm package test
# Your helm chart is created with <chart name>-<chart release>.tgz
# You can push all building charts to your Harbor repository
- helm push test-*.tgz ${HARBOR_OCI}/${HARBOR_PROJECT}