Skip to main content

Dynamically generate Buildkite pipelines

Project description

Build Status Documentation Status

Buildpipe allows you to dynamically generate your Buildkite pipelines so that you can:

  • Manage continuous deployment logic such as only deploying during business hours

  • Maintain monorepos by only looking at git changes in specified projects

Install

pip install buildpipe

Example

deploy:
  branch: master
  timezone: US/Eastern
  allowed_hours_regex: '0[9]|1[0-7]'
  allowed_weekdays_regex: '[1-5]'
  blacklist_dates_regex: '\d{4}\-(01\-01|12\-31)'
stairs:
  - name: test
    type: test
    commands:
      - make test
  - name: build
    type: build
    commands:
      - make build
      - make publish-image
    buildkite_override:
      agents:
        - queue=build
  - name: tag
    type: tag
    commands:
      - make tag-release
  - name: deploy-staging
    type: deploy
    commands:
      - make deploy-staging
  - name: deploy-prod
    type: deploy
    commands:
      - make deploy-prod
projects:
  - name: jsproject
    path: jsproject
    emoji: ":javascript:"
    skip_stairs:
      - deploy-prod
  - name: pyproject
    path: py_project
    emoji: ":python:"
    dependencies:
      - jsproject

The above buildpipe config file specifies the following:

  • There are two projects to track in the repo: jsProject and pyproject

  • The default steps (“stairs”) for each project are: test, build, tag, deploy-staging and deploy-prod

  • Any git file changes that are subpaths of either project’s path will trigger steps for each project

  • In addition pyproject has jsproject as a dependency; any changes in jsproject will trigger steps for pyproject to be included in the pipeline

  • Deploys will only happen in master branch between 9am and 5pm ET during weekdays that are not on Christmas or New Years day

  • Project jsproject will never create step deploy-prod

  • Stairs like build can be overridden with additional buildkite configuration such as the agent queue

In the Buildkite pipeline settings UI you just have to add the following in “Commands to run”:

buildpipe -i path/to/buildpipe.yml -o pipeline.yml
buildkite-agent pipeline upload pipeline.yml

Testing

make test

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

buildpipe-0.1.3.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distribution

buildpipe-0.1.3-py2.py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page