This is an old revision of the document!


Laboratorul 02.

Exercises:

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

  1. shortcut name: DevOps Summer School
  2. 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 => 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: 10.220.74.82
				- 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

  1. username: student<number>
  2. password: student

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

6. Go to Gitlab

  1. username: TGI
  2. 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

  1. you can do that directly from the Gitlab interface
  1. —-Commands to do that in terminal
  2. – git checkout student<number>
  3. – vim Jenkinsfile
  4. – git add Jenkinsfile
  5. – git commit -m ”<commit_message>”
  6. – git push origin student<number>
  7. —-

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”

  1. in the new stage, you will run 2 commands
  2. the first one is “pwd”, we want to see where we are
  3. 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
  4. 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

  1. 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

  1. update the Jenkinsfile again
  2. 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” :)
  3. 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!

  1. “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.1626880702.txt.gz · Last modified: 2021/07/21 18:18 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