-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflow): add Sync CSI Repos with Upstream action
Signed-off-by: Derek Su <[email protected]>
- Loading branch information
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build External Images | ||
name: Build CSI Sidecar Images | ||
|
||
on: | ||
workflow_dispatch: | ||
|
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,38 @@ | ||
name: Sync CSI Repos with Upstream | ||
|
||
on: | ||
schedule: | ||
# Every day at 3:00 | ||
- cron: '0 3 * * *' | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Setup Git | ||
run: | | ||
gh auth setup-git | ||
- run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Derek Su" | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Sync Repos | ||
run: bash ./scripts/sync-csi-repos-with-upstream.sh |
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 @@ | ||
#!/bin/bash | ||
|
||
source_target_repos=( | ||
"external-snapshotter:csi-snapshotter" | ||
"external-resizer:csi-resizer" | ||
"external-provisioner:csi-provisioner" | ||
"external-attacher:csi-attacher" | ||
"node-driver-registrar:csi-node-driver-registrar" | ||
"livenessprobe:livenessprobe" | ||
) | ||
|
||
for source_target_repo in "${source_target_repos[@]}"; do | ||
source_repo=$(echo "$source_target_repo" | cut -d ":" -f 1) | ||
target_repo=$(echo "$source_target_repo" | cut -d ":" -f 2) | ||
|
||
echo "Syncing $target_repo" | ||
|
||
SOURCE_REPO_PATH="https://github.com/kubernetes-csi/${source_repo}.git" | ||
TARGET_REPO_PATH="https://github.com/longhorn/${target_repo}.git" | ||
|
||
git clone ${TARGET_REPO_PATH} | ||
pushd ${target_repo} | ||
|
||
# Sync branches | ||
git remote add src_remote ${SOURCE_REPO_PATH} | ||
git fetch src_remote --quiet | ||
git push origin "refs/remotes/src_remote/*:refs/heads/*" --force | ||
|
||
# Sync tags | ||
git fetch src_remote --tags --quiet | ||
git push origin --tags --force | ||
done |