From bf02acd1f86fa4a27adbe341fa3d177626a2fa8d Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 13:46:13 +0200 Subject: [PATCH 01/17] added flow --- .../workflows/update-hkubectl-downloads.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/update-hkubectl-downloads.yaml diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml new file mode 100644 index 00000000..4b83e084 --- /dev/null +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -0,0 +1,33 @@ +name: Update Download Files from hkubectl Release + +# Trigger the workflow when a new release is published in the hkubectl repository +on: + repository_dispatch: + types: [hkubectl-release] + +jobs: + update-files: + runs-on: ubuntu-latest + + steps: + - name: Checkout kube-HPC.github.io repository + uses: actions/checkout@v2 + with: + repository: kube-HPC/kube-HPC.github.io + ref: main + + - name: Download latest release files from hkubectl + run: | + export latestVersion=$(curl -s https://api.github.com/repos/kube-HPC/hkubectl/releases/latest | jq -r .tag_name) + mkdir -p site/hkubectl_files + curl -L https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o hkubectl_files/hkubectl-linux + curl -L https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o hkubectl_files/hkubectl-macos + curl -L https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o hkubectl_files/hkubectl-win.exe + + - name: Commit and push updated files to kube-HPC.github.io + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git add hkubectl_files/* + git commit -m "Update hkubectl download files to the latest release" || echo "No changes to commit" + git push origin main From 51f0ef6aeabc0dd861322b2cd93d51a411f1086e Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:03:39 +0200 Subject: [PATCH 02/17] updated checkout branch to source --- .github/workflows/update-hkubectl-downloads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 4b83e084..c504b709 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v2 with: repository: kube-HPC/kube-HPC.github.io - ref: main + ref: source - name: Download latest release files from hkubectl run: | From 254616bcc12469e718ac0357dcd0987991da87c1 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:09:40 +0200 Subject: [PATCH 03/17] updated to source for checking --- .github/workflows/update-hkubectl-downloads.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index c504b709..225b626d 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -2,8 +2,9 @@ name: Update Download Files from hkubectl Release # Trigger the workflow when a new release is published in the hkubectl repository on: - repository_dispatch: - types: [hkubectl-release] + # Triggers the workflow on push or pull request events but only for the master branch. + pull_request: + branches: [ source ] jobs: update-files: From fab31a5a07eb9287f636857f9bb55ee0fdb60aad Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:17:28 +0200 Subject: [PATCH 04/17] updated for checking --- .github/workflows/update-hkubectl-downloads.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 225b626d..8c49a336 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -19,11 +19,14 @@ jobs: - name: Download latest release files from hkubectl run: | + set -e export latestVersion=$(curl -s https://api.github.com/repos/kube-HPC/hkubectl/releases/latest | jq -r .tag_name) - mkdir -p site/hkubectl_files - curl -L https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o hkubectl_files/hkubectl-linux - curl -L https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o hkubectl_files/hkubectl-macos - curl -L https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o hkubectl_files/hkubectl-win.exe + mkdir -p site/hkubectl_files || { echo "Failed to create directory"; exit 1; } + df -h + ls -ld site site/hkubectl_files + curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o site/hkubectl_files/hkubectl-linux + curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o site/hkubectl_files/hkubectl-macos + curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o site/hkubectl_files/hkubectl-win.exe - name: Commit and push updated files to kube-HPC.github.io run: | From 343aa254c4ec3f7fd6281d5a1db335e9eb55e5c0 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:19:33 +0200 Subject: [PATCH 05/17] wip --- .github/workflows/update-hkubectl-downloads.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 8c49a336..941ecd6c 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -19,11 +19,8 @@ jobs: - name: Download latest release files from hkubectl run: | - set -e export latestVersion=$(curl -s https://api.github.com/repos/kube-HPC/hkubectl/releases/latest | jq -r .tag_name) mkdir -p site/hkubectl_files || { echo "Failed to create directory"; exit 1; } - df -h - ls -ld site site/hkubectl_files curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o site/hkubectl_files/hkubectl-linux curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o site/hkubectl_files/hkubectl-macos curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o site/hkubectl_files/hkubectl-win.exe From e4b6afddb54e937c22f685632e84540fc633190d Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:22:07 +0200 Subject: [PATCH 06/17] debugging points --- .github/workflows/update-hkubectl-downloads.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 941ecd6c..dfa7b0a8 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -19,16 +19,23 @@ jobs: - name: Download latest release files from hkubectl run: | + set -e export latestVersion=$(curl -s https://api.github.com/repos/kube-HPC/hkubectl/releases/latest | jq -r .tag_name) + echo "Latest version: $latestVersion" mkdir -p site/hkubectl_files || { echo "Failed to create directory"; exit 1; } curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o site/hkubectl_files/hkubectl-linux curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o site/hkubectl_files/hkubectl-macos curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o site/hkubectl_files/hkubectl-win.exe + echo "Downloaded files:" + ls -R site - name: Commit and push updated files to kube-HPC.github.io run: | + set -e git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - git add hkubectl_files/* + ls site/hkubectl_files || { echo "No files found"; exit 1; } + git add site/hkubectl_files/* || { echo "git add failed"; exit 1; } git commit -m "Update hkubectl download files to the latest release" || echo "No changes to commit" git push origin main + From 9e51ad73a47d4ce54494d14f8cd3d5ab707008b0 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:29:43 +0200 Subject: [PATCH 07/17] test --- .github/workflows/update-hkubectl-downloads.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index dfa7b0a8..187aa7df 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -32,10 +32,10 @@ jobs: - name: Commit and push updated files to kube-HPC.github.io run: | set -e - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" ls site/hkubectl_files || { echo "No files found"; exit 1; } - git add site/hkubectl_files/* || { echo "git add failed"; exit 1; } - git commit -m "Update hkubectl download files to the latest release" || echo "No changes to commit" - git push origin main + git add -A + git commit -m "Update hkubectl download files to the latest release" --allow-empty + git push origin hkubectl_updates_via_workflow From 4234eb19d21404b8e0f0261079810057212d850d Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:31:45 +0200 Subject: [PATCH 08/17] wip --- .github/workflows/update-hkubectl-downloads.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 187aa7df..18cdc2c5 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -35,7 +35,9 @@ jobs: git config --global user.email "action@github.com" git config --global user.name "GitHub Action" ls site/hkubectl_files || { echo "No files found"; exit 1; } + # Ensure we are on the correct branch + git checkout -b hkubectl_updates_via_workflow || git checkout hkubectl_updates_via_workflow git add -A git commit -m "Update hkubectl download files to the latest release" --allow-empty - git push origin hkubectl_updates_via_workflow + git push --set-upstream origin hkubectl_updates_via_workflow From 13516a0e5e8d0a964f1663c7207610712843b956 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:35:46 +0200 Subject: [PATCH 09/17] test --- .github/workflows/update-hkubectl-downloads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 18cdc2c5..484e6f20 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -39,5 +39,5 @@ jobs: git checkout -b hkubectl_updates_via_workflow || git checkout hkubectl_updates_via_workflow git add -A git commit -m "Update hkubectl download files to the latest release" --allow-empty - git push --set-upstream origin hkubectl_updates_via_workflow + git push --set-upstream origin test_branch_1 From 2ae88730b56cae1219bb67c08e26817c6614925b Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:38:34 +0200 Subject: [PATCH 10/17] wip --- .github/workflows/update-hkubectl-downloads.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 484e6f20..f854a22f 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -35,9 +35,9 @@ jobs: git config --global user.email "action@github.com" git config --global user.name "GitHub Action" ls site/hkubectl_files || { echo "No files found"; exit 1; } - # Ensure we are on the correct branch - git checkout -b hkubectl_updates_via_workflow || git checkout hkubectl_updates_via_workflow + git fetch origin + git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 git add -A git commit -m "Update hkubectl download files to the latest release" --allow-empty - git push --set-upstream origin test_branch_1 + git push origin test_branch_1 From f7471282f1a228b2793d8dbd9e9e8f03897c484a Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:45:33 +0200 Subject: [PATCH 11/17] removed logs --- .github/workflows/update-hkubectl-downloads.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index f854a22f..38303a28 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -21,23 +21,18 @@ jobs: run: | set -e export latestVersion=$(curl -s https://api.github.com/repos/kube-HPC/hkubectl/releases/latest | jq -r .tag_name) - echo "Latest version: $latestVersion" - mkdir -p site/hkubectl_files || { echo "Failed to create directory"; exit 1; } + mkdir -p site/hkubectl_files curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o site/hkubectl_files/hkubectl-linux curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o site/hkubectl_files/hkubectl-macos curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o site/hkubectl_files/hkubectl-win.exe - echo "Downloaded files:" - ls -R site - name: Commit and push updated files to kube-HPC.github.io run: | set -e git config --global user.email "action@github.com" git config --global user.name "GitHub Action" - ls site/hkubectl_files || { echo "No files found"; exit 1; } - git fetch origin git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 git add -A - git commit -m "Update hkubectl download files to the latest release" --allow-empty + git commit -m "Update hkubectl download files to the latest release" git push origin test_branch_1 From c77a5397e30dccc50a74dbcc26fc8b9e510adbd1 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:48:54 +0200 Subject: [PATCH 12/17] wip --- .github/workflows/update-hkubectl-downloads.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 38303a28..44eeeddc 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v2 with: repository: kube-HPC/kube-HPC.github.io - ref: source + ref: test_branch_1 - name: Download latest release files from hkubectl run: | @@ -31,8 +31,9 @@ jobs: set -e git config --global user.email "action@github.com" git config --global user.name "GitHub Action" + git fetch origin git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 git add -A - git commit -m "Update hkubectl download files to the latest release" + git commit -m "Update hkubectl download files to the latest release" --allow-empty git push origin test_branch_1 From 389e606b1e0de8ea2aad2d5998bb21f61024fdad Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:51:32 +0200 Subject: [PATCH 13/17] wio --- .github/workflows/update-hkubectl-downloads.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 44eeeddc..a850c43d 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -31,7 +31,6 @@ jobs: set -e git config --global user.email "action@github.com" git config --global user.name "GitHub Action" - git fetch origin git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 git add -A git commit -m "Update hkubectl download files to the latest release" --allow-empty From 9f5097d74953a63a1bb0954add3d76ff4155306b Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:54:13 +0200 Subject: [PATCH 14/17] test --- .github/workflows/update-hkubectl-downloads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index a850c43d..6483e0a3 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -2,7 +2,7 @@ name: Update Download Files from hkubectl Release # Trigger the workflow when a new release is published in the hkubectl repository on: - # Triggers the workflow on push or pull request events but only for the master branch. + # Triggers the workflow on push or pull request events but only for the master branch pull_request: branches: [ source ] From a355ea2aa2b310cd112f4749dba4eb4755c620b5 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:56:16 +0200 Subject: [PATCH 15/17] remoevd flag --- .github/workflows/update-hkubectl-downloads.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 6483e0a3..a62fbb3e 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -33,6 +33,6 @@ jobs: git config --global user.name "GitHub Action" git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 git add -A - git commit -m "Update hkubectl download files to the latest release" --allow-empty + git commit -m "Update hkubectl download files to the latest release" git push origin test_branch_1 From 898213b68c02989cc4728ae44f1eb5845bb95720 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 14:59:49 +0200 Subject: [PATCH 16/17] handling when nothing changed --- .github/workflows/update-hkubectl-downloads.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index a62fbb3e..4f3c9c3e 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -28,11 +28,14 @@ jobs: - name: Commit and push updated files to kube-HPC.github.io run: | - set -e git config --global user.email "action@github.com" git config --global user.name "GitHub Action" git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 git add -A + if ! git diff --cached --quiet; then git commit -m "Update hkubectl download files to the latest release" git push origin test_branch_1 + else + echo "No changes to commit, skipping commit and push." + fi From 07a1ff62d5459953aa9795189fbe9f12217ae673 Mon Sep 17 00:00:00 2001 From: Adir111 Date: Mon, 30 Dec 2024 15:01:08 +0200 Subject: [PATCH 17/17] testing completed - back to original --- .github/workflows/update-hkubectl-downloads.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-hkubectl-downloads.yaml b/.github/workflows/update-hkubectl-downloads.yaml index 4f3c9c3e..933c6357 100644 --- a/.github/workflows/update-hkubectl-downloads.yaml +++ b/.github/workflows/update-hkubectl-downloads.yaml @@ -2,9 +2,8 @@ name: Update Download Files from hkubectl Release # Trigger the workflow when a new release is published in the hkubectl repository on: - # Triggers the workflow on push or pull request events but only for the master branch - pull_request: - branches: [ source ] + repository_dispatch: + types: [hkubectl-release] jobs: update-files: @@ -15,7 +14,7 @@ jobs: uses: actions/checkout@v2 with: repository: kube-HPC/kube-HPC.github.io - ref: test_branch_1 + ref: source - name: Download latest release files from hkubectl run: | @@ -30,11 +29,11 @@ jobs: run: | git config --global user.email "action@github.com" git config --global user.name "GitHub Action" - git checkout test_branch_1 || git checkout -b test_branch_1 origin/test_branch_1 + git checkout source || git checkout -b source origin/source git add -A if ! git diff --cached --quiet; then git commit -m "Update hkubectl download files to the latest release" - git push origin test_branch_1 + git push origin source else echo "No changes to commit, skipping commit and push." fi