From d7b8964b2fa6b7906ae7dea020cbe0dd2ed30c10 Mon Sep 17 00:00:00 2001
From: wangzilun <964606955@qq.com>
Date: Thu, 27 Jul 2023 11:14:12 +0800
Subject: [PATCH] test9
---
Jenkinsfile | 81 +++++++---------------------------------
1 files changed, 15 insertions(+), 66 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 4fec215..bcf4b34 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,68 +1,17 @@
//utils 源码在jenkins-pipeline-library里
@Library('utils')_
-pipeline {
- agent { label '103' }
-
- 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()
- ansiColor('xterm')
- //丢弃旧的构建前两个为发布包保留天数(比此早的发布包将被删除,但构建的日志、操作历史、报告等将被保留)和构建个数
- buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '10')
-
- }
- 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 {
- not {
- branch 'master'
- }
- anyOf {
- changeset "**/*.js"
- changeset "**/*.css"
- changeset "**/*.html"
- changeset "**/*.xhtml"
- changeset "**/*.jpg"
- changeset "**/*.png"
- }
- not {
- changeset "**/${project_name}.java"
- }
- }
- }
- steps{
- echo "todo add version"
- }
-
- }
- stage('deploy') {
- when { branch 'master' }
- steps {
- sh 'echo test'
- }
- }
- }
-}
\ No newline at end of file
+/**
+ *
+ * @param project_name 项目名
+ * @param url git 链接
+ * @param default_deploy_to 部署到哪个环境,默认develop
+ * @param default_maven_deploy 执行mvn deploy,默认false
+ * @param default_master_add_version master分支的更改是否强制添加版本号,默认true
+ * @return
+ */
+pipelineScript1(
+ project_name:'git_study',
+ url:'http://47.92.145.232:8998/r/git_study.git',
+ default_deploy_to:'',
+ default_maven_deploy:true
+)
\ No newline at end of file
--
Gitblit v1.9.1