Skip to content
Snippets Groups Projects
Commit 3e38c6a4 authored by OZGCloud's avatar OZGCloud
Browse files

add Jenkinsfile

parent ba63b75d
Branches
Tags
No related merge requests found
pipeline {
agent {
node {
label 'jenkins-build-agent-jdk-11'
}
}
environment {
BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/job/ozgcloud-formcycle-plugin/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
FAILED_STAGE = ""
SH_SUCCESS_STATUS_CODE = 0
PLUTO_INTERFACE_VERSION="1.6.0"
FORMSOLUTIONS_INTERFACE_VERSION="1.5.0"
}
options {
timeout(time: 1, unit: 'HOURS')
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '5'))
}
stages {
stage('build pluto-interface for java 11') {
steps {
script {
clonePlutoRepo()
}
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --version'
sh 'mvn -f pluto/pluto-interface -s $MAVEN_SETTINGS -Djava.version=11 install'
}
}
}
stage('build formcycle-interface for java 11') {
steps {
script {
cloneIntelliformAdapterRepo()
}
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --version'
sh 'mvn -f intelliform-adapter/formcycle-adapter/formcycle-adapter-interface -s $MAVEN_SETTINGS -Djava.version=11 install'
}
}
}
stage('Maven Build') {
steps {
script {
FAILED_STAGE=env.STAGE_NAME
}
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --version'
sh 'mvn -s $MAVEN_SETTINGS -P ci-build clean install -Dmaven.wagon.http.retryHandler.count=3'
script {
//try {
if (env.BRANCH_NAME == 'master') {
withSonarQubeEnv('sonarqube-ozg-sh'){
sh 'mvn -s $MAVEN_SETTINGS sonar:sonar'
}
}
//} catch (Exception e) {
//unstable("SonarQube failed")
//}
}
}
}
post {
always{
junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true
}
}
}
stage('Deploy FormCycle Plugin to FC-server') {
when {
anyOf {
branch 'master'
}
}
steps {
script {
FAILED_STAGE=env.STAGE_NAME
}
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --version'
sh 'mvn -s $MAVEN_SETTINGS -P ci-build package fc-deploy:deploy -DfcDeployUrl="https://formcycle.dev.ozg-sh.de/formcycle" -DfcDeployClientId="2" -DfcDeployToken=adminhase23 -DskipTests=true -Dmaven.wagon.http.retryHandler.count=3'
}
}
post {
always{
junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true
}
}
}
}
}
Void clonePlutoRepo() {
withCredentials([usernamePassword(credentialsId: 'jenkins-gitea-access-token', passwordVariable: 'TOKEN', usernameVariable: 'USER')]) {
sh 'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/pluto.git'
}
dir("pluto") {
sh 'git checkout tags/${PLUTO_INTERFACE_VERSION} -b branch'
}
configureGit("pluto")
}
Void cloneIntelliformAdapterRepo() {
withCredentials([usernamePassword(credentialsId: 'jenkins-gitea-access-token', passwordVariable: 'TOKEN', usernameVariable: 'USER')]) {
sh 'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/intelliform-adapter.git'
}
dir("intelliform-adapter") {
sh 'git checkout tags/${FORMSOLUTIONS_INTERFACE_VERSION} -b branch'
}
configureGit("intelliform-adapter")
}
Void configureGit(String directory) {
final email = "jenkins@ozg-sh.de"
final name = "jenkins"
dir(directory) {
sh "git config user.email '${email}'"
sh "git config user.name '${name}'"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment