Skip to content

Instantly share code, notes, and snippets.

@lox
Last active December 17, 2018 23:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lox/1dd425819b4e3874ba394346cb56a74c to your computer and use it in GitHub Desktop.
Save lox/1dd425819b4e3874ba394346cb56a74c to your computer and use it in GitHub Desktop.
Proposal for top level plugins block in pipeline.yml

Top-level plugins block in pipeline.yml

Currently plugins need to be applied to each step, which ends up being verbose and it's easy for them to get out of synch as changes are made.

I'm proposing a top level plugin block that would allow plugins to be declared that would then apply to all steps.

This would aim to solve the current pain points:

  • Version declarations need to be repeated
  • Lots of copy/paste plugin blocks
  • Easy to forget them on a new step

Functionally, they would act as though you copied the plugin stanza to each step, appended onto the end of whatever plugins were there. If a plugin of the same name is defined in the step, it's used to "extend" the top level definition, following the YAML extend semantics.

Example: Current pipeline with plugins

steps:
  - command: ./run_build.sh
    plugins:
      lox/secrets#v1.0:
        s3_bucket: my-buildkite-secrets
      docker-compose#v1.2.1:
        build: 
          - app
          - test
        config:
          - docker-compose.yml
          - docker-compose.test.yml     
          
  - command: ./run_tests.sh
    plugins:
      lox/secrets#v1.0:
        s3_bucket: my-buildkite-secrets
      docker-compose#v1.2.1:
        run: app
        config:
          - docker-compose.yml
          - docker-compose.test.yml            
 
  - command: ./publish.sh
    plugins:
      lox/secrets#v1.0:
        s3_bucket: my-buildkite-secrets
      docker-compose#v1.2.1:
        run: app
        config:
          - docker-compose.yml
          - docker-compose.test.yml   

Example: Using the top-level block

plugins:
  lox/secrets#v1.0:
    s3_bucket: my-buildkite-secrets
    
  docker-compose#v1.2.1:
    config:
      - docker-compose.yml
      - docker-compose.test.yml    

steps:
  - command: ./run_build.sh
    plugins:
      docker-compose:
        build: 
          - app
          - test  
          
  - command: ./run_tests.sh
    plugins:
      docker-compose:
        run: app           
 
  - command: ./publish.sh
    plugins:
      docker-compose:
        run: app 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment