This shows you the differences between two versions of the page.
devops:laboratoare:02 [2021/07/21 18:18] bogdan.croitoru |
devops:laboratoare:02 [2022/07/27 18:01] (current) bogdan.croitoru |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Laboratorul 02. ===== | + | ===== Hands-on session 2/2 - part 1/3 ===== |
- | + | **Exercises:** | |
- | + | ||
- | Exercises: | + | |
1. Login on the VM using VMWare Horizon | 1. Login on the VM using VMWare Horizon | ||
2. Create a desktop shortcut (right mouse click -> create shortcut) | 2. Create a desktop shortcut (right mouse click -> create shortcut) | ||
- | - point to: \\robucsw111\RND\RD_EST\DevOps_Summer_School | + | => point to: \\robucsw111\RND\RD_EST\DevOps_Summer_School_2022 |
- | - shortcut name: DevOps Summer School | + | => shortcut name: DevOps Summer School |
- | - try to access it | + | => try to access it |
3. From the above location, copy Moba xTerm to your Desktop | 3. From the above location, copy Moba xTerm to your Desktop | ||
=> run Moba xTerm | => run Moba xTerm | ||
Line 18: | Line 15: | ||
=> convert the saved key and save it with "student<number>_conv.ppk" on Desktop | => convert the saved key and save it with "student<number>_conv.ppk" on Desktop | ||
- | - provide the PUBLIC generated key to us | + | => provide the PUBLIC generated key to us |
- | -> in the corresponding text file from \\robucsw111\RND\RD_EST\DevOps_Summer_School => SSH public keys | + | -> in the corresponding text file from \\robucsw111\RND\RD_EST\DevOps_Summer_School_2022 => SSH public keys |
=> configure your Moba session as follows: | => configure your Moba session as follows: | ||
Line 40: | Line 37: | ||
5. Go to Jenkins | 5. Go to Jenkins | ||
- | - username: student<number> | + | => username: student<number> |
- | - password: student | + | => password: student |
(if possible, remind the trainer that his account is "bcroitoru", he keeps forgetting that :D) | (if possible, remind the trainer that his account is "bcroitoru", he keeps forgetting that :D) | ||
6. Go to Gitlab | 6. Go to Gitlab | ||
- | - username: TGI | + | => username: TGI |
- | - password: thales<last 3 digits of TGI> | + | => password: thales<last 3 digits of TGI> |
=> go to Projects -> Explore projects and search for the "Devops Example" project | => go to Projects -> Explore projects and search for the "Devops Example" project | ||
Line 61: | Line 58: | ||
=> switch to the new branch if this is not done automatically | => switch to the new branch if this is not done automatically | ||
- | -----Commands to do that in terminal | + | -----//Commands to do that in terminal// |
--- git clone <repository> | --- git clone <repository> | ||
--- git checkout develop | --- git checkout develop | ||
Line 69: | Line 66: | ||
8. Update the Jenkinsfile with your name in the "echo message" stage, commit & push | 8. Update the Jenkinsfile with your name in the "echo message" stage, commit & push | ||
- | - you can do that directly from the Gitlab interface | + | => you can do that directly from the Gitlab interface |
- | -----Commands to do that in terminal | + | -----//Commands to do that in terminal// |
--- git checkout student<number> | --- git checkout student<number> | ||
--- vim Jenkinsfile | --- vim Jenkinsfile | ||
Line 85: | Line 82: | ||
10. Update the Jenkinsfile with a new stage "Execute extra sh commands" | 10. Update the Jenkinsfile with a new stage "Execute extra sh commands" | ||
- | - in the new stage, you will run 2 commands | + | => in the new stage, you will run 2 commands |
- | - the first one is "pwd", we want to see where we are | + | => 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 | + | => 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 | + | => commit & push |
11. Check what happens ; from the job page, we have the "Workspaces" directory... what can we find there? | 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 | 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 | + | => 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 | 13. (bonus) Let's play a little bit with scripting | ||
- | - update the Jenkinsfile again | + | => 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" :) | + | => 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" | + | => 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! | 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 | + | => "create a merge request" from the Gitlab interface, from your branch to develop branch, and ask the trainer to approve your pull request |