From fec97968c5825275f9b54ee1c04f5c605c4ec26b Mon Sep 17 00:00:00 2001 From: Xudong Liu Date: Thu, 7 Mar 2024 15:30:02 +0800 Subject: [PATCH] Add auto bump action for e2e test (#888) * add auto bump for e2e test Signed-off-by: xudong liu --- .github/workflows/bump-k8s-for-e2e-test.yml | 48 +++++++++++++++++++++ hack/bump-k8s-dep.sh | 10 ++--- 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/bump-k8s-for-e2e-test.yml diff --git a/.github/workflows/bump-k8s-for-e2e-test.yml b/.github/workflows/bump-k8s-for-e2e-test.yml new file mode 100644 index 000000000..0fe5d91e2 --- /dev/null +++ b/.github/workflows/bump-k8s-for-e2e-test.yml @@ -0,0 +1,48 @@ +name: Bump latest Kubernetes dependecies for e2e test + +on: + schedule: + - cron: '0 12 */2 * *' # Run every two days at UTC noon + + workflow_dispatch: # Use for manaully trigger to debug + +jobs: + bump-to-latest-pre-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'test/e2e/go.mod' + + - name: Bump latest k8s.io dependencies + run: | + cd test/e2e + bash ./hack/bump-k8s-dep.sh e2e + cd ../.. + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions-bot@example.com" + + - name: Check for changes and update version + id: changes + run: | + echo "changes=$(git diff)" >> $GITHUB_OUTPUT + + - name: Create PR + if: steps.changes.outputs.changes + run: | + HEAD_BRANCH="github-actions/auto-bump/k8s-dependencies-$(date +'%Y%m%d%H%M%S')" + git checkout -b "$HEAD_BRANCH" + git add go.mod go.sum + git commit -sm "Bump kubernetes group dependencies updates for e2e test" + git push origin "$HEAD_BRANCH" + gh pr create --base master --title ":seedling: Bump the kubernetes group updates for e2e test" --body "This is an automatic generated pull request to bump the latest k8s dependencies for e2e test." + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/hack/bump-k8s-dep.sh b/hack/bump-k8s-dep.sh index 89b74b6d2..3701f9e16 100755 --- a/hack/bump-k8s-dep.sh +++ b/hack/bump-k8s-dep.sh @@ -39,11 +39,11 @@ check_and_bump_dependency() { latest_version=$(go list -m -versions -json "${dep}" | jq -r '.Versions[-1]') # latest_stable_version=$(go list -m -u -json ${dep} | jq -r .Version) - # filter out the alpha release - if [[ $latest_version =~ alpha\.([0-9]+)$ ]]; then - echo -e "${BLUE} Skip auto bump for alpha release: [$dep@$latest_version]${RESET}" - return - fi + # filter out the alpha release skip for test + # if [[ $latest_version =~ alpha\.([0-9]+)$ ]]; then + # echo -e "${BLUE} Skip auto bump for alpha release: [$dep@$latest_version]${RESET}" + # return + # fi # Bump the version if needed if [ "$current_version" == "$latest_version" ]; then