Hands-on session 2/2 - part 1/3


1. Login on the VM using VMWare Horizon 2. Create a desktop shortcut (right mouse click → create shortcut)

=> point to: \\robucsw111\RND\RD_EST\DevOps_Summer_School_2022
=> shortcut name: DevOps Summer School
=> try to access it

3. From the above location, copy Moba xTerm to your Desktop

=> run Moba xTerm
=> generate new SSH keys from Tools => Moba Keygen => Generate => random mouse movements
=> save public key with name "student<number>.pub" on Desktop
=> save private key with name "student<number>.ppk" on Desktop
=> convert the saved key and save it with "student<number>_conv.ppk" on Desktop

=> provide the PUBLIC generated key to us
	-> in the corresponding text file from \\robucsw111\RND\RD_EST\DevOps_Summer_School_2022 => SSH public keys

=> configure your Moba session as follows:
	- Session => SSH
		- Remote host: <VM ID from the first table>
		- Specify username: student<number>
		- Advanced SSH settings:
			- Use private key - select your "student<number>_conv.ppk" file, generated previously
		- Network settings:
			- SSH gateway jump hosts
				- Gateway:
				- Username: student<number>
				- Use SSH key - select your "student<number>_conv.ppk" file, generated previously
				- OK
=> double click on the session and you should be logged in on the "term-vm<number>" machine
	- also, the session will be stored for future connections

4. Open the “links.html” directly, it should open a new Microsoft Edge webpage

5. Go to Jenkins

=> username: student<number>
=> password: student

(if possible, remind the trainer that his account is "bcroitoru", he keeps forgetting that :D)

6. Go to Gitlab

=> username: TGI
=> password: thales<last 3 digits of TGI>
=> go to Projects -> Explore projects and search for the "Devops Example" project
=> switch to branch develop
=> add your PUBLIC SSH key from the previous steps to your account
	(from now on, you should be able to use commands without password in the terminal)
But I have better news for you, today we will only work through the Gitlab interface! :D

7. Make a new branch in Git, FROM “develop”, with “student<number>”

=> you have the "+" next to the branch name, choose "New branch"
=> set the branch name "student<number>", select "from develop" and Create it
=> switch to the new branch if this is not done automatically

-----//Commands to do that in terminal//
--- git clone <repository>
--- git checkout develop
--- git checkout -b student<number>
--- git push origin student<number>

8. Update the Jenkinsfile with your name in the “echo message” stage, commit & push

=> you can do that directly from the Gitlab interface

-----//Commands to do that in terminal//
--- git checkout student<number>
--- vim Jenkinsfile
--- git add Jenkinsfile
--- git commit -m "<commit_message>"
--- git push origin student<number>

8.1. Let's check Nexus together

9. Check what happens in Jenkins - can you see your branch there? Why do we have a running build?

9.1. Let's check Nexus together

10. Update the Jenkinsfile with a new stage “Execute extra sh commands”

=> in the new stage, you will run 2 commands
=> the first one is "pwd", we want to see where we are
=> the second one is "date" but this time we want to REDIRECT its output (how do we do that?) to a "current_date.txt" file
=> commit & push

11. Check what happens ; from the job page, we have the “Workspaces” directory… what can we find there?

12. (bonus) Update the Jenkinsfile again, with a “post” block that will archive the “*.txt” artifacts

=> check how to do that, commit & push and see if the files that match the above pattern are saved directly in the current job's page

13. (bonus) Let's play a little bit with scripting

=> update the Jenkinsfile again
=> this time, we want to do the following: after getting the date in the "current_date.txt" file (so AFTER this command), run some bash commands in the same "sh" block to REPLACE "2021" with "WOW" :)
=> the result should be the same as above, but the file should contain "WOW" instead of "2021"

14. (bonus) Only for the 1st student that gets to this point!

=> "create a merge request" from the Gitlab interface, from your branch to develop branch, and ask the trainer to approve your pull request
devops/laboratoare/02.txt · Last modified: 2022/07/27 18:01 by bogdan.croitoru
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0