小编use*_*418的帖子

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

我尝试了各种方式,但似乎没有任何效果。这是我的詹金文件。

def ZIP_NODE
def CODE_VERSION
pipeline{
    /*A declarative pipeline*/

    agent {
        /*Agent section*/ 
        // where would you like to run the code 
        label 'ubuntu' 
        }
    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{
        /*stages section*/
        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 ('code - …
Run Code Online (Sandbox Code Playgroud)

groovy jenkins jenkins-pipeline

11
推荐指数
4
解决办法
2万
查看次数

使用特定提交 ID 构建手动 GitlabCI 管道作业

我需要手动构建 Gitlab CI 管道,但不使用最新的 master 分支,而是使用特定的 commitID。我尝试通过使用如下变量并传递其值来手动运行管道,但没有用。

Input variable key: CI_COMMIT_SHA
Run Code Online (Sandbox Code Playgroud)

continuous-integration gitlab gitlab-ci devops jenkins-pipeline

6
推荐指数
1
解决办法
5833
查看次数