-
Notifications
You must be signed in to change notification settings - Fork 5
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
modify env var passed to ggshield to get number of commits in push event #9
base: master
Are you sure you want to change the base?
modify env var passed to ggshield to get number of commits in push event #9
Conversation
e1289cb
to
0f1b407
Compare
src/@orb.yml
Outdated
@@ -50,7 +55,8 @@ jobs: | |||
docker: | |||
- image: gitguardian/ggshield:<<parameters.tag>> | |||
environment: | |||
CIRCLE_RANGE: <<parameters.base_revision>>...<<parameters.revision>> | |||
NUMBER_COMMITS_GH: <<parameters.number_commits_gh>> | |||
NUMBER_COMMITS_GL: <<parameters.number_commits_gl>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have been nice to expose only one variable, but I assume it's not possible to do operations like max
or +
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems possible if I do something like
GITHUB_COUNT="<<pipeline.trigger_parameters.github_app.total_commits_count>>"
GITLAB_COUNT="<<pipeline.trigger_parameters.gitlab.total_commits_count>>"
MAX_COUNT=$(( GITHUB_COUNT > GITLAB_COUNT ? GITHUB_COUNT : GITLAB_COUNT ))
echo "export CIRCLE_COMMIT_COUNT=$MAX_COUNT" >> $BASH_ENV
In run
, before the ggshield secret scan command
Do you think it's worth it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hackish, but that is what happens with shell scripting :). I think it's worth it because it means we don't have to make a new ggshield release if we ever find a way to get the BitBucket count, or whatever ci-host-of-the-day is added to CircleCI in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @agateau-gg, I am tackling this issue since I have some time now but I am really struggling to make this work.
I've tried a lot of solutions (you can see them in the commits of this branch) but I can't find a way to fetch both values (for GitHub and GitLab). Can we have a look together if you have some time please?
0f1b407
to
75350f6
Compare
75350f6
to
d4812a6
Compare
The
base_revision
has many issues and can't be relied on to get the commit range.The proposed solution is to fetch the number of commits included in the push event in order to list the commits to scan.