diff --git a/Jenkinsfile b/Jenkinsfile index 2faebf49c9..cc3cb0ce47 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -134,15 +134,12 @@ node('docker') { } } - stage('Presentation Environment') { - /** - * TODO does not match docker version (scm-packaging/docker) - * build job: 'scm-manager/next-scm.cloudogu.com', propagate: false, wait: false, parameters: [ - * string(name: 'changeset', value: commitHash), - * string(name: 'imageTag', value: imageVersion) - * ] - */ - } + stage('Presentation Environment') { + build job: 'scm-manager/next-scm.cloudogu.com', propagate: false, wait: false, parameters: [ + string(name: 'changeset', value: commitHash), + string(name: 'imageTag', value: imageVersion) + ] + } if (isReleaseBranch()) { stage('Update Repository') { diff --git a/scm-packaging/docker/pom.xml b/scm-packaging/docker/pom.xml index c00379e4af..0c979fd950 100644 --- a/scm-packaging/docker/pom.xml +++ b/scm-packaging/docker/pom.xml @@ -149,7 +149,6 @@ - org.codehaus.gmavenplus gmavenplus-plugin @@ -172,21 +171,7 @@ - + diff --git a/scm-packaging/docker/src/main/build/name.groovy b/scm-packaging/docker/src/main/build/name.groovy new file mode 100644 index 0000000000..b2dbb6cd54 --- /dev/null +++ b/scm-packaging/docker/src/main/build/name.groovy @@ -0,0 +1,48 @@ +/** + * MIT License + * + * Copyright (c) 2020-present Cloudogu GmbH and Contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import java.text.SimpleDateFormat + +def repository = "docker.io/scmmanager/scm-manager" +def version = project.version + +if (version.contains("SNAPSHOT")) { + repository = "docker.io/cloudogu/scm-manager" + + def commitHash = System.getenv("GIT_COMMIT") + def buildNumber = System.getenv("BUILD_NUMBER") + + def snapshotVersion + if (commitHash != null && buildNumber != null) { + snapshotVersion = "${commitHash.substring(0,7)}-${buildNumber}" + } else { + def format = new SimpleDateFormat("yyyyMMdd-HHmmss") + snapshotVersion = format.format(new Date()) + } + + version = version.replace("SNAPSHOT", snapshotVersion) +} + +project.properties.setProperty("docker.repository", repository) +project.properties.setProperty("docker.tag", version)