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

Publish only the -SNAP docker tag for snapshot sbt dockerBuildAndPush. #4662

Merged
merged 1 commit into from Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions project/Publishing.scala
Expand Up @@ -22,16 +22,17 @@ object Publishing {
versions.

`sbt 'show docker::imageNames'` returns:
ArrayBuffer(broadinstitute/womtool:30, broadinstitute/womtool:30-c33be41-SNAP)
ArrayBuffer(broadinstitute/cromwell:30, broadinstitute/cromwell:30-c33be41-SNAP)
ArrayBuffer(broadinstitute/womtool:30-c33be41-SNAP)
ArrayBuffer(broadinstitute/cromwell:30-c33be41-SNAP)

`CROMWELL_SBT_DOCKER_TAGS=dev,develop sbt 'show docker::imageNames'` returns:
ArrayBuffer(broadinstitute/womtool:dev, broadinstitute/womtool:develop)
ArrayBuffer(broadinstitute/cromwell:dev, broadinstitute/cromwell:develop)
*/
dockerTags := sys.env
.getOrElse("CROMWELL_SBT_DOCKER_TAGS", s"$cromwellVersion,${version.value}")
.split(","),
dockerTags := {
val versionsCsv = if (Version.isSnapshot) version.value else s"$cromwellVersion,${version.value}"
sys.env.getOrElse("CROMWELL_SBT_DOCKER_TAGS", versionsCsv).split(",")
},
imageNames in docker := dockerTags.value map { tag =>
ImageName(namespace = Option("broadinstitute"), repository = name.value, tag = Option(tag))
},
Expand Down
11 changes: 8 additions & 3 deletions project/Version.scala
Expand Up @@ -7,6 +7,14 @@ object Version {
// Upcoming release, or current if we're on a master / hotfix branch
val cromwellVersion = "38"

/**
* Returns true if this project should be considered a snapshot.
*
* The value is read in directly from the system property `project.isSnapshot` as there were confusing issues with
* the multi-project and sbt.Keys#isSnapshot().
*/
val isSnapshot = sys.props.get("project.isSnapshot").forall(_.toBoolean)

// Adapted from SbtGit.versionWithGit
def cromwellVersionWithGit: Seq[Setting[_]] =
Seq(
Expand Down Expand Up @@ -71,9 +79,6 @@ object Version {
//Now we fall through the potential version numbers...
val version = overrideVersion orElse commitVersion getOrElse unknownVersion

// The project isSnapshot string passed in via command line settings, if desired.
val isSnapshot = sys.props.get("project.isSnapshot").forall(_.toBoolean)

// For now, obfuscate SNAPSHOTs from sbt's developers: https://github.com/sbt/sbt/issues/2687#issuecomment-236586241
if (isSnapshot) s"$version-SNAP" else version
}
Expand Down