From 56427a7eacf83dd755cff9906a7d4f414ee55e43 Mon Sep 17 00:00:00 2001 From: Elliot Metsger Date: Thu, 15 Oct 2020 11:50:55 -0400 Subject: [PATCH] Use the output of git-describe to tag images when the version property is absent or the empty string. --- build.gradle.kts | 13 +++++++++++++ gradle.properties | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index e8af902c..aa777d3b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,22 @@ buildscript { repositories { gradlePluginPortal() + maven { + url = uri("https://plugins.gradle.org/m2/") + } } dependencies { classpath("ca.islandora:isle-gradle-docker-plugin:0.0.1") + classpath("com.palantir.gradle.gitversion:gradle-git-version:0.12.3") } } + +allprojects { + apply(plugin = "com.palantir.git-version") + val gitVersion: groovy.lang.Closure by extra + if (version == "unspecified" || version.toString().trim() == "") { + version = gitVersion() + } +} + apply(plugin = "ca.islandora.gradle.docker") diff --git a/gradle.properties b/gradle.properties index f72501a1..c04bdac0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ org.gradle.parallel=true -# Will be used as a tag to denote the images release. +# Will be used as a tag to denote the images release. If this property is empty or undefined, the version will be +# obtained by the output of git-describe. version=0.0.1 # The project can be build with/without Buildkit for those on older versions of Docker earlier than '18.09' or who # cannot use the 'overlay2' filesystem with Docker due to using an earlier kernel version than 4.0.