GitLab
Project Creation
Branch Standards
Acro has established certain standards that we require every project to adhere to. These standards serve as guidelines for maintaining consistency and quality across all projects. Refer to the Git Branches Standards Confluence page by following the link provided: Git Branches Standards
CI/CD Configuration
Including a token in the CI/CD process is crucial for the project's CI/CD
operations during tasks like composer install
or npm install
, which
involve linting, testing, and project deployment. In frontend projects, the
.gitlab-ci.yml
file dynamically generates an .npmrc
file, which relies on
the provided token.
Adding the token in the project's CI/CD settings
- Navigate to the Acro's GitLab and choose the desired project where you wish to add the variable.
- Click on the
Settings
tab on the sidebar. - Click on the
CI/CD
tab on the sidebar. - Under the
Variables
section, click on theExpand
button. - Click on the
Add variable
button. - Fill in the details as follows:
Variable Configuration
- Type:
Variable (default)
- Environments:
All (default)
- Flags:
Expand variable reference
andMask variable
- Key:
GITLAB_API_TOKEN
- Value:
The token value which you've previously generated.
Referencing the token in the GitLab CI file
Once the token is added as a secret variable, it can be referenced in the
.gitlab-ci.yml
file as shown below:
Frontend project example:
before_script:
- |
{
echo "@acromedia:registry=https://git.acromedia.com/api/v4/projects/packages/npm/"
echo "${CI_API_V4_URL#https?}/packages/npm/:_authToken=\${GITLAB_API_TOKEN}"
echo "${CI_API_V4_URL#https?}/projects/:_authToken=\${GITLAB_API_TOKEN}"
echo "${CI_API_V4_URL#https?}/projects/1149/packages/npm/:_authToken=\${GITLAB_API_TOKEN}"
} | tee -a ~/.npmrc