Migrate helm module to gradle

This commit is contained in:
Sebastian Sdorra
2020-12-23 11:18:55 +01:00
committed by René Pfeuffer
parent ca42961131
commit 36118c2e2a
8 changed files with 88 additions and 114 deletions

View File

@@ -26,18 +26,6 @@ plugins {
id 'java-platform'
}
// set build props
project.ext {
timestamp = new Date().format('yyyyMMddHHmmSS')
revision = "git rev-parse --short HEAD".execute().text.trim()
if (project.version.contains('-SNAPSHOT')) {
expandedVersion = project.version.replace('SNAPSHOT', timestamp)
expandedVersionWithDot = project.version.replace('-SNAPSHOT', ".${timestamp}")
} else {
expandedVersion = project.version
expandedVersionWithDot = project.version
}
}
task('serve') {
dependsOn ':scm-ui:yarn_install', ':scm-webapp:serve'
@@ -134,3 +122,25 @@ subprojects {
}
}
// set build props
project.ext {
timestamp = new Date().format('yyyyMMddHHmmSS')
revision = "git rev-parse --short HEAD".execute().text.trim()
if (project.version.contains('-SNAPSHOT')) {
expandedVersion = project.version.replace('SNAPSHOT', timestamp)
expandedVersionWithDot = project.version.replace('-SNAPSHOT', ".${timestamp}")
dockerRepository = 'docker.io/cloudogu/scm-manager'
String snapshotVersion = revision
def buildNumber = System.getenv('BUILD_NUMBER')
if (buildNumber != null) {
snapshotVersion += "-${buildNumber}"
}
dockerTag = version.replace('SNAPSHOT', snapshotVersion)
} else {
expandedVersion = project.version
expandedVersionWithDot = project.version
dockerRepository = 'docker.io/scmmanager/scm-manager'
dockerTag = version.replace('SNAPSHOT', snapshotVersion)
}
}

View File

@@ -75,21 +75,15 @@ task distribution(type: DockerBuildImage) {
def images() {
def version = project.version
if (version.contains('-SNAPSHOT')) {
String snapshotVersion = revision
def buildNumber = System.getenv("BUILD_NUMBER")
if (buildNumber != null) {
snapshotVersion += "-${buildNumber}"
}
version = version.replace("SNAPSHOT", snapshotVersion)
return [
"docker.io/cloudogu/scm-manager:${version}"
"${dockerRepository}:${dockerTag}"
]
} else {
// What about patch releases?
// It is a good idea to push always latest
return [
"docker.io/scmmanager/scm-manager:${version}",
'docker.io/scmmanager/scm-manager:latest'
"${dockerRepository}:${dockerTag}",
"${dockerRepository}:latest"
]
}
}

View File

@@ -32,7 +32,7 @@
if you have to change something ensure you know what you are doing.
For further information on configuration scm-server have a look at:
https://www.scm-manager.org/docs/${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.x/en/administration/scm-server/
https://www.scm-manager.org/docs/${version.major}.${version.minor}.x/en/administration/scm-server/
-->
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">

View File

@@ -0,0 +1,59 @@
/*
* 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.
*/
plugins {
id 'org.unbroken-dome.helm' version '1.4.0'
}
helm {
downloadClient {
enabled = true
version = '3.4.2'
}
charts {
scmServer {
chartName = "scm-manager"
chartVersion = expandedVersion
version = expandedVersion
sourceDir = file('src/main/chart')
filtering {
enabled = true
values = [
dockerRepository: dockerRepository,
dockerTag: dockerTag
]
}
}
}
}
helmPackageScmServerChart {
appVersion = expandedVersion
}
task distribution {
dependsOn 'helmPackageScmServerChart'
}

View File

@@ -1,65 +0,0 @@
/**
* 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.
*/
private String getArchitecture() {
String architecture = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH)
if (architecture.equals("x86_64") || architecture.equals("amd64")) {
return "amd64"
} else if (architecture.equals("x86") || architecture.equals("i386")) {
return "386"
} else if (architecture.contains("arm64")) {
return "arm64"
} else if (architecture.equals("aarch32") || architecture.startsWith("arm")) {
return "arm"
} else if (architecture.contains("ppc64le") || (architecture.contains("ppc64") && System.getProperty("sun.cpu.endian").equals("little"))) {
return "ppc64le"
}
throw new IllegalStateException("Unsupported architecture: ${architecture}")
}
private String getExtension() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
if (osName.startsWith("windows")) {
return ".zip"
}
return "tar.gz"
}
private String getOperatingSystem() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
if (osName.startsWith("linux")) {
return "linux"
} else if (osName.startsWith("mac") || osName.startsWith("darwin")) {
return "darwin"
} else if (osName.startsWith("windows")) {
return "windows"
}
throw new IllegalStateException("Unsupported operating system: ${osName}")
}
project.properties.setProperty("helm.os", getOperatingSystem())
project.properties.setProperty("helm.arch", getArchitecture())
project.properties.setProperty("helm.ext", getExtension())

View File

@@ -1,29 +1,4 @@
#
# 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.
#
apiVersion: v1
appVersion: "1.0"
name: scm-manager
version: 0.1.0
description: The easiest way to share and manage your Git, Mercurial and Subversion repositories

View File

@@ -28,9 +28,9 @@
image:
# image.repository -- Name of SCM-Manager image
repository: ${docker.repository}
repository: ${dockerRepository}
# image.tag -- Tag of SCM-Manager image
tag: ${docker.tag}
tag: ${dockerTag}
# image.pullPolicy -- SCM-Manager image pull policy
pullPolicy: IfNotPresent

View File

@@ -43,5 +43,6 @@ include 'scm-packaging:windows'
include 'scm-packaging:deb'
include 'scm-packaging:rpm'
include 'scm-packaging:docker'
include 'scm-packaging:helm'
includeBuild '../gradle-smp-plugin'