Inginerie Software Specifica Automobilelor Continuous ...conti/lab_materials...Continuous Delivery...
Transcript of Inginerie Software Specifica Automobilelor Continuous ...conti/lab_materials...Continuous Delivery...
-
Bitte decken Sie die schraffierte Fläche mit einem Bild ab.
Please cover the shaded area with a picture.
(24,4 x 7,6 cm)
Continuous Delivery – Seminary PartISSA
ISSA
Inginerie Software Specifica Automobilelor
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› If the meeting doesn’t start, please use a browser. Copy the link in the browser.
› Lab 4 – Friday 23-Oct-2020 - 16:00-18:00 - Join Microsoft Teams Meeting
› https://teams.microsoft.com/l/meetup-join/19%3ameeting_MTNlNmMyMzQtZDM2MS00YjdlLThmNjItNDUzYjliOGZlNzRh%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7d
› Lab 4 – Friday 23-Oct-2020 - 18:00-20:00 - Join Microsoft Teams Meeting
› https://teams.microsoft.com/l/meetup-join/19%3ameeting_Y2Y4ZDRiZGUtNTQ3NS00OWU3LThmMWMtZjJhMWJkM2FhNjEy%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7d
› Lab 4 – Tuesday 27-Oct-2020 - 16:00-18:00 - Join Microsoft Teams Meeting
› https://teams.microsoft.com/l/meetup-join/19%3ameeting_NzM5MmI1ZmMtYzZmZS00M2NlLWIyNDktZTI5OGY1MjAzZmVi%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7d
› Lab 4 – Tuesday 27-Oct-2020 - 18:00-20:00 - Join Microsoft Teams Meeting
› https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDhjYTA4MzktNTVjYS00Y2Y3LTg0YjYtODkxZjM0NTZiNDMz%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-
e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7d
Meeting room:
21 October 2020
2© Continental AG
https://teams.microsoft.com/l/meetup-join/19%3ameeting_MTNlNmMyMzQtZDM2MS00YjdlLThmNjItNDUzYjliOGZlNzRh%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_MTNlNmMyMzQtZDM2MS00YjdlLThmNjItNDUzYjliOGZlNzRh%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_Y2Y4ZDRiZGUtNTQ3NS00OWU3LThmMWMtZjJhMWJkM2FhNjEy%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_Y2Y4ZDRiZGUtNTQ3NS00OWU3LThmMWMtZjJhMWJkM2FhNjEy%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_NzM5MmI1ZmMtYzZmZS00M2NlLWIyNDktZTI5OGY1MjAzZmVi%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_NzM5MmI1ZmMtYzZmZS00M2NlLWIyNDktZTI5OGY1MjAzZmVi%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_MDhjYTA4MzktNTVjYS00Y2Y3LTg0YjYtODkxZjM0NTZiNDMz%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7dhttps://teams.microsoft.com/l/meetup-join/19%3ameeting_MDhjYTA4MzktNTVjYS00Y2Y3LTg0YjYtODkxZjM0NTZiNDMz%40thread.v2/0?context=%7b%22Tid%22%3a%228d4b558f-7b2e-40ba-ad1f-e04d79e6265a%22%2c%22Oid%22%3a%225262dfa8-8c84-4871-b8f2-5addb51b0a11%22%7d
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› You are going to act as a true Software Engineer in a DevOps environment (“DevOps Engineer” – in marketing terms)
› Based on a given architecture you are going to juggle between all the DevOps main functional areas (System Administration, Infrastructure, Platform and Site Reliability
Engineering) and set-up from scratch the necessary tools and a Continuous Delivery
System on top.
Concept
21 October 2020
3© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
Arch – Infrastructure
21 October 2020
4© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
Arch – Infra – Toolchain
21 October 2020
5© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Purpose: install and set-up the necessary tools
› Points: 1 / 4
1st Part: System Administration Ops (SysOps)
21 October 2020
6© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Python 3.x & Git installed
› https://www.python.org/downloads/
› https://git-scm.com/downloads
› Gitea: https://github.com/go-gitea/gitea/
› Windows: https://github.com/go-gitea/gitea/releases/download/v1.9.4/gitea-1.9.4-windows-4.0-386.exe
› Linux: https://github.com/go-gitea/gitea/releases/download/v1.9.4/gitea-1.9.4-linux-386
› XAMPP: https://www.apachefriends.org/
› Windows: https://www.apachefriends.org/xampp-files/7.3.10/xampp-windows-x64-7.3.10-0-VC15-installer.exe
› Linux: https://www.apachefriends.org/xampp-files/7.3.10/xampp-linux-x64-7.3.10-0-installer.run
› Jenkins: https://jenkins.io/
› Windows: https://jenkins.io/download/thank-you-downloading-windows-installer-stable
› Linux: https://pkg.jenkins.io/debian-stable
Resources
21 October 2020
7© Continental AG
https://www.python.org/downloads/https://git-scm.com/downloadshttps://github.com/go-gitea/gitea/https://github.com/go-gitea/gitea/releases/download/v1.9.4/gitea-1.9.4-windows-4.0-386.exehttps://github.com/go-gitea/gitea/releases/download/v1.9.4/gitea-1.9.4-linux-386https://www.apachefriends.org/https://www.apachefriends.org/xampp-files/7.3.10/xampp-windows-x64-7.3.10-0-VC15-installer.exehttps://www.apachefriends.org/xampp-files/7.3.10/xampp-linux-x64-7.3.10-0-installer.runhttps://jenkins.io/https://jenkins.io/download/thank-you-downloading-windows-installer-stablehttps://pkg.jenkins.io/debian-stable
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Create the following directory structure either in your main Drive on Windows or in your user home space on Linux
D:\cd-seminary
├───code
└───infra
├───gitea
├───jenkins
└───xampp
File System Layout
21 October 2020
8© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
XAMPP Installation
Please follow the same steps to avoid issues!Install only selected applications like in the print screen!
21 October 2020
9© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Start the Apache Web Server & MySQL Database
› Now access MySQL via the phpMyAdmin interface
› A new tab into your default browser should be open on http://localhost/phpmyadmin/
XAMPP Bring-up
21 October 2020
10© Continental AG
http://localhost/phpmyadmin/
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› A new database has to be created in order to be populated with tables by the Gitea server.
› A separate user has to be created to be used by the Gitea server
MySQL set-up
21 October 2020
11© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› username: gitea | password: gitea
21 October 2020
12© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Copy the Gitea binary (.exe) into cd-seminary/infra/gitea and run it.
› After the initialization, Gitea should be up on localhost:3000, open the page in a browser.
› Click on either one of the Register or Sign In buttons for the Initial Configuration
› Proceed by filling the fields as shown in the next pages
Gitea Bring-up
21 October 2020
13© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor 21 October 2020
14© Continental AG
Part 1 / 3
Part 2 / 3
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor 21 October 2020
15© Continental AG
Part 3 / 3
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Run the Jenkins binary and proceed to install it as shown in the next images.
› During Jenkins installation, you can test the port. If it is already used, please deactivate that application from services.msc
› After the installation ends. Jenkins will be available at localhost:8080
Jenkins Bring-up
21 October 2020
16© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Get the admin password from the specified path. To be sure/visible, use File Explorer.
21 October 2020
17© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor 21 October 2020
18© Continental AG
• Keep the defaults on the next step
• Save & Finish
• Jenkins should be up and you
should be logged in with the
‘jenkins’ account
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Purpose: Set-up the needed configurations that link the tools in between.
› Points: 0.5 / 4
2nd Part: Infrastructure Ops (InfraOps)
21 October 2020
19© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Access Jenkins pluginManager service and check for Gitea and install it. http://localhost:8080/pluginManager/available
Install Gitea Jenkins plug-in
21 October 2020
20© Continental AG
http://localhost:8080/pluginManager/available
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Access http://localhost:8080/safeRestart
› Click on Yes
› Wait for the restart
› Log in again (user: jenkins, password: jenkins)
Perform a Jenkins Safe Restart
21 October 2020
21© Continental AG
http://localhost:8080/safeRestart
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› This is done in the system configuration page http://localhost:8080/configure
› Scroll down to the Gitea Server section and Add a new one and then click on Save
› If Jenkins can access
the server, it should
display the Gitea Version
Add Gitea server in Jenkins global scope
21 October 2020
22© Continental AG
http://localhost:8080/configure
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› We are going to set-up a webhook were Gitea will perform HTTP POST requests each time a new event happens globally.
› This is done on the Gitea side, in site admins settings, in the Webhooks tab. Here is the direct link to it http://localhost:3000/admin/hooks
Set-up the Gitea to Jenkins webhook
21 October 2020
23© Continental AG
http://localhost:3000/admin/hooks
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor 21 October 2020
24© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Purpose: set-up the Continuous Delivery environment in Jenkins
› Points: 0.5 / 4
3rd Part: Platform Ops
21 October 2020
25© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› In the Jenkins home page, click on New Item
› Then proceed to create a Gitea Organization folder
Create the Gitea organization folder using the plugin
21 October 2020
26© Continental AG
1 / 5
2 / 5
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› You will prompted to the Job configuration Page, don’t save yet.
21 October 2020
27© Continental AG
3 / 5
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Also you have to add the credentials that have access to the specified organization (Owner)
› These credentials are going to be available only for cd-gitea-ISSA
21 October 2020
28© Continental AG
4 / 5
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Go down into the job configuration page and update the following configurations and Save
21 October 2020
29© Continental AG
5 / 5
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Purpose: set-up the production environment, software development environment and the required configuration management particularities
› Points: 1 / 4
4th Part: Site Reliability Engineering Ops (SREOps)
21 October 2020
30© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Access Gitea homepage http://localhost:3000/ and proceed creating your ISSA organization
Create a new Gitea organization
21 October 2020
31© Continental AG
http://localhost:3000/
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› From your ISSA’s organization dashboard page http://localhost:3000/org/ISSA/dashboard, proceed creating your project’s Git repository
Create your project Git repository
21 October 2020
32© Continental AG
http://localhost:3000/org/ISSA/dashboard
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor 21 October 2020
33© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› From your repository page http://localhost:3000/ISSA/project. Via the New File or Upload File
› The New File will prompt your to a page where you can specify the file name (or relative path) and edit it on the spot.
› The Upload File will prompt your to a page where you can drag and drop files to be committed
How to commit a new file(s)
21 October 2020
34© Continental AG
http://localhost:3000/ISSA/project
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› From your repository page http://localhost:3000/ISSA/project. Navigate to the desired file to be edited. README.md for example
http://localhost:3000/ISSA/project/src/branch/master/README.md and click on the edit
button.
How to edit a committed file
21 October 2020
35© Continental AG
http://localhost:3000/ISSA/projecthttp://localhost:3000/ISSA/project/src/branch/master/README.md
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Commit a new file called Jenkinsfile
› It should have only one line
› sleep 10
› After that go to http://localhost:8080/job/cd-issa-gitea/, the Gitea Jenkins Project that you created at the 3rd Step.
› From the menu of the left, click on Scan Gitea Organization Now.
› Now the ISSA/project repository should have it’s own project folder with it’s own Jenkins job for the master branch that only sleeps 10 seconds at each new change / commit.
Initial Jenkinsfile
21 October 2020
36© Continental AG
http://localhost:8080/job/cd-issa-gitea/
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Go to https://github.com/whymex/issa-cd-fii and port the following files, keeping the directory structure in your Gitea repository
› dev-requirements.txt
› requirements.txt
› project/__init__.py
› project/project.py
› Commit each file individually. 4 Jenkins builds (that still do nothing) should get triggered.
Add your project source code
21 October 2020
37© Continental AG
https://github.com/whymex/issa-cd-fii
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Edit the Jenkinsfile from your Gitea repository and copy paste the code from https://github.com/whymex/issa-cd-fii/blob/master/Jenkinsfile
› Observe what’s happening in Jenkins and check the Console Output
› Hint: In case of error, check system environment variable for python
› Observe what happened in Gitea after the pipeline execution
Jenkinsfile code
21 October 2020
38© Continental AG
https://github.com/whymex/issa-cd-fii/blob/master/Jenkinsfile
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› Fix the variables naming from project/project.py by replacing x and y with first_numberand second_number
› Commit the changes and analyze the Jenkins pipeline execution
Fix the code style and make the pipeline succeed
21 October 2020
39© Continental AG
-
Continuous Delivery – Seminary Part
Inginerie Software Specifica Automobilelor
› The majority of the opensource project have inside their README.md a badge like icon that displays the build / pipeline execution status.
› Example: https://github.com/BurntSushi/ripgrep
› Hints:
› Use the following plug-in and check it’s documentation how to set it up and add the necessary links to your README.md https://github.com/jenkinsci/embeddable-build-
status-plugin
› Allow anonymous users read access at Jenkins.
Exercise: Add a build badge to README.md, 1/4 Points
21 October 2020
40© Continental AG
https://github.com/BurntSushi/ripgrephttps://github.com/jenkinsci/embeddable-build-status-plugin