Buddy创新环境变量,Jenkins目前无法企及

环境变量可在流水线中通过使用键值对以便重复手动更新相同的值。环境变量让开发人员节省查找和输入访问信息的时间,并消除在其脚本中提供敏感详细信息的风险。

ENV变量用于参数化构建脚本,在流水线中设置变量将致使相同的构建操作根据流水线以不同的方式工作。

设置环境变量

添加新变量时,以下字段可用:

  • 权限范围 – 定义变量的权限范围级别
  • 加密 – 启用加密将隐藏日志中的变量值
  • 类型 – 如果您设置为固定,变量的值将始终不变。切换选项至可设置将让您更改值并将其传递给下一个操作或执行。
  • 环境变量分为4个级别:

    1. 工作区 – 适用于所有项目和流水线,在工作区选项中配置。
    2. 项目 – 可用于项目中的所有流水线,在项目选项中配置。
    3. 流水线 – 仅适用于所创建的流水线(例如,生产服务器信息),在流水线中配置。
    4. 操作 – 仅适用于定义变量的操作

    危险

    每个后续层都将覆盖更高层次的值。例如,如果您有两个相同的变量:一个在工作区级别定义,另一个在流水线级别定义,Buddy将使用该流水线中的流水线设置值以及帐户其余部分的工作区值。

    信息

    了解有关传递参数的更多信息

    使用示例?

    让我们配置一些变量来加密对 FTP 服务器的访问:

    1. 转到您的部署流水线并点击变量选项卡
    2. 添加具有相应值的变量,例如:Hostname: FTP_HOST / 192.168.0.100Login: FTP_LOGIN / adminPassword: FTP_PASS / buddy1234

    1. 现在,您可以使用变量将访问凭据存储访问到部署服务器:

    支持环境变量字段?

    整个服务都支持环境变量,但最常用于构建操作。您可以通过在支持字段的开头输入$来预设变量:

    以下是当前支持的字段列表:

    操作名称

    支持字段

    Amazon S3

    SourcePath, Remote Path, Tag Objects Value

    AWS CLI

    Run Commands

    AWS CLI 2

    Run Commands

    AWS ECS

    Source Path

    AWS Lambda Deploy

    Source Path

    AWS Lambda Trigger

    Payload

    Azure App Service

    URL, Login, Password

    Azure CLI

    Run Commands

    Azure Storage

    Source Path, Remote Path

    Build Android App

    Run Commands, Mount Filesystem Path, Mount Container Path, Working dir

    Build Android React Native Application

    Run Commands, Mount Filesystem Path, Mount Container Path, Working dir

    Build Docker Image

    Name, Value

    Build Flutter App

    Run Commands, Mount Filesystem Path, Mount Container Path, Working dir

    Build Ionic app

    Mount Filesystem Path, Mount Container Path, Working dir

    Bugsnag

    API Key, Version, Revision, Builder Name, Release Stage

    CloudFront

    Base URL, Source Path

    Cloudflare

    Base URL

    CodeDeploy

    Source Path, Bucke tName, Description

    Compress images

    Source Path, Destination Path

    Copy files

    Source Path, Remote Path

    Custom Build

    Run Commands, Mount Filesystem Path, Mount Container Path, Working dir

    Datadog

    Event Title, Content, Host, Tags, Aggregation Key

    Datadog Service Check

    Hostname, Check

    DigitalOcean Droplet

    Source Path, Port, Login, Password, Remote Path, SSH Key Passphrase

    DigitalOcean Spaces

    SourcePath, Remote Path

    DigitalOcean Spaces CDN

    BaseURL

    Discord

    Channel, Attachments, Message

    Dockerfile

    Build Arguments

    Dockerfile Linter

    Dockerfile, YAML file with ignores

    Elastic Beanstalk

    Source, Version, Bucket 1, Environment 2

    Email

    Subject, Attachments, Message

    ESLint

    Mount Filesystem Path, Mount Container Path, Working dir

    Find & replace

    Source Path, Replacements

    Firebase

    Mount Filesystem Path, Mount Container Path, Working dir

    FTP

    Source Path, Hostname, Port, Login, Password, RemotePath

    FTP Download

    Hostname, Port, Login, Password, Source Path, Destination Path

    FTPS

    Source Path, Hostname, Port, Login, Password, Remote Path

    Function Deploy

    GCE

    Source Path, Hostname, Port, Login, Password, Remote Path

    GCloud CLI

    Run Commands

    GCS

    SourcePath, RemotePath

    Ghost Inspector

    Path

    Git Push

    URL, Login, Password

    Gitcrypt lock

    Gitcrypt unlock

    Google App Engine

    Source Path, Bucket, Version, ImageURL

    Google CDN

    BaseURL

    Google Cloud CLI

    Run Commands

    Google Cloud Functions

    Source Path

    Google Cloud Storage

    Source Path, Remote Path

    Google Compute Engine

    Source Path, Hostname, Port, Login, Password, Remote Path

    Google Function Trigger

    Heroku

    Heroku CLI

    Run Commands

    Honeybadger

    Environment

    HTTP

    EndpointURL, Login, Password, Request headers

    Image compression

    Source, Destination

    Kubernetes Apply

    Server, Username, Password, Source Path, Prune Whitelist, Grace Period

    Kubernetes CLI

    Server, Username, Password, Run Commands

    Run Kubernetes Job

    Server, Username, Password, YAML

    Run Kubernetes Pod

    Server, Username, Password, YAML

    Set Kubernetes Image

    Server, Username, Password, ImageName, Image Tag

    Lambda Deploy

    SourcePath

    Lambda Trigger

    Qualifier

    Link validator

    URL

    Lighthouse

    URL

    Local Shell

    Loggly

    Tags

    Monitoring

    Environment 3, Application 4

    MS Teams

    Channel email, Title, Attachments from filesystem

    Netlify

    New Relic

    Description, Changelog, Version

    Pass arguments

    PHP CodeSniffer

    Mount Filesystem Path, Mount Container Path, Working dir

    Ping

    Host

    Publish APK to Google Play

    APK, Main expansion file, Patch expansion file, Service Key, Package name, Mapping file

    Pushbullet

    Title, URL, Message

    Push Docker Image

    Login, Password, Repository, Tags

    Pushover

    Title, URL, URL Title, Message

    Rackspace

    Source Path, Remote Path

    Raygun

    Access Token, API Key, Version, User, Email, Comment

    Replace

    Source Path, Replacements (name)

    Rollbar

    Environment, Comment, Username, Rollbar Username

    Rsync

    Source Path, Hostname, Port, Login, Password, Remote Path

    Run Docker Image

    Login, Password, Image, Version, CMD, Entrypoint

    Run Helm CMDs

    Run Commands, Server, Username, Password

    Run next pipeline

    Comment

    Sentry

    Release Version, Deploy Environment, Release URL, Deploy URL, Repository

    Sentry On-premises

    声明:本站部分文章内容及图片转载于互联 、内容不代表本站观点,如有内容涉及侵权,请您立即联系本站处理,非常感谢!

    (0)
    上一篇 2022年7月9日
    下一篇 2022年7月9日

    相关推荐