GitLab autodeployment for testing


  • openssl utility
  • kubectl
  • task
  • cluster interaction tool (one of):
    • gcloud
    • kind


Parameters are passed via environment variables:

variable namerequireddefaultdescription
GITLAB_CHART_VERSIONnolatest availableChart version to use. Must align with the charts provided within TAG of the operator
GITLAB_CHART_REPOno Helm Chart repository HTTP URI. Mainly used to fetch default KinD configs. Container Image Name
TAGnomasterOperator Container Image Tag. Needs an override in most cases
GITLAB_CHART_DIRyes path to a clone of GitLab Chart repo
GITLAB_OPERATOR_DIRno.path to a clone of GitLab Operator repo
GITLAB_OPERATOR_MANIFESTno Optional reference to manifest for Operator deployment, if empty - auto-generated from ${GITLAB_OPERATOR_DIR}. To note: to reference proper image and tag set up IMG and TAG environment variables
GITLAB_CR_DEPLOY_MODEnoselfsignedSelect mode of deployment: selfsigned or certmanager
GITLAB_OPERATOR_DOMAINno ${LOCAL_IP} for KinD, for other platformsDomain for GitLab (operator) deployment
GITLAB_HOSTno*.${GITLAB_OPERATOR_DOMAIN}Common name to use for GitLab endpoint self-signed cert
GITLAB_KEY_FILEnogitlab.keySelf-signed cert key file
GITLAB_CERT_FILEnogitlab.crtSelf-signed cert file
GITLAB_PAGES_HOSTno*.pages.${GITLAB_OPERATOR_DOMAIN}Common name to use for GitLab Pages endpoint self-signed cert
GITLAB_PAGES_KEY_FILEnopages.keySelf-signed cert key file
GITLAB_PAGES_CERT_FILEnopages.crtSelf-signed cert file
GITLAB_ACME_EMAILnooutput of git config Email used for cert-manager. Not necessary in KinD deployments
GITLAB_RUNNER_TOKENno Runner Token, if empty it’s auto-retrieved from running GitLab Instance
KINDnokindcommand line executable name for KinD
KIND_CLUSTER_NAMEnogitlabKinD cluster name
KIND_IMAGEnokindest/node:v1.18.19value of --image argument for KinD
KIND_LOCAL_IPyes, for KinD Local IP required to provision Certs etc for the domain ${LOCAL_IP}
KUBECTLnokubectlpath to kubectl command
HELMnohelmpath to helm command
TASKnotaskpath to task command

Tool pointer variables ($KIND, $KUBECTL, $HELM, etc.)

Main use of tool pointer variables is to point to particular tool path or path to a wrapper script (like k for kubectl, for example).

One of the alternative uses for any one of those variables is to get some debugging info:

KUBECTL="echo kubectl" deploy_operator

However, this can also be achieved by using bash -x


Example with Cert-Manager (ran from the root of gitlab-operator repo):

export GITLAB_CHART_DIR=~/work/gitlab \

PROJECT="gcp-project-123" CLUSTER_NAME="mydomain" \
    bash ${GITLAB_CHART_DIR}/scripts/ up

# ...wait for provisioning to complete
scripts/ generic_deploy

Alternatively, use a CR generated by a pipeline (downloaded into ./123-my-branch.yaml, for example):

cd scripts
export GITLAB_CHART_DIR=~/work/gitlab \
       GITLAB_OPERATOR_DIR=~/work/gitlab-operator \
       GITLAB_OPERATOR_MANIFEST=./123-my-branch.yaml \

PROJECT="gcp-project-123" CLUSTER_NAME="mydomain" \
    bash ${GITLAB_CHART_DIR}/scripts/ up

# ...wait for provisioning to complete
./ generic_deploy

The command above has been run from the within scripts/ directory (note the use of GITLAB_OPERATOR_DIR).

One can deploy with self-signed certs, in which case KIND_LOCAL_IP should be provided (use “cluster IP”) and not GITLAB_OPERATOR_DOMAIN.


By default deployment is done with Self-Signed cert:

export KIND_CLUSTER_NAME=gitlab \
       KIND_LOCAL_IP= \

scripts/ kind_deploy

Alternatively, use a CR generated by a pipeline in build manifest job (downloaded into ./123-my-branch.yaml, for example):

export KIND_CLUSTER_NAME=gitlab \
       KIND_LOCAL_IP= \
       GITLAB_CHART_DIR=~/work/gitlab \
       GITLAB_OPERATOR_MANIFEST=./123-my-branch.yaml \

scripts/ kind_deploy

That’s it! You should now be able to navigate to https://gitlab.(your IP) and log in with the root password.

NOTE: Use of cert-manager for generating certificates for Ingresses in KinD is not possible unless your KinD instance is publicly accessible.

Runner deployment

Once base deployment has been performed do the runner deployment (retaining same exported variables):

scripts/ runner_deploy

Alternatively, do everything in one go (we’ll use kind deploy for example):

scripts/ kind_deploy runner_deploy