Skip to content

Instantly share code, notes, and snippets.

@bmvakili
Created May 14, 2018 02:46
Show Gist options
  • Save bmvakili/2b5c0bdc47cb81ea63a71c9c46c7eb59 to your computer and use it in GitHub Desktop.
Save bmvakili/2b5c0bdc47cb81ea63a71c9c46c7eb59 to your computer and use it in GitHub Desktop.
Liferay example Jenkinsfile
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '21', artifactNumToKeepStr: '50'))
timestamps()
timeout(time: 5, unit: 'MINUTES')
}
parameters{
string(name: 'JAVA_HOME', defaultValue: '/var/jenkins_home/tools/hudson.model.JDK/JDK_7u80/', description: 'JDK', )
}
environment {
ant_options_common_portlet = " -f plugins/portlets/example-common-portlet/build.xml -Dservice.input.file=./docroot/WEB-INF/src/com/example/portlets/dashboard/service.xml "
ant_options_portlets = " -f plugins/portlets/build.xml "
ant_options_hooks = " -f plugins/hooks/build.xml "
ant_options_theme_private = " -f plugins/themes/condominium-site-private-pages-theme/build.xml "
ant_options_theme_public = " -f plugins/themes/condominium-site-public-pages-theme/build.xml "
ant_options_theme_miscellaneous = " -f plugins/themes/example-miscellaneous-theme/build.xml "
}
stages {
stage('Checkout') {
steps {
sh 'ls'
sh 'pwd'
git([url: 'ssh://git@git.example.com:2222/example/example.git', branch: 'master'])
sh 'ls'
sh 'echo who am i'
sh 'whoami'
sh 'ls plugins'
}
}
stage('Build') {
parallel {
stage('Build private theme') {
agent {
docker {
image 'bmvakili/jenkins-build-agent:agent1'
args '-u root'
}
}
steps {
sh 'echo inside docker'
sh 'which git'
sh 'which ant'
sh 'ls'
sh 'pwd'
git([url: 'ssh://git@git.example.com:2222/example/example.git', branch: 'master'])
withAnt(installation: 'Version 1.9.6', jdk: 'JDK 7u80') {
sh "ant ${ant_options_theme_private} war"
}
sh 'ls'
}
}
stage('Build public theme') {
agent {
docker {
image 'bmvakili/jenkins-build-agent:agent2'
args '-u root'
}
}
steps {
sh 'ls'
sh 'pwd'
git([url: 'ssh://git@git.example.com:2222/example/example.git', branch: 'master'])
withAnt(installation: 'Version 1.9.6', jdk: 'JDK 7u80') {
sh "ant ${ant_options_theme_public} war"
}
sh 'ls'
}
}
stage('Build Mescellaneous theme') {
agent {
docker {
image 'bmvakili/jenkins-build-agent:latest'
args '-u root'
}
}
steps {
sh 'ls'
sh 'pwd'
git([url: 'ssh://git@git.example.com:2222/example/example.git', branch: 'master'])
withAnt(installation: 'Version 1.9.6', jdk: 'JDK 7u80') {
sh "ant ${ant_options_theme_miscellaneous} war"
}
sh 'ls'
}
}
stage('Build Porltets') {
agent {
docker {
image 'bmvakili/jenkins-build-agent:latest'
args '-u root'
}
}
steps {
sh 'ls'
sh 'pwd'
git([url: 'ssh://git@git.example.com:2222/example/example.git', branch: 'master'])
withAnt(installation: 'Version 1.9.6', jdk: 'JDK 7u80') {
sh "ant ${ant_options_common_portlet} build-service"
sh "ant ${ant_options_portlets} build-service war"
}
sh 'ls'
}
}
stage('Build Hooks') {
agent {
docker {
image 'bmvakili/jenkins-build-agent:latest'
args '-u root'
}
}
steps {
sh 'echo inside docker'
sh 'ls'
sh 'pwd'
git([url: 'ssh://git@git.example.com:2222/example/example.git', branch: 'master'])
withAnt(installation: 'Version 1.9.6', jdk: 'JDK 7u80') {
sh "ant ${ant_options_hooks} war"
}
sh 'ls'
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment