Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix github actions #892

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/bump-k8s-for-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,30 @@ jobs:
- name: Bump latest k8s.io dependencies
run: |
cd test/e2e
bash ./hack/bump-k8s-dep.sh e2e
bash ../../hack/bump-k8s-dep.sh test-e2e
cd ../..

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions-bot@example.com"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Check for changes and update version
id: changes
run: |
echo "changes=$(git diff)" >> $GITHUB_OUTPUT
git_diff_output=$(git diff)
if [ -n "$git_diff_output" ]; then
echo "changes=true" >> $GITHUB_OUTPUT
fi

- name: Create PR
if: steps.changes.outputs.changes
run: |
HEAD_BRANCH="github-actions/auto-bump/k8s-dependencies-$(date +'%Y%m%d%H%M%S')"
HEAD_BRANCH="github-actions/auto-bump/test-e2e-k8s-dependencies-$(date +'%Y%m%d%H%M%S')"
git checkout -b "$HEAD_BRANCH"
git add go.mod go.sum
git add test/e2e/go.mod test/e2e/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."
gh pr create --base master --title ":seedling: Bump the kubernetes group updates for e2e test" --label "ok-to-test" --body "This is an automatic generated pull request to bump the latest k8s dependencies for e2e test."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/bump-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ jobs:
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions-bot@example.com"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Check for changes and update version
id: changes
run: |
echo "changes=$(git diff)" >> $GITHUB_OUTPUT
git_diff_output=$(git diff)
if [ -n "$git_diff_output" ]; then
echo "changes=true" >> $GITHUB_OUTPUT
fi

- name: Create PR
if: steps.changes.outputs.changes
Expand All @@ -40,6 +43,6 @@ jobs:
git add go.mod go.sum
git commit -sm "Bump Kubernetes group dependencies updates"
git push origin "$HEAD_BRANCH"
gh pr create --base master --title ":seedling: Bump the Kubernetes group updates " --body "This is an automatically generated pull request to bump the latest k8s dependencies."
gh pr create --base master --title ":seedling: Bump the Kubernetes group updates " --label "ok-to-test" --body "This is an automatically generated pull request to bump the latest k8s dependencies."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 6 additions & 6 deletions hack/bump-k8s-dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set -o pipefail

# Check if the first input does not exist or is not equal to "test"
dependencies=("k8s.io/api" "k8s.io/client-go" "k8s.io/apimachinery" "k8s.io/klog/v2")
if [ -z "${1:-}" ] || [ "${1}" != "test" ]; then
if [ -z "${1:-}" ] || [ "${1}" != "test-e2e" ]; then
dependencies+=("k8s.io/cloud-provider" "k8s.io/code-generator" "k8s.io/component-base")
fi

Expand All @@ -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 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
# 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

# Bump the version if needed
if [ "$current_version" == "$latest_version" ]; then
Expand Down