-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1501 from porter-dev/george/por-3462-prevent-exte…
…rnal-secrets-crds-from-being-uninstalled-during fix: add new workflow to pull external-secrets charts directly from tar file
- Loading branch information
Showing
3 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
.github/actions/sync-remote-directory-using-tar-file/action.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
32
.github/workflows/sync-remote-helm-charts-using-tar-files.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters