1. Information
-
See GitLab Beginner Tutorial 1 | Introduction and Getting Started.
-
See GitLab Beginner Tutorial 2 | Getting started with Git Commands.
-
See GitLab Beginner Tutorial 5 | How to install GitLab Runner on Mac OS.
-
See GitLab Beginner Tutorial 6 | How to install GitLab Runner on Windows OS.
-
See GitLab Beginner Tutorial 7 | GitLab CI/CD Getting Started.
GitLab CI/CD Masterclass for Beginners (2025 Edition).
GitLab CI/CD Pipeline Tutorial for Beginners.
GitLab CI CD Tutorial for Beginners (Crash Course).
echo "${CI_PROJECT_PATH}" # dhkiestra/gitlabexercise
echo "${CI_SERVER_HOST}" # gitlab.com
echo "${GITLAB_USER_EMAIL}" # dhkiestra@protonmail.com
echo "${GITLAB_USER_ID}" # 32885866
echo "${GITLAB_USER_LOGIN}" # dhkiestra
echo "${GITLAB_USER_NAME}" # Douwe Kiestra
echo "${CI_PROJECT_URL}" # https://gitlab.com/dhkiestra/gitlabexercise
2. GitLab Registration
-
Browse to https://about.gitlab.com/pricing.
-
Select Free | Get started.
-
Click Register now.
First name Douwe Douwe Last name Kiestra Kiestra Username delta-software-labs dhkiestra Email douwe@deltasoftware.frl dhkiestra@protonmail.com Password ******** ******** ■ I agree that GitLab can contact me by email about its product, services, or events.
-
Click Continue.
-
Enter the code received by email in the Verification code field.
-
Click Verify email address.
-
Select DevOps Engineer for Role.
-
Select I want to explore GitLab to see if it’s worth switching to for I’m signing up for GitLab because.
-
Choose Create a new project for What would you like to do?.
-
Choose Just me for Who will be using GitLab?.
-
Click Continue.
-
Select the Create tab.
Group name delta-software-labs-group Project name delta-software-labs-project Select a template Select Your project will be created at: https://gitlab.com/delta-software-labs-group/delta-software-labs-project You can always change your URL later ■ Include a Getting Started README
-
Click Create project.
3. Create Repository
-
Sign in to GitLab.
-
Select the Projects page.
-
Select the delta-software-labs-group / delta-software-labs-project project.
-
Select Learn GitLab.
-
Click Create a repository.
cd ~/GitLabExercise git init git add README.md git status -s git commit -m "First commit" git status -s git hg-log git push -u https://gitlab.com/dhkiestra/gitlabexercise.git master
4. Add SSH Key
-
Sign in to GitLab.
-
Select the Projects page.
-
Select a project.
-
Click Add SSH key.
-
Click Add new key.
-
Copy the contents of the ~/.ssh/id_ed25519.pub file to the Key field.
Title delta@HOMENB-FRL01 Usage type Authentication & Signing Expiration date 2027-01-09
-
Click Add key.
ls -al ~/.ssh/id_ed25519* -rw------- 1 delta delta 411 2025-10-16 08:10:43 /home/delta/.ssh/id_ed25519 -rw------- 1 delta delta 411 2026-01-11 15:05:07 /home/delta/.ssh/id_ed25519-douwe -rw-r--r-- 1 delta delta 100 2026-01-11 15:05:28 /home/delta/.ssh/id_ed25519-douwe.pub -rw-r--r-- 1 delta delta 99 2025-10-16 08:10:43 /home/delta/.ssh/id_ed25519.pub ssh -T git@gitlab.com # Welcome to GitLab, @delta-software-labs! ssh -i ~/.ssh/id_ed25519-douwe -T git@gitlab.com # Welcome to GitLab, @dhkiestra!
5. Personal Access Token
-
Sign in to GitLab.
-
Select Avatar (User icon) > Edit profile.
-
Select the Personal access tokens page.
-
Select Add new token.
-
Type
GITLAB_ACCESS_TOKENin the Token name field. -
Set the Expiration date to one year later.
-
Check read_registry.
-
Check read_api.
-
Click Create token.
-
Copy and paste the value in KeePassXC password manager.
-
Select Settings > CI/CD.
-
Expand Variables.
-
Click Add variable.
-
Type
GITLAB_ACCESS_TOKENin the Key field. -
Paste the value in the Value field.
-
Click Add variable.
-
Click Cancel.
6. Project Access Token
-
Sign in to GitLab.
-
Select the Projects page.
-
Select a project.
-
Select Settings > Access tokens.
-
Select Add new token.
-
Type
PROJECT_ACCESS_TOKENin the Token name field. -
Set the Expiration date to one year later.
-
Check read_repository.
-
Check write_repository.
-
Click Create project access token.
-
Copy and paste the value in KeePassXC password manager.
-
Select Settings > CI/CD.
-
Expand Variables.
-
Click Add variable.
-
Type
PROJECT_ACCESS_TOKENin the Key field. -
Paste the value in the Value field.
-
Click Add variable.
-
Click Cancel.
7. GitLab Deploy Token
-
Sign in to GitLab.
-
Select the Projects page.
-
Select a project.
-
Select Settings > Repository.
-
Expand Deploy tokens.
-
Click Add token.
-
Type
GITLAB_DEPLOY_TOKENin the Name field. -
Check read_package_registry.
-
Check write_package_registry.
-
Click Create deploy token.
-
Click Cancel.
-
Copy and paste the value in KeePassXC password manager.
-
Select Settings > CI/CD.
-
Expand Variables.
-
Click Add variable.
-
Type
GITLAB_DEPLOY_TOKENin the Key field. -
Paste the value in the Value field.
-
Click Add variable.
-
Click Cancel.
8. NPM Registry
curl --header "PRIVATE-TOKEN: <personal-access-token>" --url "https://gitlab.com/api/v4/projects/77592356/packages"
9. Add Runner
-
Sign in to GitLab.
-
Select the Projects page.
-
Select a project.
-
Select Settings > CI/CD.
-
Expand Runners.
-
Click Create project runner.
-
Type
linuxin the Tags field. -
Click Create runner.
-
Copy the runner authentication token.
10. Install Runner On VPS
# Log in. ssh team@vps-web.deltasoftware.frl # Prepare VPS. sudo apt-get update sudo apt-get upgrade --yes sudo apt install --yes curl gnupg apt-transport-https ca-certificates # Add GitLab repository. curl -fsSL https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash ls -al /etc/apt/sources.list.d cat /etc/apt/sources.list.d/runner_gitlab-runner.list # Install GitLab runner. sudo apt-get update sudo apt-get install gitlab-runner --yes # Register the runner. sudo gitlab-runner register --url https://gitlab.com --token <runner-authentication-token> # Runtime platform arch=amd64 os=linux pid=695340 revision=1c855082 version=18.7.2 # Running in system-mode. # # Enter the GitLab instance URL (for example, https://gitlab.com/): # [https://gitlab.com]: # Verifying runner... is valid correlation_id=9bbbce6ce2f3671e-IAD runner=68z10wfSc # Enter a name for the runner. This is stored only in the local config.toml file: # [vps-web.deltasoftware.frl]: # Enter an executor: shell, parallels, virtualbox, docker-windows, kubernetes, docker-autoscaler, instance, custom, ssh, docker, docker+machine: # shell # Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! # # Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml" sudo cat /etc/gitlab-runner/config.toml # Verify that the runner is available to pick up jobs. sudo gitlab-runner run # Runtime platform arch=amd64 os=linux pid=695476 revision=1c855082 version=18.7.2 # Starting multi-runner from /etc/gitlab-runner/config.toml... builds=0 max_builds=0 # Running in system-mode. # # Usage logger disabled builds=0 max_builds=1 # Configuration loaded builds=0 max_builds=1 # WARNING: CONFIGURATION: Long polling issues detected. # Issues found: # - Request bottleneck: 1 runners have request_concurrency=1, causing job delays during long polling # This can cause job delays matching your GitLab instance's long polling timeout. # Recommended solutions: # 1. Increase 'request_concurrency' to 2-4 for 1 runners currently using request_concurrency=1 # Note: The 'FF_USE_ADAPTIVE_REQUEST_CONCURRENCY' feature flag can help automatically adjust request_concurrency based on workload. # This message will be printed each time the configuration is reloaded if the issues persist. # See documentation: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#long-polling-issues builds=0 max_builds=1 # listen_address not defined, metrics & debug endpoints disabled builds=0 max_builds=1 # [session_server].listen_address not defined, session endpoints disabled builds=0 max_builds=1 # Initializing executor providers builds=0 max_builds=1 # Type Ctrl+C to exit.
ssh team@vps-web.deltasoftware.frl gitlab-runner register --url https://gitlab.com --token <token>
-
Install nodejs that is needed by GitLabExcercise.
# Fix: E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) # See https://stackoverflow.com/questions/49004853/gitlab-runner-unexpectedly-runs-as-root # Make GitLab runner service run as root instead of gitlab-runner. cat /etc/systemd/system/gitlab-runner.service sudo systemctl status gitlab-runner sudo systemctl stop gitlab-runner sudo systemctl status gitlab-runner sudo vi /etc/systemd/system/gitlab-runner.service # Replace: "--user" "gitlab-runner" by "--user" "root" sudo systemctl status gitlab-runner sudo systemctl daemon-reload sudo systemctl status gitlab-runner sudo systemctl start gitlab-runner sudo systemctl status gitlab-runner # Fix: fatal: detected dubious ownership in repository at '/home/gitlab-runner/builds/68z10wfSc/0/dhkiestra/gitlabexercise' # GitLab suggests: git config --global --add safe.directory /home/gitlab-runner/builds/68z10wfSc/0/dhkiestra/gitlabexercise # See https://stackoverflow.com/questions/75143714/detected-dubious-ownership-in-repository-gitlab-ci-cd sudo vi /etc/gitlab-runner/config.toml # Paste the following line after: name = "vps-web.deltasoftware.frl" # environment = ["GIT_CONFIG_COUNT=1", "GIT_CONFIG_KEY_0=safe.directory", "GIT_CONFIG_VALUE_0=*"] sudo systemctl stop gitlab-runner sudo systemctl status gitlab-runner sudo systemctl start gitlab-runner sudo systemctl status gitlab-runner
11. Setup CI/CD
12. Publish Package to Registry
-
See https://stackoverflow.com/questions/54665511/how-do-i-publish-a-private-npm-package-with-gitlab-ci.
-
See https://medium.com/@adityasinghdabhra/publish-npm-package-to-private-repository-gitlab-bf15d98c1164.
-
See https://www.ramonxavier.com/blog/publish-npm-package-to-gitlab-package-registry.
-
See https://csst-tb.bao.ac.cn/code/help/user/packages/npm_registry/index.md.
-
See https://gitlab.com/gitlab-org/gitlab-foss/-/tree/v13.0.3/doc/user/packages/npm_registry.
-
See https://dev.to/kristijankanalas/gitlab-ci-cd-for-npm-packages-4ncj.
-
See https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c.
-
Note: You can publish one version only once, for next update you must update you package.json’s version for successful publishing else it give you a error.
-
Note: This behavior is expected after recent npm security updates. As part of these changes, npm access tokens stored in your local .npmrc now expire after 2 hours.
npm publish npm publish --verbose TOKEN=<YOUR_TOKEN> npm publish # npm error code E401 TOKEN=<YOUR_TOKEN> npm publish --verbose
-
See https://www.sei.cmu.edu/blog/versioning-with-git-tags-and-conventional-commits.
LAST_COMMIT=$(git log -1 --pretty=%B) # Last commit message LAST_TAG=$(git describe --tags --abbrev=0) # Last tag in the repo NEXT_TAG=$(python3 next_version.py ${LAST_TAG} ${LAST_COMMIT}) echo ${LAST_COMMIT} echo ${LAST_TAG} echo ${NEXT_TAG} echo Pushing new version tag ${NEXT_TAG} curl -k --request POST --header "PRIVATE-TOKEN:${TAG_TOKEN}" --url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${NEXT_TAG}&ref=main" -
See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48615.
-
See https://stackoverflow.com/questions/69507324/gitlab-ci-cd-auto-tagging-release.
-
See https://www.baeldung.com/ops/gitlab-ci-pipeline-push-changes.
-
See https://stackoverflow.com/questions/58084355/unable-to-push-git-tags-in-gitlab-ci-pipeline.
13. GitLab CI
13.1. Secrets
-
Select Settings > CICD > Variables.
GITLAB_ACCESS_TOKEN KeePassXC: GitLab - Douwe - GitLab Access Token Avatar > Preferences > Personal access tokens GITLAB_DEPLOY_TOKEN KeePassXC: GitLab - Douwe - GitLab Deploy Token Settings > Repository > Deploy tokens PAT KeePassXC: GitLab - Douwe - PAT Avatar > Preferences > Personal access tokens PROJECT_ACCESS_TOKEN KeePassXC: GitLab - Douwe - Project Access Token Settings > Access Tokens
14. Linux
cd ~/gitlab git clone --recurse-submodules http://gitlab.grendelgames.com/alex/cicd-sandbox.git