Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Goal / Purpose
<!-- What and why -->

## Changes
-

## Related issue
Closes #

## Testing
- [ ] Unit tests
- [ ] E2E/Integration
- [ ] Manual (steps):

## Checklist
- [ ] Self-review done
- [ ] CI is green
- [ ] Tests added/updated (if needed)
- [ ] Docs updated (if needed)
- [ ] No secrets/credentials in code or logs
34 changes: 34 additions & 0 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push, workflow_dispatch]
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: Collect System Information
run: |
echo "=== System Information ==="
uname -a
echo ""
echo "=== CPU Information ==="
lscpu
echo ""
echo "=== Memory Information ==="
free -h
echo ""
echo "=== Disk Space ==="
df -h
echo ""
echo "=== Environment Variables ==="
printenv | grep RUNNER
- name: Check out repository code
uses: actions/checkout@v5
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- 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 }}."
Binary file added current-state.txt
Binary file not shown.
Binary file added desired-state.txt
Binary file not shown.
19 changes: 19 additions & 0 deletions health.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Sun Mar 15 00:51:38 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:51:53 MSK 2026 - ❌ CRITICAL: State mismatch detected!
Desired MD5: 71a29f10311a1948c950c6f5528a5937
Current MD5: 6ed6f9d4d12daea40d2144e2e22f1914
Sun Mar 15 00:52:13 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:52:47 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:52:50 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:52:53 MSK 2026 - ❌ CRITICAL: State mismatch detected!
Desired MD5: 71a29f10311a1948c950c6f5528a5937
Current MD5: 0d39e77fb04dc93d4c2379569d2491bd
Sun Mar 15 00:52:57 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:53:00 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:53:03 MSK 2026 - ❌ CRITICAL: State mismatch detected!
Desired MD5: 71a29f10311a1948c950c6f5528a5937
Current MD5: 0d39e77fb04dc93d4c2379569d2491bd
Sun Mar 15 00:53:06 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:53:09 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:53:12 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:53:15 MSK 2026 - ✅ OK: States synchronized
10 changes: 10 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DESIRED_MD5=$(md5sum desired-state.txt | awk '{print $1}')
CURRENT_MD5=$(md5sum current-state.txt | awk '{print $1}')

if [ "$DESIRED_MD5" != "$CURRENT_MD5" ]; then
echo "$(date) - ❌ CRITICAL: State mismatch detected!" | tee -a health.log
echo " Desired MD5: $DESIRED_MD5" | tee -a health.log
echo " Current MD5: $CURRENT_MD5" | tee -a health.log
else
echo "$(date) - ✅ OK: States synchronized" | tee -a health.log
fi
Binary file added labs/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions labs/submission1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1) Подпись коммитов очень важно в разработке, так как подтверждает, что конкретный разработчик внес изменение, ведь автора коммита можно подделать указав определенные данные. Поэтому именно подпись указывает на достоверный коммит.

2) Подпись коммитов в DevOps особенно важна, потому что она криптографически подтверждает, кто внёс изменения и что коммит не был подменён, повышая доверие к коду, который проходит через CI/CD.

![alt text](image.png)
107 changes: 107 additions & 0 deletions labs/submission7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Task1

![alt text](image-1.png)
![alt text](image-2.png)
![alt text](image-3.png)

somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ echo "replicas: 5" >> current-state.txt
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ diff desired-state.txt current-state.txt
Binary files desired-state.txt and current-state.txt differ
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ ./reconcile.sh
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:39:58 MSK 2026 - ⚠️ DRIFT DETECTED!
Reconciling current state with desired state...
Sun Mar 15 00:39:58 MSK 2026 - ✅ Reconciliation complete

Reconciliation loop помогает откатывать изменения в конфиге к изначальному состоянию. Это очень полезно, если кто-то меняет конфиг руками, то есть вероятность, что сервер может упасть из-за изменения, поэтому этот цикл каждые N секунд/минут сбрасывает конфиг до изначального рабочего состояния.

Декларативный конфиг имеет преимущество, так как мы не диктуем системе шаги, которые нужно предпринять, а говорим ей, то, что должно получиться в итоге. В отличие от декларативного конфига, императивный требует описание шагов, и в случае ошибки на k-ом шаге, система не знает, что должно быть дальше и все ломается


# Task2

somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ ./healthcheck.sh
Sun Mar 15 00:51:38 MSK 2026 - ✅ OK: States synchronized
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ cat health.log
Sun Mar 15 00:51:38 MSK 2026 - ✅ OK: States synchronized
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ echo "unapproved-change: true" >> current-state.txt
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ cat health.log
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:52:09 MSK 2026 - ⚠️ DRIFT DETECTED!
Reconciling current state with desired state...
Sun Mar 15 00:52:09 MSK 2026 - ✅ Reconciliation complete
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ ./healthcheck.sh
Sun Mar 15 00:52:13 MSK 2026 - ✅ OK: States synchronized
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ cat health.log
Sun Mar 15 00:51:38 MSK 2026 - ✅ OK: States synchronized
Sun Mar 15 00:51:53 MSK 2026 - ❌ CRITICAL: State mismatch detected!
Desired MD5: 71a29f10311a1948c950c6f5528a5937
Current MD5: 6ed6f9d4d12daea40d2144e2e22f1914
Sun Mar 15 00:52:13 MSK 2026 - ✅ OK: States synchronized
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ chmod +x monitor.sh
somepatt@DESKTOP-NG99BTO:/mnt/c/Users/Mi/Desktop/projects/DevOps-Intro$ ./monitor.sh
Starting GitOps monitoring...
\n--- Check #1 ---
Sun Mar 15 00:52:47 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:52:47 MSK 2026 - ✅ States synchronized
\n--- Check #2 ---
Sun Mar 15 00:52:50 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:52:50 MSK 2026 - ✅ States synchronized
\n--- Check #3 ---
Sun Mar 15 00:52:53 MSK 2026 - ❌ CRITICAL: State mismatch detected!
Desired MD5: 71a29f10311a1948c950c6f5528a5937
Current MD5: 0d39e77fb04dc93d4c2379569d2491bd
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:52:54 MSK 2026 - ⚠️ DRIFT DETECTED!
Reconciling current state with desired state...
Sun Mar 15 00:52:54 MSK 2026 - ✅ Reconciliation complete
\n--- Check #4 ---
Sun Mar 15 00:52:57 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:52:57 MSK 2026 - ✅ States synchronized
\n--- Check #5 ---
Sun Mar 15 00:53:00 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:53:00 MSK 2026 - ✅ States synchronized
\n--- Check #6 ---
Sun Mar 15 00:53:03 MSK 2026 - ❌ CRITICAL: State mismatch detected!
Desired MD5: 71a29f10311a1948c950c6f5528a5937
Current MD5: 0d39e77fb04dc93d4c2379569d2491bd
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:53:03 MSK 2026 - ⚠️ DRIFT DETECTED!
Reconciling current state with desired state...
Sun Mar 15 00:53:03 MSK 2026 - ✅ Reconciliation complete
\n--- Check #7 ---
Sun Mar 15 00:53:06 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:53:06 MSK 2026 - ✅ States synchronized
\n--- Check #8 ---
Sun Mar 15 00:53:09 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:53:09 MSK 2026 - ✅ States synchronized
\n--- Check #9 ---
Sun Mar 15 00:53:12 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:53:12 MSK 2026 - ✅ States synchronized
\n--- Check #10 ---
Sun Mar 15 00:53:15 MSK 2026 - ✅ OK: States synchronized
./reconcile.sh: line 1: warning: command substitution: ignored null byte in input
./reconcile.sh: line 2: warning: command substitution: ignored null byte in input
Sun Mar 15 00:53:15 MSK 2026 - ✅ States synchronized


Мы сохраняем изначально состояние файла определенным хэшем. Любое измененый файл будет иметь уже другой хэш. Поэтому удобно сравнивать изменения не целыми файлами, а только хэшами.

Checksums - это механизм, а ArgoCD's "Sync Status" интерфейс, благодаря которому удобно пользоваться этим алгоритмом. Этот интерфейс удобно показывает результат сравнения хэшей.
7 changes: 7 additions & 0 deletions monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
echo "Starting GitOps monitoring..."
for i in {1..10}; do
echo "\n--- Check #$i ---"
./healthcheck.sh
./reconcile.sh
sleep 3
done
11 changes: 11 additions & 0 deletions reconcile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DESIRED=$(cat desired-state.txt)
CURRENT=$(cat current-state.txt)

if [ "$DESIRED" != "$CURRENT" ]; then
echo "$(date) - ⚠️ DRIFT DETECTED!"
echo "Reconciling current state with desired state..."
cp desired-state.txt current-state.txt
echo "$(date) - ✅ Reconciliation complete"
else
echo "$(date) - ✅ States synchronized"
fi