Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 26471cc

Browse files
committed
feat: adds Helm chart for deploying codegate
Signed-off-by: ChrisJBurns <29541485+ChrisJBurns@users.noreply.github.com>
1 parent e8a70ac commit 26471cc

33 files changed

+890
-40
lines changed

.github/workflows/feature-launcher.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,51 @@ jobs:
1212
- name: Send Feature Release Notification to Discord
1313
env:
1414
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
15+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
1516
ISSUE_TITLE: ${{ github.event.issue.title }}
1617
ISSUE_BODY: ${{ github.event.issue.body }}
1718
ISSUE_URL: ${{ github.event.issue.html_url }}
1819
run: |
19-
curl -H "Content-Type: application/json" \
20-
-X POST \
21-
-d '{
22-
"content": "**🚀 New Feature Launched!**\n\n🎉 *${{ env.ISSUE_TITLE }}* is now available to try!\n📖 Description: ${{ env.ISSUE_BODY }}\n🔗 [Check it out here](${{ env.ISSUE_URL }})"
23-
}' \
24-
$DISCORD_WEBHOOK
20+
node -e '
21+
const https = require("https");
22+
const discordWebhook = new URL(process.env.DISCORD_WEBHOOK);
23+
const slackWebhook = new URL(process.env.SLACK_WEBHOOK);
24+
25+
const issueTitle = process.env.ISSUE_TITLE;
26+
const issueBody = process.env.ISSUE_BODY;
27+
const issueUrl = process.env.ISSUE_URL;
28+
29+
// Discord Payload
30+
const discordPayload = {
31+
content: [
32+
"**🚀 " +issueTitle + " has been released!**",
33+
"",
34+
"**🌟 Whats new in CodeGate:**",
35+
issueBody,
36+
"",
37+
"We would 🤍 your feedback! 🔗 [Here’s the GitHub issue](" + issueUrl + ")"
38+
].join("\n")
39+
};
40+
41+
// Slack Payload
42+
const slackPayload = {
43+
text: `🚀 *${issueTitle}* has been released!\n\n 🔗 <${issueUrl}|Here’s the GitHub issue>`,
44+
};
45+
46+
function sendNotification(webhookUrl, payload) {
47+
const url = new URL(webhookUrl);
48+
const req = https.request(url, {
49+
method: "POST",
50+
headers: {
51+
"Content-Type": "application/json",
52+
}
53+
});
54+
55+
req.on("error", (error) => {
56+
console.error("Error:", error);
57+
process.exit(1);
58+
});
59+
60+
req.write(JSON.stringify(payload));
61+
req.end();
62+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "deploy/charts/**"
9+
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write
17+
packages: write
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name "$GITHUB_ACTOR"
29+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
30+
31+
- name: Run chart-releaser
32+
uses: helm/chart-releaser-action@3e001cb8c68933439c7e721650f20a07a1a5c61e # pin@v1.6.0
33+
with:
34+
config: cr.yaml
35+
env:
36+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
37+
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99 #pin@v3.3.0
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Install Cosign
46+
uses: sigstore/cosign-installer@c56c2d3e59e4281cc41dea2217323ba5694b171e #pin@v3.7.0
47+
48+
- name: Publish and Sign OCI Charts
49+
run: |
50+
for chart in `find .cr-release-packages -name '*.tgz' -print`; do
51+
helm push ${chart} oci://ghcr.io/${GITHUB_REPOSITORY} |& tee helm-push-output.log
52+
file_name=${chart##*/}
53+
chart_name=${file_name%-*}
54+
digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log)
55+
cosign sign -y "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}@${digest}"
56+
done
57+
env:
58+
COSIGN_EXPERIMENTAL: 1
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test Charts
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- deploy/charts/**
7+
8+
jobs:
9+
check-readme:
10+
runs-on: ubuntu-latest
11+
env:
12+
GO111MODULE: on
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
16+
17+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
18+
with:
19+
python-version: '3.x'
20+
21+
- uses: actions/setup-go@5a083d0e9a84784eb32078397cf5459adecb4c40 # pin@v3
22+
with:
23+
go-version: ^1
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Set up Helm
34+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # pin@v4.2.0
35+
36+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
37+
with:
38+
python-version: '3.x'
39+
40+
- name: Set up chart-testing
41+
uses: helm/chart-testing-action@v2.7.0
42+
43+
- name: Run chart-testing (lint)
44+
run: ct lint --config ct.yaml
45+
46+
- name: Create KIND Cluster
47+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # pin@v1.12.0
48+
49+
- name: Run chart-testing (install)
50+
run: ct install --config ct.yaml

api/openapi.json

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,55 @@
989989
}
990990
}
991991
},
992+
"/api/v1/workspaces/{provider_id}": {
993+
"get": {
994+
"tags": [
995+
"CodeGate API",
996+
"Workspaces"
997+
],
998+
"summary": "List Workspaces By Provider",
999+
"description": "List workspaces by provider ID.",
1000+
"operationId": "v1_list_workspaces_by_provider",
1001+
"parameters": [
1002+
{
1003+
"name": "provider_id",
1004+
"in": "path",
1005+
"required": true,
1006+
"schema": {
1007+
"type": "string",
1008+
"format": "uuid",
1009+
"title": "Provider Id"
1010+
}
1011+
}
1012+
],
1013+
"responses": {
1014+
"200": {
1015+
"description": "Successful Response",
1016+
"content": {
1017+
"application/json": {
1018+
"schema": {
1019+
"type": "array",
1020+
"items": {
1021+
"$ref": "#/components/schemas/WorkspaceWithModel"
1022+
},
1023+
"title": "Response V1 List Workspaces By Provider"
1024+
}
1025+
}
1026+
}
1027+
},
1028+
"422": {
1029+
"description": "Validation Error",
1030+
"content": {
1031+
"application/json": {
1032+
"schema": {
1033+
"$ref": "#/components/schemas/HTTPValidationError"
1034+
}
1035+
}
1036+
}
1037+
}
1038+
}
1039+
}
1040+
},
9921041
"/api/v1/alerts_notification": {
9931042
"get": {
9941043
"tags": [
@@ -1478,6 +1527,16 @@
14781527
"type": "string",
14791528
"title": "Name"
14801529
},
1530+
"config": {
1531+
"anyOf": [
1532+
{
1533+
"$ref": "#/components/schemas/WorkspaceConfig"
1534+
},
1535+
{
1536+
"type": "null"
1537+
}
1538+
]
1539+
},
14811540
"rename_to": {
14821541
"anyOf": [
14831542
{
@@ -1590,6 +1649,17 @@
15901649
},
15911650
"MuxRule": {
15921651
"properties": {
1652+
"provider_name": {
1653+
"anyOf": [
1654+
{
1655+
"type": "string"
1656+
},
1657+
{
1658+
"type": "null"
1659+
}
1660+
],
1661+
"title": "Provider Name"
1662+
},
15931663
"provider_id": {
15941664
"type": "string",
15951665
"title": "Provider Id"
@@ -1842,6 +1912,52 @@
18421912
"is_active"
18431913
],
18441914
"title": "Workspace"
1915+
},
1916+
"WorkspaceConfig": {
1917+
"properties": {
1918+
"system_prompt": {
1919+
"type": "string",
1920+
"title": "System Prompt"
1921+
},
1922+
"muxing_rules": {
1923+
"items": {
1924+
"$ref": "#/components/schemas/MuxRule"
1925+
},
1926+
"type": "array",
1927+
"title": "Muxing Rules"
1928+
}
1929+
},
1930+
"type": "object",
1931+
"required": [
1932+
"system_prompt",
1933+
"muxing_rules"
1934+
],
1935+
"title": "WorkspaceConfig"
1936+
},
1937+
"WorkspaceWithModel": {
1938+
"properties": {
1939+
"id": {
1940+
"type": "string",
1941+
"title": "Id"
1942+
},
1943+
"name": {
1944+
"type": "string",
1945+
"pattern": "^[a-zA-Z0-9_-]+$",
1946+
"title": "Name"
1947+
},
1948+
"provider_model_name": {
1949+
"type": "string",
1950+
"title": "Provider Model Name"
1951+
}
1952+
},
1953+
"type": "object",
1954+
"required": [
1955+
"id",
1956+
"name",
1957+
"provider_model_name"
1958+
],
1959+
"title": "WorkspaceWithModel",
1960+
"description": "Returns a workspace ID with model name"
18451961
}
18461962
}
18471963
}

cr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
generate-release-notes: true

ct.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
chart-dirs:
2+
- deploy/charts
3+
validate-maintainers: false
4+
remote: origin
5+
target-branch: main

deploy/charts/codegate/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

deploy/charts/codegate/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: codegate
3+
description: A Helm chart for deploying Codegate onto Kubernetes
4+
type: application
5+
version: 0.0.1
6+
appVersion: "v0.1.22"

0 commit comments

Comments
 (0)