Skip to content

Commit d896ba7

Browse files
Merge pull request #24 from ls1intum/add-dependency-cache
add pr based chart releases
2 parents c0099b3 + fef0f59 commit d896ba7

File tree

8 files changed

+87
-97
lines changed

8 files changed

+87
-97
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Chart Preview
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'chart/**'
7+
- '.github/workflows/chart-preview.yml'
8+
9+
jobs:
10+
preview:
11+
permissions:
12+
contents: read
13+
packages: write
14+
pull-requests: write
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install Helm
21+
uses: azure/setup-helm@v4
22+
23+
- name: Update chart dependencies
24+
run: helm dependency update ./chart
25+
26+
- name: Set preview version
27+
run: |
28+
CURRENT_VERSION=$(grep '^version:' chart/Chart.yaml | awk '{print $2}')
29+
PREVIEW_VERSION="${CURRENT_VERSION}-pr.${{ github.event.pull_request.number }}"
30+
sed -i "s/^version: .*/version: ${PREVIEW_VERSION}/" chart/Chart.yaml
31+
echo "PREVIEW_VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV
32+
33+
- name: Login to GHCR
34+
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
35+
36+
- name: Package and push
37+
run: |
38+
helm package ./chart
39+
helm push theia-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
40+
41+
- name: Comment install instructions
42+
uses: marocchino/sticky-pull-request-comment@v2
43+
with:
44+
header: chart-preview
45+
message: |
46+
## 📦 Chart Preview Ready
47+
48+
```bash
49+
helm install test oci://ghcr.io/${{ github.repository_owner }}/charts/theia-shared-cache --version ${{ env.PREVIEW_VERSION }}
50+
```
51+
52+
_Updated: ${{ github.sha }}_

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ jobs:
2424
git config user.name "$GITHUB_ACTOR"
2525
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2626
27+
- name: Install Helm
28+
uses: azure/setup-helm@v4
29+
30+
- name: Update chart dependencies
31+
run: helm dependency update ./chart
32+
2733
- name: Run chart-releaser
2834
uses: helm/chart-releaser-action@v1.6.0
2935
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.vscode/
44
*.swp
55
*.swo
6+
.claude

.idea/theia-shared-cache.iml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/workspace.xml

Lines changed: 0 additions & 72 deletions
This file was deleted.

chart/templates/reposilite-shared-config.yaml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,28 @@ data:
1010
configuration.shared.json: |
1111
{
1212
"maven": {
13-
"repositories": {
14-
"releases": {
13+
"repositories": [
14+
{
15+
"id": "releases",
1516
"visibility": "PUBLIC",
1617
"redeployment": false,
17-
"preserved": true,
18-
"storageProvider": {
19-
"type": "fs",
20-
"quota": "100%",
21-
"mount": ""
22-
},
18+
"preserveSnapshots": false,
2319
"proxied": [
2420
{
25-
"link": "https://repo1.maven.org/maven2",
21+
"reference": "https://repo1.maven.org/maven2",
2622
"store": true,
2723
"allowedGroups": [],
2824
"allowedExtensions": [".jar", ".war", ".xml", ".pom", ".module", ".asc", ".md5", ".sha1", ".sha256", ".sha512"]
2925
},
3026
{
31-
"link": "https://plugins.gradle.org/m2",
27+
"reference": "https://plugins.gradle.org/m2",
3228
"store": true,
3329
"allowedGroups": [],
3430
"allowedExtensions": [".jar", ".war", ".xml", ".pom", ".module", ".asc", ".md5", ".sha1", ".sha256", ".sha512"]
3531
}
3632
]
3733
}
38-
}
34+
]
3935
}
4036
}
4137
{{- end }}

chart/values.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,32 @@ reposilite:
7171
- name: JAVA_OPTS
7272
value: "-Xmx128M"
7373
- name: REPOSILITE_OPTS
74-
value: "--token admin:changeme --shared-configuration=/app/data/configuration.shared.json"
74+
value: "--token admin:changeme --shared-configuration=/etc/reposilite/configuration.shared.json"
7575

76-
# Mount shared configuration into Reposilite pod
76+
# Mount shared configuration + plugins into Reposilite pod
7777
deployment:
78+
initContainers:
79+
- name: download-prometheus-plugin
80+
image: busybox:1.36
81+
command:
82+
- sh
83+
- -c
84+
- |
85+
wget -O /plugins/prometheus-plugin.jar \
86+
"https://maven.reposilite.com/releases/com/reposilite/plugin/prometheus-plugin/3.5.26/prometheus-plugin-3.5.26-all.jar"
87+
volumeMounts:
88+
- name: plugins
89+
mountPath: /plugins
7890
additionalVolumes:
7991
- name: shared-config
8092
configMap:
8193
name: reposilite-shared-config
94+
- name: plugins
95+
emptyDir: {}
8296
additionalVolumeMounts:
8397
- name: shared-config
84-
mountPath: /app/data/configuration.shared.json
85-
subPath: configuration.shared.json
98+
mountPath: /etc/reposilite/configuration.shared.json
99+
subPath: configuration.shared.json
100+
readOnly: true
101+
- name: plugins
102+
mountPath: /app/data/plugins

0 commit comments

Comments
 (0)