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

update snyk branch monitoring in bump-version workflow #2998

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

orouz
Copy link
Collaborator

@orouz orouz commented Feb 11, 2025

Summary of your changes

the bump-version workflow includes a part where we import the required branches to be scanned by snyk. this PR includes a fix to make it work regardless of the base branch the workflow is executed from.

(the issue is that snyk import api is limited and we're deleting the previous import and adding it again, not updating, so currently we're overriding. this is what is being fixed here)

example run

Screenshot 2025-02-11 at 11 47 01

Related Issues

Copy link

mergify bot commented Feb 11, 2025

This pull request does not have a backport label. Could you fix it @orouz? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.
    NOTE: backport-v8.x has been added to help with the transition to the new branch 8.x.

@orouz orouz marked this pull request as ready for review February 11, 2025 12:52
@orouz orouz requested a review from a team as a code owner February 11, 2025 12:52
@orouz orouz marked this pull request as draft February 11, 2025 12:58
@@ -33,6 +32,7 @@ jobs:
with:
ref: ${{ github.ref_name }}
token: ${{ secrets.CLOUDSEC_MACHINE_TOKEN }}
fetch-depth: 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to get all branches as we'll be extracting the latest_major_latest_minor and previous_major_latest_minor

Comment on lines +221 to +231
branches=$(git branch -r | grep -Eo '[0-9]+\.[0-9]+' | sort -V | uniq)
# shellcheck disable=SC2128
latest_major=$(echo "$branches" | cut -d. -f1 | uniq | tail -1)
# shellcheck disable=SC2128
previous_major=$(echo "$branches" | cut -d. -f1 | uniq | tail -2 | head -1)
# shellcheck disable=SC2128
latest_major_latest_minor=$(echo "$branches" | grep -E "^$latest_major\." | tail -1)
# shellcheck disable=SC2128
previous_major_latest_minor=$(echo "$branches" | grep -E "^$previous_major\." | tail -1)
echo "latest_major_latest_minor: $latest_major_latest_minor"
echo "previous_major_latest_minor: $previous_major_latest_minor"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. this assumes the workflow is ran after the release branch were created (will fail before this runs if they aren't)
  2. copy-paste the lines to test on remote and remove -r to test locally

@orouz orouz marked this pull request as ready for review February 11, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant