Webhook Trigger
东北小麦客 2024-06-05 DockerJenkinsWebhook
# 参考资料
# Tips:
Jenkins
版本v2.506# 依赖的
Jenkins
插件
- Gitee v1170.v3d4640b_34233 [方式二: Generic Webhook Trigger Plugin v2.3.1]
- NodeJS Plugin v1.6.4
- Publish Over SSH v387.vec3df0f668cd
pipeline {
agent any
triggers {
gitee (
// Push code
triggerOnPush: true,
// Comment submission record
triggerOnCommitComment: true,
// New Pull Requests
triggerOnOpenPullRequest: true,
// Update Pull Requests "0":None "1":Source Branch updated "2":Target Branch updated "3":Both Source and Target Branch updated
triggerOnUpdatePullRequest: "1",
// accept Pull Requests
triggerOnAcceptedPullRequest: true,
// Close Pull Requests
triggerOnClosedPullRequest: true,
// Approved Pull Requests
triggerOnApprovedPullRequest: true,
// Test passed Pull Requests
triggerOnTestedPullRequest: true,
// comment Pull Requests
triggerOnNoteRequest: true,
// Regular expression for comment content
noteRegex: "build",
// Build command filtering "NONE": None "CI_SKIP":[ci-skip] command to skip building "CI_BUILD":[ci-build] command to trigger build
buildInstructionFilterType: "NONE",
// PR does not require that you filter the build when you have to test
ciSkipFroTestNotRequired: false,
// Filter the Commit version that has been built
skipLastCommitHasBeenBuild: false,
// Cancel the same Pull Requests incomplete construction
cancelIncompleteBuildOnSamePullRequest: false,
// Branches allowed to trigger construction "All": Allow all branches to trigger construction "NameBasedFilter": Filter by branch name "RegexBasedFilter":Filter branches based on regular expressions
branchFilterType: "All",
// "NameBasedFilter" - include
includeBranchesSpec: "include",
// "NameBasedFilter" - exclude
excludeBranchesSpec: "exclude",
// "RegexBasedFilter" - Regular expression of the target branch
targetBranchRegex: "regex",
// Gitee WebHook password TODO !!!
secretToken: "123"
)
}
stages {
stage('GiteeBranch Pull Code') {
steps {
echo """要打包的git分支: dev"""
git branch: 'dev', credentialsId: '7ef3ae77-gitee仓库链接生成的通行证', url: 'http://gitee仓库的url链接'
}
}
stage('Npm Install packages') {
steps {
nodejs(configId: '03281675-npm配置文件ID', nodeJSInstallationName: 'node_18.13.0') {
echo 'node_18.13.0 安装依赖'
sh 'npm i'
}
}
}
stage('Npm Build') {
steps {
nodejs('node_18.13.0') {
echo """开始打包: ---dev---分支"""
sh """
npm run build
"""
}
}
}
stage('r3f应用部署至-测试服'){
steps{
sshPublisher(
publishers: [
sshPublisherDesc(
configName: 'dev_tag',
transfers: [sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: '',
execTimeout: 120000, flatten: false,makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: ''
)],
usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)
]
)
echo "r3f应用部署完成~"
}
}
}
}