-
Notifications
You must be signed in to change notification settings - Fork 50
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
configure: add check for valid version #6276
Conversation
"Shell scripts make shell scripts by the C shore" If autoconf is written in C, that should be their new motto update: autoconf is not written in C |
7d51b50
to
ef55ee1
Compare
This is a good idea. Well couple of suggestions.
Playing around I came up with AC_MSG_CHECKING([whether version number is sane])
AS_IF([printf "%d.%d.%d" ${AX_MAJOR_VERSION} ${AX_MINOR_VERSION} ${AX_POINT_VERSION} >/dev/null 2>&1], [
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([Ensure your local git repo contains tags or set FLUX_VERSION.])
]) |
Hey, those macros are neat! Thanks for the suggestions, especially wrt making the check more concise. I favor a longer message to help dig people out of a hole. The target audience who would be seeing this is new contributors. Not even necessarily new contributors to Flux, we get people (me in 2022, the summer interns, etc.) who are new contributors to any open-source project. The motivator for adding this is recently it took me almost two hours to debug a version-related failure in sched. An intern was trying to run the testsuite in a CI environment off of his fork before opening a PR. None of the tests would run, and sched wouldn't even build, because CMake kept rejecting the version as invalid. It took me almost two hours to figure out what was going on -- his fork of flux-sched didn't have tags in it because he didn't check that box when he forked. If you run Perhaps the message really should read:
Does that clarify @garlick? Sorry for the book. It'd also be nice to keep the messages consistent between flux-core and flux-sched. |
87a5eaf
to
9cd6c29
Compare
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.
Thanks for doing this @wihobbs ! I have some nit picky suggestions about the message but otherwise looks good. Take whatever suggestions you think are good and go ahead and set MWP when ready.
configure.ac
Outdated
1. Set the variable manually, with FLUX_VERSION=<version> | ||
in your environment. |
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.
Setting FLUX_VERSION probably ought to be the last option listed since getting it wrong could cause confusion down the line.
configure.ac
Outdated
2. If you are running in a CI environment, run \`git fetch tags\` | ||
before building. Versions in flux-core are derived from | ||
\`git describe\` which uses the most recent tag. |
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.
I think this applies to any environment, and it would not apply to the native project CI based on github workflows. Drop the "if" qualifier?
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.
Oh, also it should be git fetch --tags
, whoops!
configure.ac
Outdated
3. If you are running CI in a fork of the main repository, try | ||
\`git push --tags\` to make sure tags are synchronized in | ||
your fork. |
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.
If "CI" is referencing flux-test-collective's gitlab environment maybe reference that specifically?
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.
I think this is for people using github CI testing on their own fork of a repository, where they may have neglected to push recent tags to their own fork (though I would think when you choose to fork via github you get tags by default, so I'm surprised if a user would hit this one)
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.
Ah I hadn't thought of that one.
Problem: autoconf will accept junk at configure time as a valid version, then go off and generate an invalid version.h file. This happens frequently with shallow clones, setups in CI, or other constrained user environments. It has caused new contributors a lot of confusion in the past. Solution: Like flux-framework/flux-sched#1291 suggested, reject invalid versions at configure time and provide appropriate suggestions to the user to remedy this.
9cd6c29
to
8a5f3b4
Compare
Changes LGTM! |
Thanks @garlick! I meant to say (but forgot to push the "comment" button 🤦) that I wanted to clarify |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6276 +/- ##
==========================================
+ Coverage 83.33% 83.35% +0.02%
==========================================
Files 521 521
Lines 85793 85793
==========================================
+ Hits 71495 71516 +21
+ Misses 14298 14277 -21 |
Problem: autoconf will accept junk at configure time as a valid version, then go off and generate an invalid version.h file. This happens frequently with shallow clones, setups in CI, or other constrained user environments. It has caused new contributors a lot of confusion in the past.
Solution: Like flux-framework/flux-sched#1291 suggested, reject invalid versions at configure time and provide appropriate suggestions to the user to remedy this.