//utils 源码在jenkins-pipeline-library里
|
@Library('utils')_
|
pipeline {
|
agent { label '103' }
|
triggers {
|
GenericTrigger(
|
genericVariables: [
|
[key: 'ref', value: '$.ref']
|
],
|
causeString: 'Triggered on $ref',
|
tokenCredentialId: '6abafc9e-1f0e-4d27-8389-7c81d69bcdb2',
|
printContributedVariables: true,
|
printPostContent: true,
|
silentResponse: false,
|
regexpFilterText: '$ref',
|
regexpFilterExpression: 'refs/heads/' + BRANCH_NAME
|
)
|
}
|
environment {
|
project_name = 'git_study'
|
url = 'http://47.92.145.232:8998/r/git_study.git'
|
GIT_CREDENTIALS_ID = '6abafc9e-1f0e-4d27-8389-7c81d69bcdb2'
|
}
|
options {
|
//给日志加上时间错, 需安装 Timestamper 插件
|
timestamps()
|
|
}
|
stages {
|
stage('source') {
|
steps {
|
checkout([$class: 'GitSCM'
|
, branches: [[name: "${GIT_BRANCH}"]]
|
, doGenerateSubmoduleConfigurations: false
|
, extensions: []
|
, submoduleCfg: []
|
, userRemoteConfigs: [[credentialsId: "${GIT_CREDENTIALS_ID}", url: "${url}"]]
|
])
|
|
}
|
}
|
stage('test') {
|
steps {
|
sh 'echo test'
|
}
|
}
|
stage('version add') {
|
when {
|
allOf {
|
anyOf {
|
changeset "**/*.js"
|
changeset "**/*.css"
|
changeset "**/*.html"
|
changeset "**/*.xhtml"
|
changeset "**/*.jpg"
|
changeset "**/*.png"
|
}
|
not {
|
changeset "**/${project_name}.java"
|
}
|
}
|
}
|
// steps {
|
// versionAdd("${project_name}","${GIT_CREDENTIALS_ID}","${url}","${GIT_BRANCH}")
|
// }
|
}
|
stage('deploy') {
|
steps {
|
sh 'echo test'
|
}
|
}
|
}
|
}
|