Compare commits

...

7 Commits
master ... main

Author SHA1 Message Date
Roberto Cirillo a0d714606f Update 'Jenkinsfile'
syntax fix exec_label variable
2024-03-20 16:19:30 +01:00
Roberto Cirillo 82267f9ffd Merge pull request 'feature/25019' (#1) from feature/25019 into main
Reviewed-on: #1
2023-04-28 11:51:18 +02:00
Roberto Cirillo 61b759c281 removed idea folder 2023-04-28 11:50:36 +02:00
Roberto Cirillo c366969200 add gitignore 2023-04-28 11:49:04 +02:00
Roberto Cirillo 2f7a5268d7 add gitignore 2023-04-28 11:48:00 +02:00
Roberto Cirillo 0c877ead29 add default goal 2023-04-28 11:33:58 +02:00
Roberto Cirillo a9c9415009 fix comments 2023-04-28 11:16:08 +02:00
3 changed files with 15 additions and 13 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea/

23
Jenkinsfile vendored
View File

@ -1,8 +1,8 @@
// REMEMBER TO FILL THE environment section with your values. /**
// the following filed should be filled: imagename, git_url * Given a git repository and a valid branch, a maven build is performed using jdk8
// REMEMBER to put your Dockerfile in the root folder of your project *
// The related jenkinsjob template is here: * Roberto Cirillo (ISTI-CNR)
*/
pipeline { pipeline {
@ -17,11 +17,9 @@ pipeline {
JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64' JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64'
GIT_URL= "${params.GIT_URL}" GIT_URL= "${params.GIT_URL}"
GIT_BRANCH="${params.GIT_BRANCH.split('/').size() > 1 ? params.GIT_BRANCH.split('/')[1..-1].join('/') : params.GIT_BRANCH}" GIT_BRANCH="${params.GIT_BRANCH.split('/').size() > 1 ? params.GIT_BRANCH.split('/')[1..-1].join('/') : params.GIT_BRANCH}"
// GIT_BRANCH= "${params.GIT_BRANCH.split("/")[1]}"
// GIT_BRANCH= "${params.GIT_BRANCH}"
gcube_settings="${params.gcube_settings}" gcube_settings="${params.gcube_settings}"
local_repo="${params.local_repo}" local_repo="${params.local_repo}"
exe_label="${params.exec_label}" exec_label="${params.exec_label}"
} }
parameters { parameters {
string(name: 'GIT_URL', string(name: 'GIT_URL',
@ -41,7 +39,10 @@ pipeline {
description: 'Run on all nodes matching the label') description: 'Run on all nodes matching the label')
string(name: 'build_options', string(name: 'build_options',
defaultValue: '', defaultValue: '',
description: 'Additional options for Maven.') description: 'Additional options for Maven.')
string(name: 'maven_goal',
defaultValue: 'clean deploy',
description: 'maven goal. Useful if deploy is not needed')
} }
agent agent
{ {
@ -64,7 +65,7 @@ pipeline {
} }
stage('Build the job') { stage('Build the job') {
steps { steps {
sh 'mvn --settings $MAVEN_CONFIG_FOLDER/$gcube_settings -Dmaven.repo.local=$MAVEN_CONFIG_FOLDER/$local_repo $build_options dependency:tree clean deploy' sh 'mvn --settings $MAVEN_CONFIG_FOLDER/$gcube_settings -Dmaven.repo.local=$MAVEN_CONFIG_FOLDER/$local_repo $build_options dependency:tree $maven_goal'
} }
} }
@ -75,7 +76,7 @@ pipeline {
} }
} }
} }
// post-build actions // post-build actions
post { post {
success { success {
echo 'The gCubeBuild pipeline worked!' echo 'The gCubeBuild pipeline worked!'

View File

@ -1,14 +1,14 @@
# Pipeline gCubeBuild # Pipeline gCubeBuild
Given a git repository and a valid branch, a maven build is performed using jdk8. Given a git repository and a valid branch, a maven build is performed using jdk8.
For the moment a predefined goal is set inside the pipeline: "clean deploy" Predefined maven goal: "clean deploy". It's possible to add further build options by input parameter
## USAGE TIPS: ## USAGE TIPS:
It can be added to a jenkinsjob or invoked manually It can be added to a jenkinsjob or invoked manually
### Expected parameters ### Expected parameters (mandatory)
GIT_URL url of the project to build; GIT_URL url of the project to build;