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(cmake): properly fetch dev version by appending latest Falco tag, delta between master and tag, and hash #2292

Merged
merged 2 commits into from
Dec 12, 2022

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Nov 15, 2022

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?:

NONE

@FedeDP
Copy link
Contributor Author

FedeDP commented Nov 15, 2022

It is working fine for gh actions; not working on CircleCI. I suspect git clone depth issues...

@@ -86,44 +86,130 @@ function(get_git_head_revision _refspecvar _hashvar)
PARENT_SCOPE)
endfunction()

function(git_describe _var)
function(git_get_latest_tag _var)
Copy link
Contributor Author

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@"
Copy link
Contributor Author

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
Copy link
Contributor Author

@FedeDP FedeDP Nov 15, 2022

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:

@FedeDP
Copy link
Contributor Author

FedeDP commented Nov 15, 2022

/cc @leogr

@poiana poiana requested a review from leogr November 15, 2022 15:50
@leogr
Copy link
Member

leogr commented Nov 16, 2022

/assign
/milestone 0.34.0

@poiana poiana added this to the 0.34.0 milestone Nov 16, 2022
@FedeDP
Copy link
Contributor Author

FedeDP commented Nov 16, 2022

The same fix should also be applied to libs ;)

@FedeDP
Copy link
Contributor Author

FedeDP commented Dec 5, 2022

A little bit better; but github actions are still seeing the correct version:

  • -- Falco version: 0.33.1-27+b40e044

While circleci is seeing:

  • -- Falco version: 0.33.1-4+2ea3398

Fun facts:

  • circleci is seeing the wrong number of commits since the tag (4), but it is seeing the correct commit hash: 2ea3398.
  • Instead gh actions are seeing the correct number of commits (27), but wrong commit hash: b40e044.
    I am not sure why :/

… 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]>
@FedeDP
Copy link
Contributor Author

FedeDP commented Dec 5, 2022

Everything is fixed now.
We discovered that actions/checkout in gh actions is actually building a "fake" merge commit.
To disable the behavior, we needed to follow: https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit.
I will port the same fix to libs.

@FedeDP
Copy link
Contributor Author

FedeDP commented Dec 5, 2022

/cc @leogr @jasondellaluce

@poiana poiana requested a review from jasondellaluce December 5, 2022 15:01
@FedeDP FedeDP changed the title wip: fix(cmake): properly fetch dev version by appending latest Falco tag, delta between master and tag, and hash fix(cmake): properly fetch dev version by appending latest Falco tag, delta between master and tag, and hash Dec 5, 2022
@FedeDP
Copy link
Contributor Author

FedeDP commented Dec 6, 2022

To disable the behavior, we needed to follow: https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit.
I will port the same fix to libs.

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.

Copy link
Contributor

@jasondellaluce jasondellaluce left a 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.

@poiana
Copy link
Contributor

poiana commented Dec 9, 2022

LGTM label has been added.

Git tree hash: b04ec4d61424cce04a2db7c68125ba4f043198e0

@jasondellaluce
Copy link
Contributor

/milestone 0.34.0

@Andreagit97
Copy link
Member

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 :/

@jasondellaluce
Copy link
Contributor

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.

@Andreagit97
Copy link
Member

That's a good point, but we would also need to make sure that GHA merges the changes with a rebase

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 :/

@Andreagit97
Copy link
Member

we can also merge this and ask people to rebase before merging 🤔

@poiana poiana merged commit 0c39776 into master Dec 12, 2022
@poiana
Copy link
Contributor

poiana commented Dec 12, 2022

[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:
  • OWNERS [FedeDP,jasondellaluce,leogr]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

build: broken versioning of dev packages
5 participants