markdown 管道示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 管道示例相关的知识,希望对你有一定的参考价值。

# Jenkins Pipeline 简介

Jenkins Pipeline (or simply "Pipeline") provides an extensible set of tools for modeling simple-to-complex delivery pipelines `"as code"`. The definition of a Jenkins Pipeline is typically written into a text file (called a `Jenkinsfile`) which in turn is checked into a project’s source control repository.

## Pipeline 定义

- Declarative Pipeline
- Scripted Pipeline (a limited form of Groovy)

Both are DSLs to describe portions of your software delivery pipeline.

Pipeline 可以使用下面三种方法创建:

- Through Blue Ocean
- Through the classic UI
- In SCM

## Jenkinsfile

Jenkinsfile (Declarative Pipeline)

```groovy
pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building..'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing..'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying....'
            }
        }
    }

    post {
        always {
            junit '**/target/*.xml'
        }
        failure {
            mail to: team@example.com, subject: 'The Pipeline failed :('
        }
    }
}
```

## 全局变量

The **Global Variable Reference** only contains documentation for variables provided by Pipeline or plugins.

<http://localhost:8080/pipeline-syntax/globals>

### env

Environment variables can be set globally or per stage. Setting environment variables per stage means they will only apply to the stage in which they’re defined.

`env.PATH`

```groovy
pipeline {
    agent any

    environment {
        COOKBOOK = 'propel_ha'
    }

    stages {
        stage('Build') {
            environment {
                DEPLOY_UI = 'yes'
            }
            steps {
                echo "Global Environment Variable COOKBOOK = $env.COOKBOOK"
                echo "Stage Environment Variable DEPLOY_UI = $env.DEPLOY_UI"

                sh 'env'
            }
        }
    }
}
```

### params

`params.sap_adapter_gitsha`

### currentBuild

`currentBuild.result`

以上是关于markdown 管道示例的主要内容,如果未能解决你的问题,请参考以下文章

markdown 管道OSB。

markdown Angular - 使用货币格式管道

markdown 资产管道

markdown Bitbucket管道基地

markdown [Koa路由]如何管道koa步骤和路由器#koa #koarouter#node.js #javascript

The usage of Markdown---表格