-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4579f70
commit 00f75fa
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
pipeline { | ||
agent any | ||
options { | ||
checkoutToSubdirectory('b2share-nagios-plugin') | ||
} | ||
environment { | ||
PROJECT_DIR="b2share-nagios-plugin" | ||
GIT_COMMIT=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\"",returnStdout: true).trim() | ||
GIT_COMMIT_HASH=sh(script: "cd ${WORKSPACE}/$PROJECT_DIR && git log -1 --format=\"%H\" | cut -c1-7",returnStdout: true).trim() | ||
GIT_COMMIT_DATE=sh(script: "date -d \"\$(cd ${WORKSPACE}/$PROJECT_DIR && git show -s --format=%ci ${GIT_COMMIT_HASH})\" \"+%Y%m%d%H%M%S\"",returnStdout: true).trim() | ||
|
||
} | ||
stages { | ||
stage ('Build'){ | ||
parallel { | ||
stage ('Build Centos 6') { | ||
agent { | ||
docker { | ||
image 'argo.registry:5000/epel-6-ams' | ||
args '-u jenkins:jenkins' | ||
} | ||
} | ||
steps { | ||
echo 'Building Rpm...' | ||
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \ | ||
keyFileVariable: 'REPOKEY')]) { | ||
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos6 -p ${PROJECT_DIR} -s ${REPOKEY}" | ||
} | ||
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true | ||
} | ||
} | ||
stage ('Build Centos 7') { | ||
agent { | ||
docker { | ||
image 'argo.registry:5000/epel-7-ams' | ||
args '-u jenkins:jenkins' | ||
} | ||
} | ||
steps { | ||
echo 'Building Rpm...' | ||
withCredentials(bindings: [sshUserPrivateKey(credentialsId: 'jenkins-rpm-repo', usernameVariable: 'REPOUSER', \ | ||
keyFileVariable: 'REPOKEY')]) { | ||
sh "/home/jenkins/build-rpm.sh -w ${WORKSPACE} -b ${BRANCH_NAME} -d centos7 -p ${PROJECT_DIR} -s ${REPOKEY}" | ||
} | ||
archiveArtifacts artifacts: '**/*.rpm', fingerprint: true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
cleanWs() | ||
} | ||
success { | ||
script{ | ||
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { | ||
slackSend( message: ":rocket: New version for <https://jenkins.einfra.grnet.gr/job/ARGO/job/$PROJECT_DIR/|$PROJECT_DIR>!") | ||
} | ||
} | ||
} | ||
failure { | ||
script{ | ||
if ( env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'devel' ) { | ||
slackSend( message: ":rain_cloud: Build Failed for <https://jenkins.einfra.grnet.gr/job/ARGO/job/$PROJECT_DIR/|$PROJECT_DIR>. Branch: $BRANCH_NAME Job: [$JOB_NAME]") | ||
} | ||
} | ||
} | ||
} | ||
} |