jenkins evironment
Using environment variables
https://www.jenkins.io/doc/pipeline/tour/environment/
pipeline { agent { label '!windows' } environment { DISABLE_AUTH = 'true' DB_ENGINE = 'sqlite' } stages { stage('Build') { steps { echo "Database engine is ${DB_ENGINE}" echo "DISABLE_AUTH is ${DISABLE_AUTH}" sh 'printenv' } } } }
https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
pipeline { agent any stages { stage('Example') { steps { echo "Running ${env.BUILD_ID} on ${env.JENKINS_URL}" } } } }
pipeline { agent any environment { CC = 'clang' } stages { stage('Example') { environment { DEBUG_FLAGS = '-g' } steps { sh 'printenv' } } } }
pipeline { agent any environment { // Using returnStdout CC = """${sh( returnStdout: true, script: 'echo "clang"' )}""" // Using returnStatus EXIT_STATUS = """${sh( returnStatus: true, script: 'exit 1' )}""" } stages { stage('Example') { environment { DEBUG_FLAGS = '-g' } steps { sh 'printenv' } } } }
https://www.jenkins.io/doc/pipeline/steps/credentials-binding/
pipeline { agent { // Define agent details here } environment { AWS_ACCESS_KEY_ID = credentials('jenkins-aws-secret-key-id') AWS_SECRET_ACCESS_KEY = credentials('jenkins-aws-secret-access-key') } stages { stage('Example stage 1') { steps { // } } stage('Example stage 2') { steps { // } } } }
出处:http://www.cnblogs.com/lightsong/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
标签:
DevOps
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
2022-10-25 D - Not Divisible -- ATCODER
2022-10-25 D - Longest X -- ATCODER
2017-10-25 Slash and BackSlash 记忆法