Migrate rpm module to docker

This commit is contained in:
Sebastian Sdorra
2020-12-23 09:26:57 +01:00
committed by René Pfeuffer
parent 713f4c3dfb
commit c91ff8298c
8 changed files with 156 additions and 6 deletions

View File

@@ -24,7 +24,7 @@
import org.gradle.util.VersionNumber
plugins {
id "nebula.ospackage" version "8.4.1"
id 'nebula.ospackage' version '8.4.1'
}
configurations {
@@ -38,11 +38,20 @@ dependencies {
webapp project(path: ':scm-webapp', configuration: 'webapp')
}
def createVersion() {
def version = project.version
if (version.contains('-SNAPSHOT')) {
version = version.replace('-SNAPSHOT', new Date().format('yyyyMMddHHmmSS'))
}
return version
}
task distribution(type: Deb) {
packageName 'scm-server'
packageGroup 'devel'
summary 'SCM-Manager Server'
packageDescription 'The easiest way to share and manage your Git, Mercurial and Subversion repositories'
version project.version
version createVersion()
arch 'all'
priority 'extra'
maintainer 'SCM-Team <scm-team@cloudogu.com>'
@@ -57,8 +66,8 @@ task distribution(type: Deb) {
recommends 'openjdk-11-jre-headless'
recommends 'mercurial'
preInstallFile file('src/main/deb/preinst')
postInstallFile file('src/main/deb/postinst')
preInstallFile file('src/main/scripts/preinst')
postInstallFile file('src/main/scripts/postinst')
VersionNumber version = VersionNumber.parse(project.version)

View File

@@ -11,6 +11,6 @@ Vagrant.configure("2") do |config|
end
config.vm.provision "shell", inline: <<-SHELL
yum install -y /vagrant/target/scm-server-*.rpm
yum install -y /vagrant/build/distributions/scm-server-*.rpm
SHELL
end

View File

@@ -0,0 +1,139 @@
/*
* 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 org.gradle.util.VersionNumber
plugins {
id 'nebula.ospackage' version '8.4.1'
}
configurations {
server
webapp
}
dependencies {
server project(':scm-server')
webapp project(path: ':scm-webapp', configuration: 'webapp')
}
def createVersion() {
def version = project.version
if (version.contains('-SNAPSHOT')) {
version = version.replace('-SNAPSHOT', new Date().format('yyyyMMddHHmmSS'))
}
return version
}
task distribution(type: Rpm) {
packageName 'scm-server'
packageGroup 'Development/Tools'
summary 'SCM-Manager Server'
packageDescription 'The easiest way to share and manage your Git, Mercurial and Subversion repositories'
version createVersion()
license 'MIT'
arch 'NOARCH'
os LINUX
packager 'SCM-Team <scm-team@cloudogu.com>'
url 'https://scm-manager.org'
requires 'procps'
// recommends (weak dependency) is not supported,
// so we define a hard dependencies for java and mercurial
requires 'java-11-openjdk-headless'
requires 'mercurial'
preInstall file('src/main/scripts/before-installation.sh')
postInstall file('src/main/scripts/after-installation.sh')
VersionNumber version = VersionNumber.parse(project.version)
from('src/main/bin') {
into '/opt/scm-server/bin'
user 'root'
permissionGroup 'scm'
fileMode 0750
}
from('src/main/fs/etc/default/scm-server') {
fileType CONFIG | NOREPLACE
into '/etc/default'
user 'root'
permissionGroup 'scm'
fileMode 0640
}
from('src/main/fs/etc/scm') {
fileType CONFIG | NOREPLACE
into '/etc/scm'
user 'root'
permissionGroup 'scm'
fileMode 0640
expand([version: version])
}
from('src/main/fs/etc/systemd') {
into '/etc/systemd'
user 'root'
permissionGroup 'root'
fileMode 0644
}
from('src/main/fs/opt') {
into '/opt'
user 'root'
permissionGroup 'scm'
fileMode 0644
}
from(project.configurations.server) {
into '/opt/scm-server/lib'
user 'root'
permissionGroup 'scm'
fileMode 0644
}
from(project.configurations.webapp) {
into '/opt/scm-server/var/webapp'
user 'root'
permissionGroup 'scm'
fileMode 0644
rename {
'scm-webapp.war'
}
}
['/run/scm', '/var/log/scm', '/var/lib/scm', '/var/cache/scm', '/var/cache/scm/work'].each { dir ->
from('src/main/emptydir') {
into dir
user 'scm'
permissionGroup 'scm'
fileMode 0750
createDirectoryEntry true
}
}
link '/opt/scm-server/var/log', '/var/log/scm'
link '/opt/scm-server/conf', '/etc/scm'
link '/opt/scm-server/work', '/var/cache/scm/work'
}

View File

@@ -0,0 +1 @@
We could not create empty dir, so we put a dummy file into it

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

@@ -41,5 +41,6 @@ include 'scm-server'
include 'scm-packaging:unix'
include 'scm-packaging:windows'
include 'scm-packaging:deb'
include 'scm-packaging:rpm'
includeBuild '../gradle-smp-plugin'