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

Introduce ImmutableSnapshot strategy to create snapshots using timestamps #153

Merged
merged 6 commits into from Jul 12, 2019

Conversation

rpalcolea
Copy link
Member

This introduces immutableSnapshot task/strategy to generate snapshot versions that are meant to be immutable and should be unique via UTC timestamp. Ex. 1.2.0-snapshot.20190705210556893+abcdef

Pattern is <major>.<minor>.<patch>-snapshot.<timestamp>+<hash> and timestamp format is YYYYMMddHHmmssSSS

This change doesn't replace devSnapshot and default strategy to prevent breaking changes for consumers.

We should be able to override the default strategy from devSnapshot to immutableSnapshot via ReleasePluginExtension:

release {
                defaultVersionStrategy = nebula.plugin.release.NetflixOssStrategies.IMMUTABLE_SNAPSHOT(project)
            }

@coveralls
Copy link

coveralls commented Jul 5, 2019

Coverage Status

Coverage increased (+0.5%) to 70.03% when pulling 057ec30 on immutable-snapshot-support into 1bf4a5d on master.

@rspieldenner
Copy link
Contributor

if I have 1.2.3-snapshot.2019070511000000+abcdef and 1.2.3-rc.1 which will I get if I ask for 1.+?

@rpalcolea
Copy link
Member Author

rpalcolea commented Jul 7, 2019

if I have 1.2.3-snapshot.2019070511000000+abcdef and 1.2.3-rc.1 which will I get if I ask for 1.+?

@rspieldenner , this is actually a good question. This new immutable snapshot suggests to use the snapshot explicitly instead of relying on things like 1.+. Because in semver identifiers consisting of only digits are compared numerically and identifiers with letters or hyphens are compared lexically in ASCII sort order, 1.2.3-rc.1 would always be first.

I think this should be considered as a breaking change in order to unify versioning with other technologies that are Semver based, like NPM.

I believe snapshots should be always consumed explicitly and not via dynamic versions (1.+) but that's just my opinion.

Also, I think is worth mentioning that generating a snapshot from a branch where latest tag is a RC one, ends up in something like this: 1.2.3-rc.1.dev.0+cd60fe6 which would resolve to 1.2.3-rc.1 if you do 1.+ since 1.2.3-rc.1.dev.0+cd60fe6 < 1.2.3-rc.1 so at the end, it might be the same behavior (unintentionally though)

@rspieldenner
Copy link
Contributor

1.2.3-rc.1.dev.0+cd60fe6 was an accident of how I implemented this if we can fix to always have snapshots be -dev.# or -snapshot.timestamp that would be better

Copy link
Contributor

@rspieldenner rspieldenner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good

README.md Outdated Show resolved Hide resolved
Copy link
Member

@OdysseusLives OdysseusLives left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a request to codify the earlier question & discussion around if I have 1.2.3-snapshot.2019070511000000+abcdef and 1.2.3-rc.1 which will I get if I ask for 1.+... with a test to showcase the different semver ordering when using devSnapshot vs immutableSnapshot

@rpalcolea
Copy link
Member Author

Hi @OdysseusLives , let me know if 471dbd4 makes sense to you

@rpalcolea
Copy link
Member Author

Hey @OdysseusLives , based on our conversations and our findings in gradle/gradle#9915

I believe this change is good to go, thoughts?

@rpalcolea rpalcolea merged commit 06c6305 into master Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants