From 8e74f6e9d9e7db84b073e6e13e085417a1ae574c Mon Sep 17 00:00:00 2001
From: wangzilun <964606955@qq.com>
Date: Thu, 27 Jul 2023 14:20:57 +0800
Subject: [PATCH] test16
---
Jenkinsfile | 111 +++++++------------------------------------------------
1 files changed, 15 insertions(+), 96 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index a29acb0..bcf4b34 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,98 +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')
-
- }
- 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 '''
- #定义颜色的变量
- RED_COLOR='\\E[1;31m' #红
- GREEN_COLOR='\\E[1;32m' #绿
- YELOW_COLOR='\\E[1;33m' #黄
- BLUE_COLOR='\\E[1;34m' #蓝
- PINK='\\E[1;35m' #粉红
- RES='\\E[0m'
-
- #需要使用echo -e
- echo -e "\${RED_COLOR}======red color======\${RES}"
- echo -e "\${YELOW_COLOR}======yelow color======\${RES}"
- echo -e "\${BLUE_COLOR}======green color======\${RES}"
- echo -e "\${GREEN_COLOR}======green color======\${RES}"
- echo -e "\${PINK}======pink color======\${RES}"
- echo "#######################################"
- #直接把echo -e放到变量里面,使用的时候直接输出变量即可
- SETCOLOR_SUCCESS="echo -en \\\\033[1;32m"
- SETCOLOR_FAILURE="echo -en \\\\033[1;31m"
- SETCOLOR_WARNING="echo -en \\\\033[1;33m"
- SETCOLOR_NORMAL="echo -en \\\\033[0;39m"
- echo ----成功了!----- && \$SETCOLOR_SUCCESS
- echo ----失败了!----- && \$SETCOLOR_FAILURE
- echo ----需注意!----- && \$SETCOLOR_WARNING
- echo ----正常的!----- && \$SETCOLOR_NORMAL
-
- echo "BRANCH ${GIT_BRANCH}"
- printenv
- '''
- test("${project_name}","${GIT_CREDENTIALS_ID}","${url}","${GIT_BRANCH}")
- }
- }
- 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{
- step{
- 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