栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在詹金斯管道中使用全局变量

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在詹金斯管道中使用全局变量

尝试遵循并查看进展情况:

def ZIP_NODEdef CODE_VERSIONpipeline{        agent {                 // where would you like to run the pre         label 'master'         }    options{        timestamps()        }    parameters {        choice(choices: ['dev'], description: 'Name of the environment', name: 'ENV')        choice(choices: ['us-east-1', 'us-west-1','us-west-2','us-east-2','ap-south-1'], description: 'What AWS region?', name: 'AWS_DEFAULT_REGION')        string(defaultValue: "", description: '', name: 'APP_VERSION')        }    stages{                stage('Initialize the variables') { // Each stage is made up of steps steps{     script{         CODE_VERSION="${BUILD_NUMBER}-${ENV}"         ZIP_NODE="abcdefgh-0.0.${CODE_VERSION}.zip"     } }  }        stage ('pre - Checkout') { steps{     println "checkout skipped"     //checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', url: 'http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.git']]])  }          }        stage ('pre - Build'){ steps{     sh "echo ${JOB_NAME} && pwd && echo ${ZIP_NODE} && echo 'remove alraedy existing zip files' && rm -rf *.zip && zip -r ${ZIP_NODE} . && chmod 777 $ZIP_NODE" }        }        stage('Deploy on Beanstalk'){ steps{     println "build job skipped"     //build job: 'abcdefgh-PHASER' , parameters: [[$class: 'StringParameterValue', name: 'vpc', value: ENV], [$class: 'StringParameterValue', name: 'ZIP_NODE', value: ZIP_NODE], [$class: 'StringParameterValue', name: 'CODE_VERSION', value: CODE_VERSION], [$class: 'StringParameterValue', name: 'APP_VERSION', value: BUILD_NUMBER], [$class: 'StringParameterValue', name: 'AWS_DEFAULT_REGION', value: AWS_DEFAULT_REGION], [$class: 'StringParameterValue', name: 'ParentJobName', value: JOB_NAME]] }        }    } }

我得到以下输出:

Started by user jenkinsRunning in Durability level: MAX_SURVIVABILITY[Pipeline] nodeRunning on Jenkins in /Users/Shared/Jenkins/Home/workspace/test[Pipeline] {[Pipeline] timestamps[Pipeline] {[Pipeline] stage[Pipeline] { (Initialize the variables)[Pipeline] script[Pipeline] {[Pipeline] }[Pipeline] // script[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (pre - Checkout)[Pipeline] echo21:19:06 checkout skipped[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (pre - Build)[Pipeline] sh21:19:06 [test] Running shell script21:19:06 + echo test21:19:06 test21:19:06 + pwd21:19:06 /Users/Shared/Jenkins/Home/workspace/test21:19:06 + echo abcdefgh-0.0.17-dev.zip21:19:06 abcdefgh-0.0.17-dev.zip21:19:06 + echo 'remove alraedy existing zip files'21:19:06 remove alraedy existing zip files21:19:06 + rm -rf '*.zip'21:19:06 + zip -r abcdefgh-0.0.17-dev.zip .21:19:06 21:19:06 zip error: Nothing to do! (try: zip -r abcdefgh-0.0.17-dev.zip . -i .)[Pipeline] }[Pipeline] // stage


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/485164.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号