-
Notifications
You must be signed in to change notification settings - Fork 912
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(cmake): properly fetch dev version by appending latest Falco tag, delta between master and tag, and hash #2292
Conversation
It is working fine for gh actions; not working on CircleCI. I suspect git clone depth issues... |
3fb04b6
to
753d0b1
Compare
@@ -86,44 +86,130 @@ function(get_git_head_revision _refspecvar _hashvar) | |||
PARENT_SCOPE) | |||
endfunction() | |||
|
|||
function(git_describe _var) | |||
function(git_get_latest_tag _var) |
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.
Added 2 new functions: 1 to fetch latest tag in repository, the other to fetch commit delta between latest tag and HEAD.
@@ -16,8 +16,6 @@ limitations under the License. | |||
|
|||
#pragma once | |||
|
|||
#define FALCO_BRANCH "@FALCO_REF@" |
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.
Removed unused (always empty) macros.
endif() | ||
# Format FALCO_VERSION to be semver with prerelease and build part | ||
string(REPLACE "-g" "+" FALCO_VERSION "${FALCO_VERSION}") | ||
# Fetch current hash |
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.
New algorithm goes as follow:
- fetch latest available tag in repo
- fetch commits delta between tag and master (should be exactly the same as https://github.com/falcosecurity/falco/releases/latest "X commits to master since this release")
- build the Falco version string
/cc @leogr |
5d0167f
to
753d0b1
Compare
/assign |
The same fix should also be applied to libs ;) |
3a60945
to
753d0b1
Compare
A little bit better; but github actions are still seeing the correct version:
While circleci is seeing:
Fun facts:
|
2ea3398
to
08d4669
Compare
… delta between master and tag, and hash. `describe` can no more be used as tags are now made on release branches. Signed-off-by: Federico Di Pierro <[email protected]>
08d4669
to
67d592e
Compare
…t in gh actions. See https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit. Signed-off-by: Federico Di Pierro <[email protected]>
Everything is fixed now. |
I am indeed not sure if we want this behavior (that is the same circleCI has) or we want to keep the merge commit one, to be notified about issues of current code rebased on top of master. |
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.
/approve
I like this one Fede! I think it makes sense for Falco to skip the merge commit in the GHA workflows, IMO it's more clear to have the same exact version in all artefacts.
LGTM label has been added. Git tree hash: b04ec4d61424cce04a2db7c68125ba4f043198e0
|
/milestone 0.34.0 |
The only issue that we could have here is that by skipping the merge commit we could have the master broken after merging a PR, if there isn't a conflict poiana doesn't stop us but maybe the rebased code is broken :/ |
That's a good point, but we would also need to make sure that GHA merges the changes with a rebase, so that the end result is precisely what we would get if the PR gets merged. Not sure if this is supported though. |
Yes exactly as far as I know it doesn't do that, we have the same issue I've described before if the user doesn't rebase the PR before merging it :/ |
we can also merge this and ask people to rebase before merging 🤔 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, jasondellaluce, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area build
What this PR does / why we need it:
Fix latest develoment Falco (packages and builds) having wrong
0.32.1...
version.describe
can no more be used as tags are now made on release branches.Which issue(s) this PR fixes:
Fixes #2270
Special notes for your reviewer:
Does this PR introduce a user-facing change?: