What's the reason for including the GitHub run num...
# kotest-contributors
a
What's the reason for including the GitHub run number in the Kotest snapshot version? https://github.com/kotest/kotest/blob/0ead70d13899bc4389739369a510c64f0af69491/buildSrc/src/main/kotlin/Ci.kt#L9-L12
Copy code
private val githubBuildNumber = System.getenv("GITHUB_RUN_NUMBER")

   private val snapshotVersion = when (githubBuildNumber) {
      null -> "$snapshotBase-LOCAL"
      else -> "$snapshotBase.${githubBuildNumber}-SNAPSHOT"
   }
it'd help with caching & task avoidance if the version was just
X.Y.Z-SNAPSHOT
s
it has to be unique in maven snapshots right ?
a
nope
s
it'll overwrite ?
a
-SNAPSHOT versions get a timestamp
yeah
s
is the timestamp available to users via the maven coordinates?
might be jarring to use a snapshot and it keep changing on you
a
hmmm I'm not sure if older snapshots can be selected
s
can we use a consistent version during the build and just overrride it when publishing ?
a
I think snapshot versions changing without warning are just part of the fun of using -SNAPSHOT 🙃
although Gradle will cache snapshot versions, and the cache-duration is configurable by users
s
you could argue that a snapshot is changing, but you could also argue it just means a very early snap of the current development state
I think the value in having it not change on users is more than speeding our builds up ?
a
> can we use a consistent version during the build and just overrride it when publishing ? Well... during local development it's actually okay, because it'll be X.Y.Z-LOCAL
👍🏻 1
oh it's not just speeding up our builds
in my own projects, as a Kotest user, I want to be able to use the latest snapshot. I would normally do that by depending on
io.kotest:whatever:1.2.3-SNAPSHOT
or even
io.kotest:whatever:latest.integration
and then Gradle will cache a version for 24 hours (by default)
s
it would cache it even if it's 1.2.3.4-snapshot?
like the current naming schema still gets cached ?
a
yes it will
Gradle caches everything
but there's no Kotest version for
1.2.3-SNAPSHOT
, I'd have to write
io.kotest:whatever:1.2.3+-SNAPSHOT
s
you can do 1.2.3.4-SNAPSHOT
a
or is
<major>.<minor>.<patch>.<build-id>-SNAPSHOT
valid semver? 🤔
s
its not semver if you're strictly talking about 1.2.3 but it's a version number that's consistent and a user can enter it
so I can do 5.10.0.1467-SNAPSHOT if I want and it'll be cached then and it won't change on it
we link to the snapshots from the homepage
a
you can do 1.2.3.4-SNAPSHOT
but what if I want to automatically select the latest version? :)
s
well you're out of luck 😉
a
hmmm I think that when publishing a SNAPSHOT version, each release automatically gets a distinct version https://s01.oss.sonatype.org/content/repositories/snapshots/io/kotest/kotest-framework-engine-jvm/5.9.0.1451-SNAPSHOT/maven-metadata.xml
Copy code
<snapshotVersion>
<extension>pom</extension>
<value>5.9.0.1451-20240511.091617-1</value>
<updated>20240511091617</updated>
</snapshotVersion>
so
-SNAPSHOT
is just a shortcut for "check
maven-metadata.xml
, select the highest timestamp"
s
if you can also reference it by timestamp, then you can get best of all worlds
a
ah I remember, every time you publish a SNAPSHOT
maven-metadata.xml
gets overridden
but every SNAPSHOT version gets (automatically) a distinct, specific version
I'll see if that works as expected...
👍🏻 1
yes, it does
so, Kotest could remove the GitHub run ID (it's useful info though, we could add it to the POM instead? Append it to the description?), and then users could use either • a general snapshot, to get the latest, e.g.
5.10.0-SNAPSHOT
• or a specific snapshot
5.9.0-20240511.091617-1451
(unchanging)
s
ok we can do this when we start on 6.0, which can be today if we want. Can cut a 5.9.2 and make a release branch and then start filing our boots on master for 6.0 changes
a
sure, sounds good!
s
I got most of the stuff that could be merged, merged yesterday
there's a few things that could go in but have conflicts.
and most of the rest is just WIP stuff
a
okay, I made a PR with the versioning change for 6.0 https://github.com/kotest/kotest/pull/4193
o
Do snapshot publishing changes need to wait for 5.9.2?
s
We can publish from a branch right?
o
I guess so. But even if not, snapshot publishing is not that essential at this stage, or am I missing something?
s
Right it's not