initial commit
This commit is contained in:
29
src/main/groovy/util/DockerImageNames.groovy
Normal file
29
src/main/groovy/util/DockerImageNames.groovy
Normal file
@@ -0,0 +1,29 @@
|
||||
package util
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
class DockerImageNames {
|
||||
|
||||
static String getImageTag(String baseName, String dockerfile) {
|
||||
def imageTagPostfix = CIProperties.findProperty("docker.image.tag.${dockerfile.toLowerCase()}.postfix").orElse("")
|
||||
return "${baseName}${imageTagPostfix}"
|
||||
}
|
||||
|
||||
static String getImageName(String dockerfileName) {
|
||||
def propertyNames = [
|
||||
"docker.image.${dockerfileName.toLowerCase()}.name",
|
||||
"docker.image.base.name"
|
||||
]
|
||||
|
||||
return propertyNames.stream()
|
||||
.map { it.toString() }
|
||||
.map {
|
||||
CIProperties.findProperty(it).orNull()
|
||||
}
|
||||
.filter { it != null }
|
||||
.findFirst()
|
||||
.orElseThrow { new NoSuchElementException("There is no one property set: ${propertyNames}") }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user