Giter Club home page Giter Club logo

metadata-env-buildkite-plugin's Introduction

metadata-env-buildkite-plugin Build status

Buildkite plugin to inject buildkite-agent metadata into environment

Due to limitations of the plugin, the environment variables generated from the plugin can only be accessed during runtime

It is recommended that these environment variables are accessed by escaping the $ character

\$FOO or $$FOO

https://buildkite.com/docs/agent/v3/cli-pipeline#environment-variable-substitution

This is particularly useful as block step values are saved in a build's meta-data. https://buildkite.com/docs/pipelines/block-step https://buildkite.com/docs/agent/v3/cli-meta-data

Example

Simple

steps:
  - label: "Setting meta-data"
    commands:
      - 'buildkite-agent meta-data set "hello" "world"'
  - label: "Fetching meta-data"
    commands:
      - test $$HELLO = world
    plugins:
      - chronotc/metadata-env#v1.0.0:
          keys:
            - hello=HELLO

Docker

steps:
  - label: "Setting meta data"
    commands:
      - 'buildkite-agent meta-data set "foo" "bar"'
  - label: "Fetching meta-data for container"
    commands:
      - test $$FOO = bar
    plugins:
      - chronotc/metadata-env#v1.0.0:
          keys:
            - foo=FOO
      - docker#v3.5.0:
          image: "alpine:3.7"
          environment:
            - FOO

Block step

steps:
  - block: "Request Release"
    fields:
      - select: "Select account"
        key: ROLE # saves to buildkite-agent meta-data
        options:
          - label: "Production"
            value: "arn:aws:iam::123456789:role/production-role"
          - label: "Staging"
            value: "arn:aws:iam::987654321:role/staging-role"
      - select: "Select runtime environment"
        key: node-env # saves to buildkite-agent meta-data
        options:
          - label: "Production"
            value: "production"
          - label: "Development"
            value: "development"
  - command: echo $$NODE_ENV
    plugins:
      - chronotc/metadata-env#v1.0.0:
          keys:
            - ROLE
            - node-env=NODE_ENV #remaps node-env key to NODE_ENV <key>=<alias>

metadata-env-buildkite-plugin's People

Contributors

chronotc avatar sudsha50 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.