Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit 2c10f41

Browse files
committed
Added CI/CD to GH
1 parent 20fdd50 commit 2c10f41

3 files changed

Lines changed: 110 additions & 3 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: OnCall Bot CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: sre-helmcode/oncall-slack-bot
11+
VERSION: "1.0.4"
12+
13+
jobs:
14+
build-and-deploy:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
packages: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.11'
30+
31+
- name: Install dependencies and test
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -r requirements.txt
35+
# Basic syntax check
36+
python -m py_compile main.py
37+
python -m py_compile handlers/commands.py
38+
python -m py_compile services/postgres_storage.py
39+
40+
- name: Log in to Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Build and push Docker image
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: .
51+
push: true
52+
tags: |
53+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
54+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
55+
56+
- name: Update Helm chart
57+
run: |
58+
# Update image tag in values.yaml
59+
sed -i "s/tag: \".*\"/tag: \"${{ env.VERSION }}\"/" helm/oncall-slack-bot/values.yaml
60+
61+
# Update chart version
62+
sed -i "s/version: .*/version: ${{ env.VERSION }}/" helm/oncall-slack-bot/Chart.yaml
63+
sed -i "s/appVersion: .*/appVersion: \"${{ env.VERSION }}\"/" helm/oncall-slack-bot/Chart.yaml
64+
65+
- name: Commit changes
66+
run: |
67+
git config --local user.email "action@github.com"
68+
git config --local user.name "GitHub Action"
69+
70+
if git diff --quiet; then
71+
echo "No changes to commit"
72+
exit 0
73+
fi
74+
75+
git add helm/oncall-slack-bot/values.yaml helm/oncall-slack-bot/Chart.yaml
76+
git commit -m "🚀 Update to version ${{ env.VERSION }}"
77+
git push
78+
79+
- name: Deploy summary
80+
run: |
81+
echo "✅ Deployment completed!"
82+
echo "🐳 Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}"
83+
echo "📦 ArgoCD will deploy automatically"

argocd/oncall-application.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,40 @@ metadata:
55
namespace: argocd
66
annotations:
77
argocd.argoproj.io/sync-wave: "1"
8+
argocd.argoproj.io/sync-options: "CreateNamespace=true"
9+
labels:
10+
app.kubernetes.io/name: oncall-slack-bot
11+
app.kubernetes.io/component: slack-bot
812
spec:
913
project: default
1014
source:
1115
repoURL: https://github.com/helmcode/oncall-slack-bot.git
1216
targetRevision: main
1317
path: helm/oncall-slack-bot
18+
helm:
19+
valueFiles:
20+
- values.yaml
1421
destination:
1522
server: https://kubernetes.default.svc
1623
namespace: oncall
1724
syncPolicy:
1825
automated:
1926
prune: true
20-
selfHeal: true
27+
selfHeal: true
28+
allowEmpty: false
29+
syncOptions:
30+
- CreateNamespace=true
31+
- PrunePropagationPolicy=foreground
32+
- PruneLast=true
33+
retry:
34+
limit: 5
35+
backoff:
36+
duration: 5s
37+
factor: 2
38+
maxDuration: 3m
39+
revisionHistoryLimit: 10
40+
info:
41+
- name: "Image Registry"
42+
value: "ghcr.io/sre-helmcode/oncall-slack-bot"
43+
- name: "Documentation"
44+
value: "https://github.com/helmcode/oncall-slack-bot"

helm/oncall-slack-bot/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: oncall-slack-bot
33
description: A Helm chart for deploying the OnCall Slack Bot with Postgres using KubeDB
44
type: application
5-
version: 0.1.0
6-
appVersion: "1.0.2"
5+
version: 1.0.3
6+
appVersion: "1.0.3"

0 commit comments

Comments
 (0)