diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..6df4836e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ +## Goal + + +## Changes + + +## Testing + + +## Checklist +- [ ] Clear, descriptive PR title +- [ ] Documentation/README updated (if needed) +- [ ] No secrets or large temporary files committed \ No newline at end of file diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 00000000..63c35108 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,115 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: + push: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + print_tags: + description: 'True to print to STDOUT' + required: true + type: boolean + tags: + description: 'Test scenario tags' + required: true + type: string + environment: + description: 'Environment to run tests against' + type: environment + required: true + +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + + - name: Check out repository code + uses: actions/checkout@v5 + + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + + - name: Gather system information + run: | + echo "🔧 ===== SYSTEM INFORMATION =====" + echo "" + echo "📊 OPERATING SYSTEM DETAILS:" + echo "-------------------------------" + echo "OS Information:" + cat /etc/os-release + echo "" + echo "Kernel Version:" + uname -a + echo "" + echo "Hostname:" + hostname + echo "" + + echo "💻 HARDWARE SPECIFICATIONS:" + echo "-------------------------------" + echo "CPU Information:" + echo " Model: $(grep "model name" /proc/cpuinfo | head -1 | cut -d':' -f2 | xargs)" + echo " Cores: $(nproc)" + echo " Architecture: $(uname -m)" + echo "" + + echo "Memory Information:" + echo " Total RAM: $(free -h | grep "Mem:" | awk '{print $2}')" + echo " Available RAM: $(free -h | grep "Mem:" | awk '{print $7}')" + echo " Swap: $(free -h | grep "Swap:" | awk '{print $2}')" + echo "" + + echo "💾 DISK INFORMATION:" + echo "-------------------------------" + echo "Disk Usage:" + df -h / | tail -1 | awk '{print " Total: " $2 ", Used: " $3 ", Available: " $4 ", Use%: " $5}' + echo "" + echo "Filesystem Type:" + df -T / | tail -1 | awk '{print " Type: " $2}' + echo "" + + echo "🌐 NETWORK INFORMATION:" + echo "-------------------------------" + echo "Network Interfaces:" + ip -brief addr show | grep -v "lo" || ifconfig | grep -E "^[a-z]" + echo "" + echo "DNS Configuration:" + cat /etc/resolv.conf | grep "nameserver" || echo " No DNS info available" + echo "" + + echo "⏱️ SYSTEM LOAD:" + echo "-------------------------------" + echo "Uptime:" + uptime + echo "" + echo "Load Average:" + cat /proc/loadavg + echo "" + + echo "👤 RUNNER USER INFORMATION:" + echo "-------------------------------" + echo "Current User: $(whoami)" + echo "Home Directory: $HOME" + echo "Current Directory: $(pwd)" + echo "Shell: $SHELL" + echo "" + + echo "✅ System information gathering complete!" + + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + + - name: List files in the repository + run: | + ls ${{ github.workspace }} + + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file diff --git a/labs/assets/screenshots/lab1.1.png b/labs/assets/screenshots/lab1.1.png new file mode 100644 index 00000000..c27ee6f7 Binary files /dev/null and b/labs/assets/screenshots/lab1.1.png differ diff --git a/labs/assets/screenshots/lab1.2.png b/labs/assets/screenshots/lab1.2.png new file mode 100644 index 00000000..3bdd4bb6 Binary files /dev/null and b/labs/assets/screenshots/lab1.2.png differ diff --git a/labs/assets/screenshots/lab1.3.png b/labs/assets/screenshots/lab1.3.png new file mode 100644 index 00000000..cb5bfb10 Binary files /dev/null and b/labs/assets/screenshots/lab1.3.png differ diff --git a/labs/assets/screenshots/lab1.4.png b/labs/assets/screenshots/lab1.4.png new file mode 100644 index 00000000..a29e7a11 Binary files /dev/null and b/labs/assets/screenshots/lab1.4.png differ diff --git a/labs/assets/screenshots/lab1.5.png b/labs/assets/screenshots/lab1.5.png new file mode 100644 index 00000000..91ae7aa6 Binary files /dev/null and b/labs/assets/screenshots/lab1.5.png differ diff --git a/labs/assets/screenshots/lab2.1.png b/labs/assets/screenshots/lab2.1.png new file mode 100644 index 00000000..62a2f7fc Binary files /dev/null and b/labs/assets/screenshots/lab2.1.png differ diff --git a/labs/assets/screenshots/lab2.10.png b/labs/assets/screenshots/lab2.10.png new file mode 100644 index 00000000..28549475 Binary files /dev/null and b/labs/assets/screenshots/lab2.10.png differ diff --git a/labs/assets/screenshots/lab2.11.png b/labs/assets/screenshots/lab2.11.png new file mode 100644 index 00000000..d76d9af9 Binary files /dev/null and b/labs/assets/screenshots/lab2.11.png differ diff --git a/labs/assets/screenshots/lab2.12.png b/labs/assets/screenshots/lab2.12.png new file mode 100644 index 00000000..1e9b5b4c Binary files /dev/null and b/labs/assets/screenshots/lab2.12.png differ diff --git a/labs/assets/screenshots/lab2.13.png b/labs/assets/screenshots/lab2.13.png new file mode 100644 index 00000000..615c5592 Binary files /dev/null and b/labs/assets/screenshots/lab2.13.png differ diff --git a/labs/assets/screenshots/lab2.14.png b/labs/assets/screenshots/lab2.14.png new file mode 100644 index 00000000..bd135110 Binary files /dev/null and b/labs/assets/screenshots/lab2.14.png differ diff --git a/labs/assets/screenshots/lab2.2.png b/labs/assets/screenshots/lab2.2.png new file mode 100644 index 00000000..0087fb1d Binary files /dev/null and b/labs/assets/screenshots/lab2.2.png differ diff --git a/labs/assets/screenshots/lab2.3.png b/labs/assets/screenshots/lab2.3.png new file mode 100644 index 00000000..c0dfd367 Binary files /dev/null and b/labs/assets/screenshots/lab2.3.png differ diff --git a/labs/assets/screenshots/lab2.4.png b/labs/assets/screenshots/lab2.4.png new file mode 100644 index 00000000..a173f81d Binary files /dev/null and b/labs/assets/screenshots/lab2.4.png differ diff --git a/labs/assets/screenshots/lab2.5.png b/labs/assets/screenshots/lab2.5.png new file mode 100644 index 00000000..5b6b36cd Binary files /dev/null and b/labs/assets/screenshots/lab2.5.png differ diff --git a/labs/assets/screenshots/lab2.6.png b/labs/assets/screenshots/lab2.6.png new file mode 100644 index 00000000..5b299b3a Binary files /dev/null and b/labs/assets/screenshots/lab2.6.png differ diff --git a/labs/assets/screenshots/lab2.7.png b/labs/assets/screenshots/lab2.7.png new file mode 100644 index 00000000..820b6e69 Binary files /dev/null and b/labs/assets/screenshots/lab2.7.png differ diff --git a/labs/assets/screenshots/lab2.8.png b/labs/assets/screenshots/lab2.8.png new file mode 100644 index 00000000..4442fdf2 Binary files /dev/null and b/labs/assets/screenshots/lab2.8.png differ diff --git a/labs/assets/screenshots/lab2.9.png b/labs/assets/screenshots/lab2.9.png new file mode 100644 index 00000000..eb07b1a0 Binary files /dev/null and b/labs/assets/screenshots/lab2.9.png differ diff --git a/labs/assets/screenshots/lab3.1.png b/labs/assets/screenshots/lab3.1.png new file mode 100644 index 00000000..bedbe36f Binary files /dev/null and b/labs/assets/screenshots/lab3.1.png differ diff --git a/labs/assets/screenshots/lab3.2.png b/labs/assets/screenshots/lab3.2.png new file mode 100644 index 00000000..639a2d8d Binary files /dev/null and b/labs/assets/screenshots/lab3.2.png differ diff --git a/labs/assets/screenshots/lab3.3.png b/labs/assets/screenshots/lab3.3.png new file mode 100644 index 00000000..8018148a Binary files /dev/null and b/labs/assets/screenshots/lab3.3.png differ diff --git a/labs/assets/screenshots/lab3.4.png b/labs/assets/screenshots/lab3.4.png new file mode 100644 index 00000000..f209d725 Binary files /dev/null and b/labs/assets/screenshots/lab3.4.png differ diff --git a/labs/assets/screenshots/lab3.5.png b/labs/assets/screenshots/lab3.5.png new file mode 100644 index 00000000..3d36c7e9 Binary files /dev/null and b/labs/assets/screenshots/lab3.5.png differ diff --git a/labs/submission1.md b/labs/submission1.md new file mode 100644 index 00000000..43c58537 --- /dev/null +++ b/labs/submission1.md @@ -0,0 +1,37 @@ +# Lab 1 submission + +## Task 1 + +1. **Benefits of signing commits:** +Commit signing adds a cryptographic signature to my Git commits which confirms that the commit was made by me and it prevents others from committing under my name. It also confirms that commit hasn't been altered: change to the commit after signing breaks the signature. Besides, commit signing mitigates MITM attacks. + +2. **"Why is commit signing important in DevOps workflows?"** +- commit signing provides verifiable history for compliance reviews. +- team members can verify each other's work. +- reviewers know commits are authentic and by whom exactly they were made. + +3. **Successful SSH key setup and signed commit:** + +![ssh key creation](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab1/labs/assets/screenshots/lab1.2.png?raw=true) + +![ssh key setup](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab1/labs/assets/screenshots/lab1.1.png?raw=true) + +4. **"Verified" badge on GitHub commit:** + +![verified commit](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab1/labs/assets/screenshots/lab1.3.png?raw=true) + +## Task 2 + +1. **PR template on main branch and description auto-filling**: + +![.github/pull_request_template.md exists](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab1/labs/assets/screenshots/lab1.4.png?raw=true) + +![auto-filling](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab1/labs/assets/screenshots/lab1.5.png?raw=true) + +2. **How do PR templates improve collaboration?** + +PR templates improve collaboration by standardizing communication and saving time for routine pull request description filling. They ensure pull requests include key information like context, testing steps, and screenshots, making reviews faster and more consistent. + +3. **Challenges encountered during setup:** + +Initially I already was working on feature/lab1 branch and I was confused about the location of the template file, so my first pull request was without description auto-filling by template. diff --git a/labs/submission2.md b/labs/submission2.md new file mode 100644 index 00000000..13b48862 --- /dev/null +++ b/labs/submission2.md @@ -0,0 +1,82 @@ +# Lab 2 submission + +## Task 1 + +1. **Objects inspections:** +![2.1](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.1.png?raw=true) + +- Commit inspection: + +![2.2](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.2.png?raw=true) + +- Tree inspection: + +![2.4](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.4.png?raw=true) + +- Blob inspection: + +![2.3](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.3.png?raw=true) + +Commit is a snapshot of the project's state at a specific point in time which contains a link to the tree, a link to the parent commit, author and message. + +Tree is like a file system that contains a list of files (blobs) and subdirectories (other trees) in a format: *object type* *object's hash* *object's real name (file or directory)*. + +Blob is an object that represents raw data of the file. + +2. **How does Git store repository data?** + +In Git files are stored based on their hashes, not real filenames. Blobs store content of files, trees store references to other trees and blobs, commits point to trees and contain metadata. + +## Task 2 + +1. `git reset --soft HEAD~1`: cancels last commit but saves its changes to staging area (test.txt: "Third commit"). Can be useful when we want to change commit message or add/remove something in last commit. + +![2.5](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.5.png?raw=true) + +2. `git reset --hard HEAD~1`: delete last commit and all its changes (test.txt: "First commit"). Can be dangerous because all changes are deleted permanently. + +![2.6](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.6.png?raw=true) + +3. `git reflog`: shows history of HEAD movements. + +![2.7](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.7.png?raw=true) + +4. `git reset --hard `: restores state to specified entry from reflog (test.txt: "Second commit"). Can be useful when we did `git reset --hard` and now want to recover lost commits. + +![2.8](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.8.png?raw=true) + +## Task 3 + +![2.9](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.9.png?raw=true) + +![2.10](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.10.png?raw=true) + +The graph shows branch relationships and merge points making it easier to understand project history and what have been done. + +## Task 4 + +![2.11](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.11.png?raw=true) + +Git tags matter because they provide stable versioning (reference points for releases), generate accurate release documentation and trigger automated CI/CD workflows. + +## Task 5 + +![2.12](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.12.png?raw=true) + +- Use `git switch` only for branch operations (creating, moving between, deleting), it prevents accidental file modifications. + +- Use `git checkout` only for restoring files or specific commits because it can overwrite uncommitted changes when switching branches. + +![2.13](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.13.png?raw=true) + +![2.14](https://github.com/sarrtr/DevOps-Intro/blob/feature/lab2/labs/assets/screenshots/lab2.14.png?raw=true) + +- Use `git restore` only for discarding or reverting file changes. + +## Task 6 + +**GitHub Community:** + +Starring repositories matters in open source because it signals appreciation to maintainers and helps them to gain public recognition in GitHub ans recommendations. + +Following developers helps in networking (you see what other developers are working on and you can discover their projects) and collaboration (easier to find team members for future projects among familiar developers). \ No newline at end of file diff --git a/labs/submission3.md b/labs/submission3.md new file mode 100644 index 00000000..c0574052 --- /dev/null +++ b/labs/submission3.md @@ -0,0 +1,60 @@ +# Lab 3 submission + +## Task 1 + +1. [Link](https://github.com/sarrtr/DevOps-Intro/actions/runs/22032997595) to successful run. + +2. **Key concepts of GitHub Actions:** + +- Job is a set of steps that execute on the same runner. It can have dependencies on other jobs, executes in parallel by default. +- Steps are individual tasks that run commands or actions in a job. In my script (basic one suggested by GitHub) there are 7 steps of 3 types: `run` (executes shell commands), `uses` (executes pre-built GitHub Actions) and `name` (labels the step for better readability). +- Runners are servers that execute the workflows (in my script `runs-on: ubuntu-latest`). +- Triggers are events that cause the workflow to run. + +3. **Workflow process analysis:** + +- Trigger Phase: workflow was triggered by a push event to the repository (in my script: `on: [push]`). +- Setup Phase: Ubuntu runner prepared. +- Execution Phase: + - Displays runner OS info + - Shows branch and repository details + - Clones the code + - Lists repository files + - Reports final job status + +## Task 2 + +1. **Changes in workflow file:** + +- add manual trigger + +![3.1](https://github.com/sarrtr/DevOps-Intro/blob/main/labs/assets/screenshots/lab3.1.png?raw=true) + +- add system info collection + +![3.2](https://github.com/sarrtr/DevOps-Intro/blob/main/labs/assets/screenshots/lab3.2.png?raw=true) + +![3.3](https://github.com/sarrtr/DevOps-Intro/blob/main/labs/assets/screenshots/lab3.3.png?raw=true) + +2. **Gathered information:** + +![3.4](https://github.com/sarrtr/DevOps-Intro/blob/main/labs/assets/screenshots/lab3.4.png?raw=true) + +![3.5](https://github.com/sarrtr/DevOps-Intro/blob/main/labs/assets/screenshots/lab3.5.png?raw=true) + +3. **Comparison of manual vs automatic workflow triggers:** +Automatic triggers are initiated immediately when code is pushed to the repository. They are useful for CI and automated testing. Manual triggers through `workflow_dispatch` require explicit user action, they allow to pass custom input parameters at runtime. You can choose which branch to run against at execution time. This can be useful for performing controlled deployments when needed. + +4. **Runner environment & capabilities:** + +Runner (`ubuntu-latest`): + +- OS: Ubuntu Linux (latest version) +- Hardware: 4-core CPU, 15GB RAM, 145GB SSD storage +- IP Range: GitHub-hosted runners use ephemeral IPs + +Key Capabilities: + +- Isolation (clean state every run) +- Files shared between steps within a job +- Full access to github, runner, job contexts \ No newline at end of file