Jenkinsfile

pipeline {
    agent {
        label 'master'
    }
    parameters {
		extendedChoice( 
			defaultValue: '', 
			description: '选择发布模块', 
			multiSelectDelimiter: ',', 
			name: 'module', 
			quoteValue: false, 
			saveJSONParameterToFile: false, 
			type: 'PT_CHECKBOX', 
			value:'mall-page,mall-goods,mall-promotion', 
			visibleItemCount: 10)
        gitParameter(branch: '',
                     defaultValue: 'master',
                     branchFilter: 'origin/(.*)',
                     description: '',
                     name: 'BRANCH',
                     quickFilterEnabled: false,
                     selectedValue: 'NONE',
                     sortMode: 'NONE',
                     tagFilter: '*',
                     type: 'PT_BRANCH')	
      
	}	
    options {
        skipDefaultCheckout(true)
        buildDiscarder(logRotator(daysToKeepStr: '5', numToKeepStr: '8'))
    }
    stages{  
        stage('get code'){
            steps{
                git branch: "${params.BRANCH}", credentialsId: 'gitlab', url: 'http://gitlab.xxx.com/evolut-backend/evolut-esign.git'
            }
        }
        stage('mall-page'){
            when {
                expression { return "$params.module".contains('mall-page')}
            }
            steps {
				sh '''
			    ip add		
				'''
            }			
        }
        stage('mall-goods'){
            when {
                expression { return "$params.module".contains('mall-goods')}
            }
            steps {
				sh '''
			    ls
				'''
            }			
        }
        stage('mall-promotion'){
            when {
                expression { return "$params.module".contains('mall-promotion')}
            }
            steps {
				sh '''
					pwd	
				'''				                 
            }			
        }





	}
}
posted @ 2022-06-28 14:33  博客萨斯州  阅读(172)  评论(0编辑  收藏  举报