Skip to content

Commit 4de2ac5

Browse files
authoredMar 7, 2025··
Merge pull request #25 from kir4h/add_local_path_provisioner_sync
Add local path provisioner sync workflow
2 parents 94df7f3 + 33ca57d commit 4de2ac5

File tree

5 files changed

+85
-15
lines changed

5 files changed

+85
-15
lines changed
 

‎.github/workflows/lint-test.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v2
10+
uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
1313

1414
- name: Set up Helm
15-
uses: azure/setup-helm@v1
15+
uses: azure/setup-helm@v4.3.0
1616
with:
17-
version: v3.6.3
17+
version: v3.17.1
1818

1919
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
2020
# yamllint (https://github.com/adrienverge/yamllint) which require Python
@@ -24,7 +24,7 @@ jobs:
2424
python-version: 3.8
2525

2626
- name: Set up chart-testing
27-
uses: helm/chart-testing-action@v2.1.0
27+
uses: helm/chart-testing-action@v2.7.0
2828

2929
- name: Run chart-testing (list-changed)
3030
id: list-changed
@@ -38,7 +38,7 @@ jobs:
3838
run: ct lint --config ct.yaml
3939

4040
- name: Create kind cluster
41-
uses: helm/kind-action@v1.2.0
41+
uses: helm/kind-action@v1.12.0
4242
if: steps.list-changed.outputs.changed == 'true'
4343

4444
- name: Run chart-testing (install)

‎.github/workflows/release.yaml

+4-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
1616

@@ -20,16 +20,12 @@ jobs:
2020
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2121
2222
- name: Install Helm
23-
uses: azure/setup-helm@v1
23+
uses: azure/setup-helm@v4.3.0
2424
with:
25-
version: v3.4.1
26-
27-
- name: Add dependency chart repos
28-
run: |
29-
helm repo add bitnami https://charts.bitnami.com/bitnami
25+
version: v3.17.1
3026

3127
- name: Run chart-releaser
32-
uses: helm/chart-releaser-action@v1.1.0
28+
uses: helm/chart-releaser-action@v1.7.0
3329
with:
3430
charts_dir: charts
3531
config: cr.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Sync Local Path Provisioner Chart
2+
3+
on:
4+
schedule:
5+
# Runs once a week, every Monday at 00:00 UTC
6+
- cron: '0 0 * * 1'
7+
workflow_dispatch:
8+
9+
jobs:
10+
sync-and-pr:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
ref: master
17+
18+
- name: Checkout the upstream repository
19+
uses: actions/checkout@v4
20+
with:
21+
repository: rancher/local-path-provisioner
22+
ref: master
23+
path: upstream
24+
25+
- name: Extract upstream version
26+
id: version-extract
27+
run: |
28+
UPSTREAM_VERSION=$(cat upstream/deploy/chart/local-path-provisioner/Chart.yaml | grep 'version:' | awk '{print $2}')
29+
echo "Upstream version: $UPSTREAM_VERSION"
30+
echo "$UPSTREAM_VERSION=$UPSTREAM_VERSION" >> $GITHUB_ENV
31+
32+
- name: Check if the checked out version is different from current one
33+
id: version-check
34+
run: |
35+
if [ -f "./charts/local-path-provisioner/Chart.yaml" ]; then
36+
CURRENT_VERSION=$(cat charts/local-path-provisioner/Chart.yaml | grep 'version:' | awk '{print $2}')
37+
echo "Current version: $CURRENT_VERSION"
38+
39+
if [ "$CURRENT_VERSION" != "${{ env.UPSTREAM_VERSION }}" ]; then
40+
echo "version_changed=true" >> $GITHUB_ENV
41+
else
42+
echo "version_changed=false" >> $GITHUB_ENV
43+
fi
44+
else
45+
# If Chart.yaml does not exist, treat it as a new version
46+
echo "version_changed=true" >> $GITHUB_ENV
47+
echo "Current version: None"
48+
fi
49+
50+
- name: Copy Helm Chart to my repo
51+
if: env.version_changed == 'true'
52+
run: |
53+
mkdir -p ./charts/local-path-provisioner
54+
# Copy the chart from upstream repo to the charts folder in the current repo
55+
cp -r upstream/deploy/chart/local-path-provisioner/* ./charts/local-path-provisioner/
56+
57+
- name: Create Pull Request
58+
if: env.version_changed == 'true'
59+
uses: peter-evans/create-pull-request@v7
60+
with:
61+
title: "Sync local-path-provisioner Helm chart to version ${{ env.UPSTREAM_VERSION }}"
62+
body: "This PR syncs the latest version of the local-path-provisioner chart from the upstream repository to version ${{ env.UPSTREAM_VERSION }}."
63+
branch: local-path-provisioner
64+
delete-branch: true
65+
commit-message: "Sync local-path-provisioner Helm chart to version ${{ env.UPSTREAM_VERSION }}"
66+
labels: |
67+
automated pr
68+
add-paths: |
69+
charts/local-path-provisioner/**

‎.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
### Helm template
2+
# Chart dependencies
3+
**/charts/*.tgz
4+
5+
# Used in CI to check out remotes
6+
upstream/**

‎ct.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
remote: origin
33
chart-dirs:
44
- charts
5-
chart-repos:
6-
- bitnami=https://charts.bitnami.com/bitnami
5+
target-branch: master
76
helm-extra-args: --timeout 600s

0 commit comments

Comments
 (0)
Please sign in to comment.