sbt-git icon indicating copy to clipboard operation
sbt-git copied to clipboard

`-SNAPSHOT` suffix is missing

Open mrt181 opened this issue 6 years ago • 3 comments

I am using these versions

git = 2.17.0 sbt = 1.2.6 scala = 2.12.7 sbt-git = 1.0.0

Running sbt version on my project returns me the version as expected:

[info] Set current project to projectapiScala (in build file:/C:/cygwin64/home/user/sourcecode/project-api/api-scala/)
[info] Packaging C:\cygwin64\home\user\sourcecode\project-api\api-scala\target\scala-2.12\projectapiscala_2.12-1.2.0-19-gc11ba92-SNAPSHOT-sources.jar ...
[info] Done packaging.

git describe

1.2.0-19-gc11ba92

but running the build on TeamCity, our build server, the version is missing the -SNAPSHOT suffix.

[16:10:45][Step 2/3] [info] Set current project to tradingapiScala (in build file:/D:/TeamCity/buildAgent.0/work/project-api/api-scala/)
[16:10:45][Step 2/3] Plugin sbt-teamcity-logger was loaded.
[16:10:45][Step 2/3] TeamCity version='2017.2.2 (build 50909)'
[16:10:47][Step 2/3] [success] Total time: 2 s, completed 23.10.2018 15:10:47
[16:10:47][Step 2/3] [success] Total time: 0 s, completed 23.10.2018 15:10:47
[16:10:47][Step 2/3] [success] Total time: 0 s, completed 23.10.2018 15:10:47
[16:10:47][Step 2/3] Scala compiler (3m:11s)
[16:10:47][Step 2/3] [info] Packaging D:\TeamCity\buildAgent.0\work\project-api\api-scala\target\scala-2.12\projectapiscala_2.12-1.2.0-19-gc11ba92-sources.jar ...
[16:10:47][Step 2/3] Packaging D:\TeamCity\buildAgent.0\work\project-api\api-scala\target\scala-2.12\projectapiscala_2.12-1.2.0-19-gc11ba92-sources.jar ...
[16:10:47][Step 2/3] [info] Done packaging.

How can this be caused and fixed?

mrt181 avatar Oct 23 '18 15:10 mrt181

We are also missing SNAPSHOT suffixes unless there are uncommitted changes.

sjfloat avatar Oct 25 '18 18:10 sjfloat

We are also missing SNAPSHOT suffixes unless there are uncommitted changes.

This seems to be deliberate, judging by the setting name here. But still, it's counterintuitive that the SNAPSHOT suffix doesn't follow the isSnapshot setting.

nigredo-tori avatar Feb 06 '19 15:02 nigredo-tori

The -SNAPSHOT suffix is being used to indicate uncommitted changes rather than to indicate a non-tagged commit. This causes problems for things like CI/CD pipelines, which, almost by definition, never have uncommitted changes. If a pipeline does an sbt publish it will push the artifacts into the Releases repo rathan then the Snapshots repo.

It seems like the the uncommitted changes indicator should be something like "-dirty" and let the -SNAPSHOT suffix follow the value of the isSnapshot setting.

marcsaegesser avatar Dec 03 '19 20:12 marcsaegesser