reckon icon indicating copy to clipboard operation
reckon copied to clipboard

Feature request: write the reckoned version to a buildDir file

Open djechelon opened this issue 3 years ago • 1 comments

Why?

I am using Azure DevOps Pipelines, and one of my dirty tasks is to identify the artifact version to be used in the next stages, especially when the artifact is a Docker artifact

Currently, Jib writes the Docker Image ID to $buildDir/jib-image.id, which is damn cool.

What if reckon writes a similar file? I could catch up in a subsequent step, using vso.setVariable consuming the contents of the file. This way, the assigned artifact version will be available to subsequent DevOps stages and steps

djechelon avatar Jan 10 '22 11:01 djechelon

I'm on the fence about whether this should be part of the plugin. But in the meantime, this is pretty easy to just add to your build.gradle.

tasks.register('versionFile') {
  doLast {
    file("${buildDir}/version.txt").text = version.toString()
  }
}

You could do more to add inputs that avoid re-writing it, but it depends on the use case. If you only run it when publishing (or in a clean repo state in CI) you can keep it simple.

ajoberstar avatar Feb 12 '22 14:02 ajoberstar

No plan to provide this in the plugin, the workaround posted earlier should meet the need though.

ajoberstar avatar Dec 30 '23 21:12 ajoberstar