Modify the structure of README.md

Instead of having exercises in their own separate section,
they are now part of the main topics sections.

This should make the learning process easier to follow
where users have both exercises and questions in the same
place.

In addition, added a couple of new questions & exercises
and modified existing scripts accordingly.
This commit is contained in:
abregman 2021-07-12 02:02:57 +03:00
parent dfbe979872
commit e54648d47f
12 changed files with 216 additions and 81 deletions

194
README.md
View File

@ -2,7 +2,7 @@
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :) :information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :)
:bar_chart:  There are currently **1600** questions :bar_chart:  There are currently **1571** questions
:books:  To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository :books:  To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository
@ -26,7 +26,7 @@
<td align="center"><a href="#ansible"><img src="images/ansible.png" width="75px;" height="75px;" alt="ansible"/><br /><b>Ansible</b></a></td> <td align="center"><a href="#ansible"><img src="images/ansible.png" width="75px;" height="75px;" alt="ansible"/><br /><b>Ansible</b></a></td>
<td align="center"><a href="#Network"><img src="images/network.png" width="80x;" height="75px;" alt="Network"/><br /><b>Network</b></a></td> <td align="center"><a href="#Network"><img src="images/network.png" width="80x;" height="75px;" alt="Network"/><br /><b>Network</b></a></td>
<td align="center"><a href="#linux"><img src="images/linux.png" width="75x;" height="75px;" alt="Linux"/><br /><b>Linux</b></a></td> <td align="center"><a href="#linux"><img src="images/linux.png" width="75x;" height="75px;" alt="Linux"/><br /><b>Linux</b></a></td>
<td align="center"><a href="#terraform"><img src="images/terraform.png" width="70px;" height="75px;" alt="Terraform"/><br /><b>Terraform</b></a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="#programming"><img src="images/programming.png" width="75px;" height="75px;" alt="programming"/><br /><b>Programming</b></a></td> <td align="center"><a href="#programming"><img src="images/programming.png" width="75px;" height="75px;" alt="programming"/><br /><b>Programming</b></a></td>
@ -35,7 +35,6 @@
<td align="center"><a href="#scripts"><img src="images/bash.png" width="70px;" height="75px;" alt="Bash"/><br /><b>Scripts</b></a></td> <td align="center"><a href="#scripts"><img src="images/bash.png" width="70px;" height="75px;" alt="Bash"/><br /><b>Scripts</b></a></td>
<td align="center"><a href="#kubernetes"><img src="images/kubernetes.png" width="75px;" height="75px;" alt="kubernetes"/><br /><b>Kubernetes</b></a></td> <td align="center"><a href="#kubernetes"><img src="images/kubernetes.png" width="75px;" height="75px;" alt="kubernetes"/><br /><b>Kubernetes</b></a></td>
<td align="center"><a href="#prometheus"><img src="images/prometheus.png" width="75px;" height="75px;" alt="Prometheus"/><br /><b>Prometheus</b></a></td> <td align="center"><a href="#prometheus"><img src="images/prometheus.png" width="75px;" height="75px;" alt="Prometheus"/><br /><b>Prometheus</b></a></td>
<td align="center"><a href="#mongo"><img src="images/mongo.png" width="75px;" height="75px;" alt="Mongo"/><br /><b>Mongo</b></a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="#cloud"><img src="images/cloud.png" width="110px;" height="75px;" alt="Cloud"/><br /><b>Cloud</b></a></td> <td align="center"><a href="#cloud"><img src="images/cloud.png" width="110px;" height="75px;" alt="Cloud"/><br /><b>Cloud</b></a></td>
@ -44,16 +43,14 @@
<td align="center"><a href="#gcp"><img src="images/googlecloud.png" width="80px;" height="75px;" alt="Google Cloud Platform"/><br /><b>Google Cloud Platform</b></a></td> <td align="center"><a href="#gcp"><img src="images/googlecloud.png" width="80px;" height="75px;" alt="Google Cloud Platform"/><br /><b>Google Cloud Platform</b></a></td>
<td align="center"><a href="#openstack"><img src="images/openstack.png" width="75px;" height="75px;" alt="openstack"/><br /><b>OpenStack</b></a></td> <td align="center"><a href="#openstack"><img src="images/openstack.png" width="75px;" height="75px;" alt="openstack"/><br /><b>OpenStack</b></a></td>
<td align="center"><a href="#security"><img src="images/security.png" width="75px;" height="75px;" alt="security"/><br /><b>Security</b></a></td> <td align="center"><a href="#security"><img src="images/security.png" width="75px;" height="75px;" alt="security"/><br /><b>Security</b></a></td>
<td align="center"><a href="#puppet"><img src="images/puppet.png" width="75px;" height="75px;" alt="puppet"/><br /><b>Puppet</b></a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="#operating-system"><img src="images/os.png" width="75px;" height="75px;" alt="Operating System"/><br /><b>Operating System</b></a></td>
<td align="center"><a href="#monitoring"><img src="images/monitoring.png" width="75px;" height="75px;" alt="Monitoring"/><br /><b>Monitoring</b></a></td> <td align="center"><a href="#monitoring"><img src="images/monitoring.png" width="75px;" height="75px;" alt="Monitoring"/><br /><b>Monitoring</b></a></td>
<td align="center"><a href="#elastic"><img src="images/elastic.png" width="110px;" height="75px;" alt="Elastic"/><br /><b>Elastic</b></a></td> <td align="center"><a href="#elastic"><img src="images/elastic.png" width="110px;" height="75px;" alt="Elastic"/><br /><b>Elastic</b></a></td>
<td align="center"><a href="#virtualization"><img src="images/virtualization.png" width="75px;" height="75px;" alt="Virtualization"/><br /><b>Virtualization</b></a></td> <td align="center"><a href="#virtualization"><img src="images/virtualization.png" width="75px;" height="75px;" alt="Virtualization"/><br /><b>Virtualization</b></a></td>
<td align="center"><a href="#dns"><img src="images/dns.png" width="75px;" height="75px;" alt="DNS"/><br /><b>DNS</b></a></td> <td align="center"><a href="#dns"><img src="images/dns.png" width="75px;" height="75px;" alt="DNS"/><br /><b>DNS</b></a></td>
<td align="center"><a href="#operating-system"><img src="images/os.png" width="75px;" height="75px;" alt="Operating System"/><br /><b>Operating System</b></a></td> <td align="center"><a href="#Misc"><img src="images/general.png" width="110px;" height="75px;" alt="Misc"/><br /><b>Misc</b></a></td>
<td align="center"><a href="#distributed"><img src="images/distributed.png" width="110px;" height="75px;" alt="Distributed"/><br /><b>Distributed</b></a></td>
<td align="center"><a href="#general"><img src="images/general.png" width="110px;" height="75px;" alt="General"/><br /><b>General</b></a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="#testing"><img src="images/testing.png" width="75px;" height="75px;" alt="Testing"/><br /><b>Testing</b></a></td> <td align="center"><a href="#testing"><img src="images/testing.png" width="75px;" height="75px;" alt="Testing"/><br /><b>Testing</b></a></td>
@ -62,7 +59,6 @@
<td align="center"><a href="#system-design"><img src="images/design.png" width="110px;" height="75px;" alt="Design"/><br /><b>System Design</b></a></td> <td align="center"><a href="#system-design"><img src="images/design.png" width="110px;" height="75px;" alt="Design"/><br /><b>System Design</b></a></td>
<td align="center"><a href="#hardware"><img src="images/hardware.png" width="110px;" height="75px;" alt="Hardware"/><br /><b>Hardware</b></a></td> <td align="center"><a href="#hardware"><img src="images/hardware.png" width="110px;" height="75px;" alt="Hardware"/><br /><b>Hardware</b></a></td>
<td align="center"><a href="#big-data"><img src="images/big-data.png" width="110px;" height="75px;" alt="Big Data"/><br /><b>Big Data</b></a></td> <td align="center"><a href="#big-data"><img src="images/big-data.png" width="110px;" height="75px;" alt="Big Data"/><br /><b>Big Data</b></a></td>
<td align="center"><a href="#questions-you-ask"><img src="images/you.png" width="110px;" height="75px;" alt="you"/><br /><b>Questions you ask</b></a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="#certificates"><img src="images/certificates.png" width="75px;" height="75px;" alt="Certificates"/><br /><b>Certificates</b></a></td> <td align="center"><a href="#certificates"><img src="images/certificates.png" width="75px;" height="75px;" alt="Certificates"/><br /><b>Certificates</b></a></td>
@ -71,7 +67,13 @@
<td align="center"><a href="#openshift"><img src="images/openshift.png" width="75px;" height="75px;" alt="OpenShift"/><br /><b>OpenShift</b></a></td> <td align="center"><a href="#openshift"><img src="images/openshift.png" width="75px;" height="75px;" alt="OpenShift"/><br /><b>OpenShift</b></a></td>
<td align="center"><a href="#storage"><img src="images/storage.png" width="75px;" height="75px;" alt="Storage"/><br /><b>Storage</b></a></td> <td align="center"><a href="#storage"><img src="images/storage.png" width="75px;" height="75px;" alt="Storage"/><br /><b>Storage</b></a></td>
<td align="center"><a href="#HR"><img src="images/HR.png" width="110px;" height="75px;" alt="HR"/><br /><b>HR</b></a></td> <td align="center"><a href="#HR"><img src="images/HR.png" width="110px;" height="75px;" alt="HR"/><br /><b>HR</b></a></td>
<td align="center"><a href="#exercises"><img src="images/exercises.png" width="110px;" height="75px;" alt="Exercises"/><br /><b>Exercises</b></a></td> </tr>
<tr>
<td align="center"><a href="#terraform"><img src="images/terraform.png" width="70px;" height="75px;" alt="Terraform"/><br /><b>Terraform</b></a></td>
<td align="center"><a href="#mongo"><img src="images/mongo.png" width="75px;" height="75px;" alt="Mongo"/><br /><b>Mongo</b></a></td>
<td align="center"><a href="#puppet"><img src="images/puppet.png" width="75px;" height="75px;" alt="puppet"/><br /><b>Puppet</b></a></td>
<td align="center"><a href="#distributed"><img src="images/distributed.png" width="110px;" height="75px;" alt="Distributed"/><br /><b>Distributed</b></a></td>
<td align="center"><a href="#questions-you-ask"><img src="images/you.png" width="110px;" height="75px;" alt="you"/><br /><b>Questions you can ask</b></a></td>
</tr> </tr>
</table> </table>
</center> </center>
@ -81,6 +83,14 @@
## DevOps ## DevOps
### DevOps Exercises
|Name|Topic|Objective & Instructions|Solution|Comments|
|--------|--------|------|----|----|
| Set up a CI pipeline | CI | [Exercise](exercises/devops/ci_for_open_source_project.md) | | |
### DevOps Self Assessment
<details> <details>
<summary>What is DevOps?</summary><br><b> <summary>What is DevOps?</summary><br><b>
@ -581,6 +591,15 @@ Read more about it [here](https://sre.google/sre-book/introduction)
## Jenkins ## Jenkins
### Jenkins Exercises
|Name|Topic|Objective & Instructions|Solution|Comments|
|--------|--------|------|----|----|
| Remove Jobs | Scripts - Jobs | [Exercise](exercises/jenkins/remove_jobs.md) | [Solution](exercises/jenkins/solutions/remove_jobs_solution.groovy) | |
| Remove Builds | Scripts - Builds | [Exercise](exercises/jenkins/remove_builds.md) | [Solution](exercises/jenkins/solutions/remove_builds_solution.groovy) | |
### Jenkins Self Assessment
<details> <details>
<summary>What is Jenkins? What have you used it for?</summary><br><b> <summary>What is Jenkins? What have you used it for?</summary><br><b>
@ -876,8 +895,8 @@ There can be several reasons for that. One of them is lack of policy. To solve t
<details> <details>
<summary>What should you use to: <summary>What should you use to:
* Grant access between two services/resources? - Grant access between two services/resources?
* Grant user access to resources/services?</summary><br><b> - Grant user access to resources/services?</summary><br><b>
* Role * Role
* Policy * Policy
@ -994,7 +1013,8 @@ False. Charges are being made when the code is executed.
- R, Swift, Rust, Kotlin - R, Swift, Rust, Kotlin
- Python, Ruby, Go - Python, Ruby, Go
- Python, Ruby, PHP</summary><br><b> - Python, Ruby, PHP
</summary><br><b>
- Python, Ruby, Go - Python, Ruby, Go
</b></details> </b></details>
@ -1058,9 +1078,9 @@ True
<details> <details>
<summary>Explain the following: <summary>Explain the following:
* Object Lifecycles - Object Lifecycles
* Object Sharing - Object Sharing
* Object Versioning</summary><br><b> - Object Versioning</summary><br><b>
* Object Lifecycles - Transfer objects between storage classes based on defined rules of time periods * Object Lifecycles - Transfer objects between storage classes based on defined rules of time periods
* Object Sharing - Share objects via a URL link * Object Sharing - Share objects via a URL link
@ -1799,9 +1819,9 @@ Read more about it [here](https://aws.amazon.com/sns)
<details> <details>
<summary>Explain the following in regards to SNS: <summary>Explain the following in regards to SNS:
* Topics - Topics
* Subscribers - Subscribers
* Publishers</summary><br><b> - Publishers</summary><br><b>
* Topics - used for grouping multiple endpoints * Topics - used for grouping multiple endpoints
* Subscribers - the endpoints where topics send messages to * Subscribers - the endpoints where topics send messages to
@ -1878,12 +1898,13 @@ Learn more [here](https://aws.amazon.com/partners/consulting)
<details> <details>
<summary>Which of the following are AWS accounts types (and are sorted by order)? <summary>Which of the following are AWS accounts types (and are sorted by order)?
* Basic, Developer, Business, Enterprise - Basic, Developer, Business, Enterprise
* Newbie, Intermediate, Pro, Enterprise - Newbie, Intermediate, Pro, Enterprise
* Developer, Basic, Business, Enterprise - Developer, Basic, Business, Enterprise
* Beginner, Pro, Intermediate Enterprise</summary><br><b> - Beginner, Pro, Intermediate Enterprise
</summary><br><b>
* Basic, Developer, Business, Enterprise - Basic, Developer, Business, Enterprise
</b></details> </b></details>
<details> <details>
@ -2489,6 +2510,14 @@ Read more [here](https://www.globalsign.com/en/blog/what-is-hsts-and-how-do-i-us
## Linux ## Linux
#### Linux Master Application
A completely free application for testing your knowledge on Linux
<a href="https://play.google.com/store/apps/details?id=com.codingshell.linuxmaster"><img src="images/linux_master.jpeg"/></a>
### Linux Self Assessment
<details> <details>
<summary>What is your experience with Linux?</summary><br><b> <summary>What is your experience with Linux?</summary><br><b>
@ -2741,9 +2770,9 @@ Its a bit that only allows the owner or the root user to delete or modify the fi
<details> <details>
<summary>What the following commands do? <summary>What the following commands do?
* chmod - chmod
* chown - chown
* chgrp</summary><br><b> - chgrp</summary><br><b>
* chmod - changes access permissions to files system objects * chmod - changes access permissions to files system objects
* chown - changes the owner of file system files and directories * chown - changes the owner of file system files and directories
@ -3085,8 +3114,8 @@ It means that the key of the remote host was changed and doesn't match the one t
<details> <details>
<summary>What each of the following matches <summary>What each of the following matches
* ? - ?
* *</summary><br><b> - *</summary><br><b>
* The ? matches any single character * The ? matches any single character
* The * matches zero or more characters * The * matches zero or more characters
@ -4175,12 +4204,6 @@ MemAvailable - The amount of available memory for new workloads (without pushing
GPL v2 GPL v2
</b></details> </b></details>
#### Linux Master Application
A completely free application for testing your knowledge on Linux
<a href="https://play.google.com/store/apps/details?id=com.codingshell.linuxmaster"><img src="images/linux_master.jpeg"/></a>
## Operating System ## Operating System
<details> <details>
@ -4943,6 +4966,15 @@ The Terraform Registry provides a centralized location for official and communit
## Containers ## Containers
### Containers Exercises
|Name|Topic|Objective & Instructions|Solution|Comments|
|--------|--------|------|----|----|
|My First Dockerfile|Dockerfile|[Link](exercises/write_dockerfile_run_container.md)|[Link](exercises/write_dockerfile_run_container.md)
### Containers Self Assesment
<details> <details>
<summary>What is a Container? What is it used for?</summary><br><b> <summary>What is a Container? What is it used for?</summary><br><b>
@ -5182,6 +5214,16 @@ Because each container has its own writable container layer, and all changes are
<a name="kubernetes"></a> <a name="kubernetes"></a>
### Kubernetes Exercises
#### Developer & Regular User Path
|Name|Topic|Objective & Instructions|Solution|Comments|
|--------|--------|------|----|----|
|My First Pod|Dockerfile|WIP|WIP
### Kubernetes Self Assesment
<details> <details>
<summary>What is Kubernetes? Why organizations are using it?</summary><br><b> <summary>What is Kubernetes? Why organizations are using it?</summary><br><b>
@ -5204,6 +5246,10 @@ At a minimum, a cluster contains a worker node and a master node."
Read more [here](https://www.redhat.com/en/topics/containers/what-is-a-kubernetes-cluster) Read more [here](https://www.redhat.com/en/topics/containers/what-is-a-kubernetes-cluster)
</b></details> </b></details>
<details>
<summary>When or why NOT to use Kubernetes?</summary><br><b>
</b></details>
#### Kubernetes Nodes #### Kubernetes Nodes
<details> <details>
@ -6865,6 +6911,8 @@ class MyClass(object):
``` ```
</b></details> </b></details>
#### Python - Exceptions
<details> <details>
<summary>What is an error? What is an exception? What types of exceptions are you familiar with?</summary><br><b> <summary>What is an error? What is an exception? What types of exceptions are you familiar with?</summary><br><b>
@ -6954,6 +7002,20 @@ For more details about errors and exceptions follow this [https://docs.python.or
</b></details> </b></details>
<details>
<summary>What is the result of running the following function?
```
def true_or_false():
try:
return True
finally:
return False
```
</summary><br><b>
False
</b></details>
#### Python Built-in functions #### Python Built-in functions
<details> <details>
@ -8429,6 +8491,11 @@ Alert manager is responsible for alerts ;)
## Git ## Git
|Name|Topic|Objective & Instructions|Solution|Comments|
|--------|--------|------|----|----|
| My first Commit | Commit | [Exercise](exercises/git/commit_01.md) | [Solution](exercises/git/solutions/commit_01_solution.md) | |
| Time to Branch | Branch | [Exercise](exercises/git/branch_01.md) | [Solution](exercises/git/solutions/branch_01_solution.md) | |
<details> <details>
<summary>How do you know if a certain directory is a git repository?</summary><br><b> <summary>How do you know if a certain directory is a git repository?</summary><br><b>
@ -10908,10 +10975,10 @@ It's an architecture in which data is and retrieved from a single, non-shared, s
<summary>Explain the Sidecar Pattern (Or sidecar proxy)</summary><br><b> <summary>Explain the Sidecar Pattern (Or sidecar proxy)</summary><br><b>
</b></details> </b></details>
## General ## Misc
<details> <details>
<summary>What is a server?</summary><br><b> <summary>What is a server? What is a client?</summary><br><b>
A computer which serves data from itself to the client. A computer which serves data from itself to the client.
</b></details> </b></details>
@ -10924,6 +10991,13 @@ I like this definition from [here](https://blog.christianposta.com/microservices
"An explicitly and purposefully defined interface designed to be invoked over a network that enables software developers to get programmatic access to data and functionality within an organization in a controlled and comfortable way." "An explicitly and purposefully defined interface designed to be invoked over a network that enables software developers to get programmatic access to data and functionality within an organization in a controlled and comfortable way."
</b></details> </b></details>
<details>
<summary>What is Automation? How it's related or different from Orchestration?</summary><br><b>
Automation is the act of automating tasks to reduce human intervention or interaction in regards to IT technology and systems.<br>
While automation focuses on a task level, Orchestration is the process of automating processes and/or workflows which consists of multiple tasks that usually across multiple systems.
</b></details>
<details> <details>
<summary>Tell me about interesting bugs you've found and also fixed</summary><br><b> <summary>Tell me about interesting bugs you've found and also fixed</summary><br><b>
</b></details> </b></details>
@ -11557,6 +11631,13 @@ Sharding is a horizontal partitioning.
Are you able to explain what is it good for? Are you able to explain what is it good for?
</b></details> </b></details>
<details>
<summary>You find out your database became a bottleneck and users experience issues accessing data. How can you deal with such situation?</summary><br><b>
Not much information provided as to why it became a bottleneck and what is current architecture, so one general approach could be<br>
to reduce the load on your database by moving frequently-accessed data to in-memory structure.
</b></details>
<details> <details>
<summary>What is a connection pool?</summary><br><b> <summary>What is a connection pool?</summary><br><b>
@ -12073,47 +12154,6 @@ If you are looking for a way to prepare for a certain exam this is the section f
* [Certified Kubernetes Administrator (CKA)](certificates/cka.md) (Latest update: 2020) * [Certified Kubernetes Administrator (CKA)](certificates/cka.md) (Latest update: 2020)
## Exercises
Exercises are all about:
* Setting up environments
* Writing scripts
* Designing and/or developing infrastructure apps
* Fixing existing applications
Below you can find several exercises
#### Containers
* [Writing a Dockerfile and running a container](exercises/write_dockerfile_run_container.md)
#### Jenkins
* [Jenkins: writing scripts](exercises/jenkins_scripts.md)
* [Jenkins: writing pipelines](exercises/jenkins_pipelines.md)
#### CI/CD
* [CI for open source project](exercises/ci_for_open_source_project.md)
* [Write a pipeline - Docker image and K8](exercises/pipeline_deploy_image_to_k8.md)
#### Programming
* [grep before and after](exercises/programming/grep_berfore_and_after.md)
* [web scrapper](exercises/programming/web_scraper.md)
#### Mixed
* [Flask, Containers and CI](exercises/flask_container_ci/README.md)
* [Flask, Containers and CI 2](exercises/flask_container_ci2/README.md)
#### Misc
* [Elasticsearch & Kibana on AWS](exercises/misc/elk_kibana_aws.md)
* [ELK & Filebeat](exercises/eflk.md)
* [Ansible, Minikube and Docker](exercises/ansible_minikube_docker.md)
* [Cloud Slack bot](exercises/cloud_slack_bot.md)
## Other DevOps Projects ## Other DevOps Projects
<p align="center"><a href="https://github.com/bregman-arie/howtheydevops"><img src="images/how_they_devops.png"/></a></p> <p align="center"><a href="https://github.com/bregman-arie/howtheydevops"><img src="images/how_they_devops.png"/></a></p>

View File

@ -2,9 +2,10 @@
import random import random
def binary_search(arr, lb, ub, target): def binary_search(arr, lb, ub, target):
""" """
A Binary Search Example which has O(log n) time complexity. A Binary Search Example which has O(log n) time complexity.
""" """
if lb <= ub: if lb <= ub:
mid = ub + lb // 2 mid = ub + lb // 2
@ -17,6 +18,7 @@ def binary_search(arr, lb, ub, target):
else: else:
return -1 return -1
if __name__ == '__main__': if __name__ == '__main__':
rand_num_li = sorted([random.randint(1, 50) for _ in range(10)]) rand_num_li = sorted([random.randint(1, 50) for _ in range(10)])
target = random.randint(1, 50) target = random.randint(1, 50)

View File

@ -9,4 +9,4 @@
### Bonus ### Bonus
Containerize the app of the project you forked using any containerization technology you want. Containerize the app of the project you forked using any containerization technology you would like.

View File

@ -0,0 +1,19 @@
## Git Commit 01
### Objective
Learn how to work with Git Branches
### Instructions
1. Pick up a Git repository (or create a new one) with at least one commit
2. Create a new branch called "dev"
3. Modify one of the files in the repository
4. Create a new commit
5. Verify the commit you created is only in "dev" branch
### After you complete the exercise
Answer the following:
1. Why branches are useful? Give an example of one real-world scenario for using branches

View File

@ -0,0 +1,20 @@
## Git Commit 01
### Objective
Learn how to commit changes in Git repositories
### Instructions
1. Create a new directory
2. Make it a git repository
3. Create a new file called `file` with the content "hello commit"
4. Commit your new file
5. Run a git command to verify your commit was recorded
### After you complete the exercise
Answer the following:
* What are the benefits of commits?
* Is there another way to verify a commit was created?

View File

@ -0,0 +1,20 @@
## Branch 01 - Solution
```
cd some_repository
echo "master branch" > file1
git add file1
git commit -a -m "added file1"
git checkout -b dev
echo "dev branch" > file2
git add file2
git commit -a -m "added file2"
```
Verify:
```
git log (you should see two commits)
git checkout master
git log (you should see one commit)
```

View File

@ -0,0 +1,10 @@
## Git Commit 01 - Solution
```
mkdir my_repo && cd my_repo
git init
echo "hello_commit" > file
git add file
git commit -a -m "It's my first commit. Exciting!"
git log
```

View File

@ -0,0 +1,14 @@
### Jenkins - Remove Jobs
#### Objective
Learn how to write a Jenkins script that interacts with builds by removing builds older than X days.
#### Instructions
1. Pick up (or create) a job which has builds older than X days
2. Write a script to remove only the builds that are older than X days
#### Hints
X can be anything. For example, remove builds that are older than 3 days. Just make sure that you don't simply remove all the builds (since that's different from the objective).

View File

@ -0,0 +1,10 @@
### Jenkins - Remove Jobs
#### Objective
Learn how to write a Jenkins script to remove Jenkins jobs
#### Instructions
1. Create three jobs called: test-job, test2-job and prod-job
2. Write a script to remove all the jobs that include the string "test"

View File

@ -1,4 +1,4 @@
def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"REMOVE_ME"/ } def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"test"/ }
jobs.each { job -> jobs.each { job ->
println job.name println job.name

View File

@ -2,4 +2,4 @@
# We dont care about non alphanumerics filenames so we just ls | grep to shorten the script. # We dont care about non alphanumerics filenames so we just ls | grep to shorten the script.
echo $(( $(ls -R ./exercises/ | grep ".*md" -c) + $(grep \</summary\> -c README.md) )) echo $(( $(grep \</summary\> -c README.md) + $(grep -i Solution README.md | grep \.md -c) ))