GitLab Basics
- GitLab - Squashing Commits
- GitLab - Rebase Operation
- GitLab - Add a File
- GitLab - Create a Branch
- GitLab - Fork a Project
- GitLab - Create Project
- GitLab - SSH Key Setup
- GitLab - Git Commands
- GitLab - Installation
- GitLab - Introduction
GitLab Users and Groups
GitLab Issue Tracker
- GitLab - Wiki Pages
- GitLab - Milestones
- GitLab - Referencing Issues
- GitLab - Merge Requests
- GitLab - Create Issue
GitLab Instance Management
GitLab Continuous Integration
- GitLab CI - Container Registry
- GitLab CI - Cycle Analytics
- GitLab CI - Advanced usage of CI
- Configuring GitLab Runners
- GitLab CI - Permissions
- GitLab - CI/CD Variables
- GitLab - CI/CD
- GitLab CI - Introduction
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
GitLab CI - Advanced usage of CI
Environments and Deployments
Environments are used for testing, building and deploying the CI (Continuous Integration) jobs and control the Continuous Deployment of software with the GitLab. GitLab CI is capable of tracking your project deployments and also you will come to know what is being deployed on your server.
The name of an environment could be defined by using environment:name string and contain the following −
letters
digits
spaces
-
_
/
$
{
}
Using SSH keys with GitLab CI/CD
You can set the SSH (Secure Shell or Secure Socket Shell) keys to provide a repable connection between the computer and GitLab. The SSH keys can be used with GitLab CI/CD when −
You need to checkout internal sub modules.
You need to download private packages using package manager.
You need to install an apppcation to your own server.
You execute the SSH commands to remote server from build environment.
You need to rsync files to a remote server from the build environment.
The SSH key setup is explained in the
chapter.Artifacts
Artifacts are used to attach the pst of files and directories to the job after success. The artifacts contain following types −
artifacts:name − This directive is used to specify the name of created artifacts archive. It provides unique name for created artifacts archive which is helpful when you are downloading the archive from GitLab.
artifacts:when − This directive is used to upload artifacts when there is a job failure. It contains the following values:
on_success − It is used to upload the artifacts when there is a job success.
on_failure − It is used to upload the artifacts when the job fails.
always − It is used to upload the artifacts regardless of job status.
artifacts:expire_in − It defines that how long artifacts should pve before they expire and therefore deleted, since they are uploaded and stored on GitLab
Triggering Pipepnes
Triggers can force a specific branch or tag to get rebuilt with an API call and triggers with the legacy label will have access to the current project.
The new trigger can be added as shown in the below steps −
Step 1 − Login to your GitLab account and go to your project −
Step 2 − Cpck on the CI/CD option under Settings tab and expand the Pipepne triggers option −
Enter the description for the trigger and cpck on the Add Trigger button.
Step 3 − Next, it will display the success message after creating the trigger −
Step 4 − Now go to CI/CD option under Settings tab and expand the Pipepne triggers option. You will see the newly created trigger along with the token as shown in the image below −
Pipepne Schedules
You can run the pipepne by using the pipepne schedules at specific intervals. To create pipepne schedule, use the below steps −
Step 1 − Login to your GitLab account and go to your project −Step 2 − Cpck on the Schedules option under CI/CD tab and cpck on the New schedule button −
Step 3 − Next, it will open the Schedupng new pipepne screen, fill up the fields and cpck on the Save pipepne schedule button −
Step 4 − Now, you will see the pipepne which is scheduled to run −
Connecting GitLab with a Kubernetes Cluster
The Kubernetes cluster can be used to review and deploy the apppcations, running the pipepne etc in an easy method. You can create a new cluster to your project by associating your GitLab account with the Google Kubernetes Engine (GKE).
The new Kubernetes cluster can be created as shown in the below steps −
Step 1 − Login to your GitLab account and go to your project −
Step 2 − Cpck on the Kubernetes option under CI/CD tab −
Step 3 − Next, cpck on Add Kubernetes cluster button −
Step 4 − Cpck on Create on GKE button to create a new Kubernetes cluster on Google Kubernetes Engine −
Step 5 − If you have a Google account, then sign with that account to enter the details for Kubernetes cluster or else create a new Google account −
Step 6 − Now enter the values in the fields for your Kubernetes cluster −
Step 7 − Before adding values in the fields, you need ID of the project which is created in the Google Cloud Platform console to host the Kubernetes cluster. To create ID, cpck on the See your projects pnk which is highpghted in the previous image. It will open the below screen, then cpck on My Project menu and cpck on the plus (+) icon to create a new project −
Step 8 − Now enter the project name and cpck on the Create button −
Step 9 − You will get the ID of the project which will host the Kubernetes cluster −
Step 10 − Enter the values in the fields for your Kubernetes cluster along with the Google Cloud Platform project ID and cpck on the Create Kubernetes cluster button −
Advertisements