Deployment
Requirements
Deploying on Lagoon?
Add the token as an environment variable through the Lagoon dashboard by following the steps below:
Adding the token as a project variable
- Navigate to the Lagoon dashboard and choose the desired project where you wish to add the variable.
- Click on the
Variables
tab on the sidebar. - Click on the
Add
button. - Fill in the details as follows:
Variable Configuration
- Scope:
Build
- Name:
GITLAB_API_TOKEN
- Value:
The token value which you've previously generated.
- Click on the
Add project variable
button to add the variable. - Trigger a redeployment of your project environments to apply the changes and ensure the variable becomes available.
Referencing the token in the docker file
Once the token is added as a project variable, it can be referenced in your
docker file (eg. ./lagoon/cli.dockerfile
) as shown below:
Frontend project example:
ARG GITLAB_API_TOKEN
RUN echo "@acromedia:registry=https://git.acromedia.com/api/v4/packages/npm/" >> .npmrc
RUN echo "//git.acromedia.com/api/v4/packages/npm/:_authToken=${GITLAB_API_TOKEN}" >> .npmrc
RUN echo "//git.acromedia.com/api/v4/projects/:_authToken=${GITLAB_API_TOKEN}" >> .npmrc
Drupal project example:
ARG GITLAB_API_TOKEN
RUN if [[ -n "${GITLAB_API_TOKEN}" ]] ; then \
composer config gitlab-token.git.acromedia.com ${GITLAB_API_TOKEN}; \
fi