From 402c321c03028eefe7dbc9813eb91173c927862b Mon Sep 17 00:00:00 2001 From: Andres Alvarez <1671935+kir4h@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:53:48 +0100 Subject: [PATCH 1/5] add .gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4012805 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +### Helm template +# Chart dependencies +**/charts/*.tgz + +# Used in CI to check out remotes +upstream/** From c9b1711c68bba5c38e5315b3df38f4cbfa56bf87 Mon Sep 17 00:00:00 2001 From: Andres Alvarez <1671935+kir4h@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:03:44 +0100 Subject: [PATCH 2/5] bump action versions (happy path) --- .github/workflows/lint-test.yaml | 10 +++++----- .github/workflows/release.yaml | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 68dc0a1..b65da39 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -7,14 +7,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v4.3.0 with: - version: v3.6.3 + version: v3.17.1 # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and # yamllint (https://github.com/adrienverge/yamllint) which require Python @@ -24,7 +24,7 @@ jobs: python-version: 3.8 - name: Set up chart-testing - uses: helm/chart-testing-action@v2.1.0 + uses: helm/chart-testing-action@v2.7.0 - name: Run chart-testing (list-changed) id: list-changed @@ -38,7 +38,7 @@ jobs: run: ct lint --config ct.yaml - name: Create kind cluster - uses: helm/kind-action@v1.2.0 + uses: helm/kind-action@v1.12.0 if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e1f021c..c0e9fad 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -20,16 +20,12 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v4.3.0 with: - version: v3.4.1 - - - name: Add dependency chart repos - run: | - helm repo add bitnami https://charts.bitnami.com/bitnami + version: v3.17.1 - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.1.0 + uses: helm/chart-releaser-action@v1.7.0 with: charts_dir: charts config: cr.yaml From 06cc8dae4c082cc7d4638c0c0ebd402b47762bcb Mon Sep 17 00:00:00 2001 From: Andres Alvarez <1671935+kir4h@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:04:28 +0100 Subject: [PATCH 3/5] remove unused chart repos --- ct.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ct.yaml b/ct.yaml index 7343b15..c1d1e88 100644 --- a/ct.yaml +++ b/ct.yaml @@ -2,6 +2,4 @@ remote: origin chart-dirs: - charts -chart-repos: - - bitnami=https://charts.bitnami.com/bitnami helm-extra-args: --timeout 600s From 40616fe78855bd203b69e0c0351bd6847434cb47 Mon Sep 17 00:00:00 2001 From: Andres Alvarez <1671935+kir4h@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:04:53 +0100 Subject: [PATCH 4/5] add local path provisioner workflow --- .../update-local-path-provisioner.yaml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/update-local-path-provisioner.yaml diff --git a/.github/workflows/update-local-path-provisioner.yaml b/.github/workflows/update-local-path-provisioner.yaml new file mode 100644 index 0000000..b96dab4 --- /dev/null +++ b/.github/workflows/update-local-path-provisioner.yaml @@ -0,0 +1,69 @@ +name: Sync Local Path Provisioner Chart + +on: + schedule: + # Runs once a week, every Monday at 00:00 UTC + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + sync-and-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: master + + - name: Checkout the upstream repository + uses: actions/checkout@v4 + with: + repository: rancher/local-path-provisioner + ref: master + path: upstream + + - name: Extract upstream version + id: version-extract + run: | + UPSTREAM_VERSION=$(cat upstream/deploy/chart/local-path-provisioner/Chart.yaml | grep 'version:' | awk '{print $2}') + echo "Upstream version: $UPSTREAM_VERSION" + echo "$UPSTREAM_VERSION=$UPSTREAM_VERSION" >> $GITHUB_ENV + + - name: Check if the checked out version is different from current one + id: version-check + run: | + if [ -f "./charts/local-path-provisioner/Chart.yaml" ]; then + CURRENT_VERSION=$(cat charts/local-path-provisioner/Chart.yaml | grep 'version:' | awk '{print $2}') + echo "Current version: $CURRENT_VERSION" + + if [ "$CURRENT_VERSION" != "${{ env.UPSTREAM_VERSION }}" ]; then + echo "version_changed=true" >> $GITHUB_ENV + else + echo "version_changed=false" >> $GITHUB_ENV + fi + else + # If Chart.yaml does not exist, treat it as a new version + echo "version_changed=true" >> $GITHUB_ENV + echo "Current version: None" + fi + + - name: Copy Helm Chart to my repo + if: env.version_changed == 'true' + run: | + mkdir -p ./charts/local-path-provisioner + # Copy the chart from upstream repo to the charts folder in the current repo + cp -r upstream/deploy/chart/local-path-provisioner/* ./charts/local-path-provisioner/ + + - name: Create Pull Request + if: env.version_changed == 'true' + uses: peter-evans/create-pull-request@v7 + with: + title: "Sync local-path-provisioner Helm chart to version ${{ env.UPSTREAM_VERSION }}" + body: "This PR syncs the latest version of the local-path-provisioner chart from the upstream repository to version ${{ env.UPSTREAM_VERSION }}." + branch: local-path-provisioner + delete-branch: true + commit-message: "Sync local-path-provisioner Helm chart to version ${{ env.UPSTREAM_VERSION }}" + labels: | + automated pr + add-paths: | + charts/local-path-provisioner/** From 33ca57dead0d0c52ad1f64156c90de46979a0c29 Mon Sep 17 00:00:00 2001 From: Andres Alvarez <1671935+kir4h@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:14:42 +0100 Subject: [PATCH 5/5] workflow fixes --- ct.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/ct.yaml b/ct.yaml index c1d1e88..6242328 100644 --- a/ct.yaml +++ b/ct.yaml @@ -2,4 +2,5 @@ remote: origin chart-dirs: - charts +target-branch: master helm-extra-args: --timeout 600s