Skip to content

Instantly share code, notes, and snippets.

@shenxianpeng
Last active February 8, 2020 02:45
Show Gist options
  • Select an option

  • Save shenxianpeng/8f94f8198a6c81e1579765103c1d0e61 to your computer and use it in GitHub Desktop.

Select an option

Save shenxianpeng/8f94f8198a6c81e1579765103c1d0e61 to your computer and use it in GitHub Desktop.
used Jenkins lock for install on different platforms
/*
* This Jenkinsfile used for install build on different platform
*
* Created by Xianpeng Shen at 10/9/2019
*/
pipeline {
agent {
node {
label 'PreDevENV'
}
}
options {
lock(label: 'PreDevENV', quantity: 1)
}
parameters {
choice(
name: 'product',
choices: ['v1.1', 'v2.1', 'v3.1'],
description: 'Required: which version do you want to install')
booleanParam(defaultValue: false, name: 'Linux', description: 'Install build on Linux')
booleanParam(defaultValue: false, name: 'AIX', description: 'Install build on AIX')
booleanParam(defaultValue: false, name: 'Solris',description: 'Install build on Solris')
booleanParam(defaultValue: false, name: 'HP', description: 'Install build on HP-UX')
}
stages {
stage("Main Stage") {
steps {
script {
if (params.Linux) {
stage ('Get Linux Release Build') {
echo 'clean linux'
}
}
if (params.AIX) {
stage ('Get AIX Release Build') {
echo 'clean AIX'
}
}
if (params.Solris) {
stage ('Get Solris Release Build') {
echo 'clean Solris'
}
}
if (params.HP) {
stage ('Get HP-UX Release Build') {
echo 'clean HP-UX'
}
}
}
}
}
stage('Get Realse Build'){
steps {
echo "git clone source"
}
}
stage('Start Installation'){
steps {
echo "start build"
}
}
stage('Installation Success'){
steps{
echo "Installation Success"
}
}
stage('Are you finished?'){
steps {
input message: "If you finished useing, please click Proceed to free resource?"
echo "Yes, I have finished"
// unlock(label: 'PreDevENV')
}
}
stage('Clean Installation Workspace'){
steps {
echo "cleanup"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment