DevOps tutorials commons

DevOps tutorials commons

This section contains a common parts of DevOps tutorials like GitLab users and projects layouts.

Scroll to:



Users layout

Name Username Email
Tutorial Owner tutorial
Tutorial Master tutorial_master
Tutorial Developer tutorial_developer
Tutorial Guest tutorial_guest
Tutorial Reporter tutorial_reporter
Jenkins Technical Master tutorial_jenkins_master

The password for all user below is welcome1

Green colored users are addiotional required for some tutorials.

Adding users

Login as root user and go to administration panel (1). Open Users tab and click  New User(2,3). Fill the user Account information(4) and click Create User(5).

Edit each user to set password to welcome1 and increase Projects limit to 100 for tutorial user.

Projects layout

All tutorial projects are located under better-coding-tutorials projects group with tutotial user as owner.

Creating better-coding-tutorials projects group

Login as tutorial user. Open Groups(1) tab and click New Group(2). Fill Group path(3) and Description(4). Select Public Visibility Level(5) and click Create group(6).

Adding tutorial users to better-coding-tutorials projects group

Login as tutorial user. Open Groups(1) tab, click Edit Group(2) and select Members(3) tab. Add users to group (4,5,6,7).

More about permissions you can find here.

Create basic project


Login as tutorial user. Open Projects(1) tab and click New Project(2). Change project path group(3) and repository name(4). Add some description(5) and click Create project(6).

Git initial commit

Git global setup

git config --global "Tutorial Owner"
git config --global ""

Create a new repository

git add
git commit -m "add README"
git push -u origin master

Branch protection

Login as tutorial user. Open Projects(1) tab and click at target project(2). Go Settings(3) -> Protected Branches(4). Select Branch(5) and click Protect(6). Protected branches are displayed in Already Protected(7) section. Click Unprotect(8), if you don’t want to the branch was protected.

Creating pull request

Login to GitLab as tutorial_developer. Select Projects(1) tab and open the target project(2). Click branches tab (3). Choose branch to merge and click  Merge Request(4). Fill pull request fields(5,6,7),  assign to tutorial_master(8) and click Submit merge request(9).

Accepting/declining pull request

Login to GitLab as tutorial_master. Go to Merge Requests tab(1) and open an interested pull request(2). Click Accept Merge Request(3). You can also decline(close) the pull request or return it with comment to developer by changing Assignee(4).





Users layout


The password for all user below is welcome1

Creating job

Login as jenkins user. Click New Item(1). Enter new Item name(2) and choose project type (3). Click OK(4) to save the job and go to configuration screen.


Plugin installation

Login as jenkins user. Click Manage Jenkins(1) and go Manage Plugins(2) section. Go to Available tab (3), find(4) and select(5) chosen plugin, then Install without restart(6).


Configure GitLab credentials

Open GitLab console and login as tutorial_jenkins_master. Go to Profile Settings -> Account (1,2) and copy Private token(3).


Open Jenkins console and login as jenkins user. Go Credentials -> System -> Add domain (1,2,3). Enter tutorial-gitlab-credentials as Domain name(4) and click OK(5). Click Add Credentials on the next screen(6). Set tutorial_jenkins_master as Username(7), welcome1 as Password(8) and click OK (9).

Add another credentials to tutorial-gitlab-credentials domain(10). This time set Kind to Secret text(11) and paste your Private token into Secret(12). Enter PrivateToken_tutorial_jenkins_master as ID(13) and click OK(14).

Configure GitLab plugin

Login as jenkins user and open Manage Jenkins -> Configure System(1,2).  Fill GitLab section(3,4,5,6,7), Test your connection(8) and Save(9).

Job integration – GitLab

Ensure you have configured GitLab plugin.

Source Code Management

Open target job Configuration screen, scroll to Source Code Management section and select Git(1). Set Repository URL(2),  Credentials(3) and clear Branches to build(4). Click Add(5) and choose Clean before checkout(6). Save(7) your job.


Build Triggers

Open target job Configuration screen, scroll to Build triggers section and select Build when a change is pushed to GitLab.(1). Copy GitLab CI Service URL(2).

Login to GitLab as tutorial_jenkins_master. Go to target project (3,4) -> Settings (5) -> Webhooks(6) and paste URL(7) copied in (2). Add Webhook(8) and Test it(9,10). For test purposes you have to preform initial commit.

Common build steps

Open target job Configuration screen and scroll to Build section. Click Add build step and choose Execute shell.

Simple build step

This shell script produces result artifact build/artifacts/result.txt as concatenation of all *.txt files.

mkdir -p build/artifacts
rm -rf build/artifacts/*
cat *.txt > build/artifacts/result.txt

Simple test step

This shell script checks that the result artifact’s number of words is even.

totalWords=`cat build/artifacts/result.txt | wc -w`
code=`expr $totalWords % 2`
exit $code



0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments