Skip to content

Commit

Permalink
Merge pull request #1501 from porter-dev/george/por-3462-prevent-exte…
Browse files Browse the repository at this point in the history
…rnal-secrets-crds-from-being-uninstalled-during

fix: add new workflow to pull external-secrets charts directly from tar file
  • Loading branch information
georgez98 authored Feb 21, 2025
2 parents 3a5f3b5 + e733e7f commit 22cfd48
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 5 deletions.
59 changes: 59 additions & 0 deletions .github/actions/sync-remote-directory-using-tar-file/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Sync Helm chart from release using tar file'
description: 'Download and sync a Helm chart from a release URL'

inputs:
chart_url:
description: 'Full URL to the chart .tgz file'
required: true
target_directory:
description: 'Directory within the current repo where we would like to copy the files'
required: true
github_token:
description: 'Github token to use for API calls'
required: true
chart_name:
description: 'Name of the chart for PR title and branch name'
required: true

runs:
using: composite
steps:
- name: Create temp directory
shell: bash
run: mkdir -p /tmp/helm-charts
- name: Download Helm chart
shell: bash
run: |
echo "Downloading chart from: ${{ inputs.chart_url }}"
curl -L -o /tmp/helm-charts/chart.tgz "${{ inputs.chart_url }}"
- name: Extract chart
shell: bash
run: |
cd /tmp/helm-charts
tar -xzf chart.tgz
- name: Sync to target directory
shell: bash
run: |
# Create target directory if it doesn't exist
mkdir -p ${{ inputs.target_directory }}
# Copy contents to directory
rsync -av --delete --cvs-exclude /tmp/helm-charts/${{ inputs.chart_name }}/ ${{ inputs.target_directory }}/
# Add to vendored-charts
echo "${{ inputs.target_directory }}" >> vendored-charts
sort -uo vendored-charts vendored-charts
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ inputs.github_token }}
add-paths: |
vendored-charts
${{ inputs.target_directory }}
title: "Sync: ${{ inputs.chart_name }} from tar file"
branch: "sync-${{ inputs.chart_name }}-release"

- name: Cleanup
shell: bash
run: rm -rf /tmp/helm-charts
32 changes: 32 additions & 0 deletions .github/workflows/sync-remote-helm-charts-using-tar-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Sync remote charts in PR using tar files'
on:
push:
branches:
- main
paths:
- '.github/workflows/sync-remote-helm-charts-using-tar-files.yaml'
workflow_dispatch:

jobs:
sync-chart-using-tar-file:
strategy:
matrix:
charts:
- chart_url: https://github.com/external-secrets/external-secrets/releases/download/helm-chart-0.10.3/external-secrets-0.10.3.tgz
target_directory: addons/external-secrets
chart_name: external-secrets
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout porter-charts
uses: actions/checkout@v4

- name: Sync chart from tar file
uses: ./.github/actions/sync-remote-directory-using-tar-file
with:
chart_url: ${{ matrix.charts.chart_url }}
target_directory: ${{ matrix.charts.target_directory }}
chart_name: ${{ matrix.charts.chart_name }}
github_token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 0 additions & 5 deletions .github/workflows/sync-remote-helm-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ jobs:
remote_directory: charts/karpenter
target_directory: addons/karpenter-aws
tag: v1.0.2
- remote_owner: external-secrets
remote_repository: external-secrets
remote_directory: deploy/charts/external-secrets
target_directory: addons/external-secrets
tag: helm-chart-0.10.3

permissions:
contents: write
Expand Down

0 comments on commit 22cfd48

Please sign in to comment.