CLI tool to generate Buildkite pipeline YAML
Project description
A CLI tool to generate a pipeline.yaml file for Buildkite on the fly.
Install via pip install bkyml
(see https://pypi.org/project/bkyml/)
Example:
bkyml comment 'Frontend tests pipeline'
bkyml env FORCE_COLOR=1
bkyml steps
bkyml command \
--command 'yarn install' \
--command 'yarn test' \
--label ':karma: tests'
will produce
# Frontend tests pipeline
env:
FORCE_COLOR: 1
steps:
- label: ':karma: tests'
command:
- yarn install
- yarn test
This allows you to dynamically generate pipelines:
#!/bin/env bash
set -eu -o pipefail
bkyml comment "Pipeline for running all tests in test/*"
bkyml steps
# add a new command step to run the tests in each test directory
for test_dir in test/*/; do
bkyml command \
--command "run_tests ${test_dir}" \
--label "Run tests for '${test_dir}'"
done
Missing features:
block step
trigger step
Sub-Commands
steps
Example:
bkyml steps
will produce
steps:
comment
Example:
bkyml comment \
'Hello world!' 'What a nice day :)'
will produce
# Hello world!
# What a nice day :)
env
Example:
bkyml env \
--var A B \
--var C D
will produce
env:
A: B
C: D
command
Example:
bkyml command \
--command 'yarn install' \
--command 'yarn test' \
--env FORCE_COLOR 1 \
--branches master \
--label ':yarn: tests' \
--agents yarn true \
--artifact-paths 'logs/**/*' 'coverage/**/*' \
--parallelism 5 \
--concurrency 2 \
--concurrency-group my/group \
--timeout-in-minutes 60 \
--skip 'Some reason' \
--retry automatic \
--retry-automatic-tuple '*' 2 \
--retry-automatic-tuple 1 3 \
--plugin docker-compose#v1.3.2 build=app image-repository=index.docker.io/org/repo
will produce
- label: ':yarn: tests'
command:
- yarn install
- yarn test
branches: master
env:
FORCE_COLOR: '1'
agents:
yarn: 'true'
artifact_paths:
- logs/**/*
- coverage/**/*
parallelism: 5
concurrency: 2
concurrency_group: my/group
timeout_in_minutes: 60
skip: Some reason
retry:
automatic:
- exit_status: '*'
limit: 2
- exit_status: 1
limit: 3
plugins:
docker-compose#v1.3.2:
build: app
image-repository: index.docker.io/org/repo
There is also:
--retry-automatic-limit
--retry-automatic-exit-code
which can’t be used in conjunction with –retry-automatic-tuple
And:
--retry-manual-allowed
(allowing manual retries, default)--no-retry-manual-allowed
(disallowing manual retries)--retry-manual-reason REASON
(giving a reason why retries are forbidden)--retry-manual-permit-on-passed
(allowing retries after the job has passed)--no-retry-manual-permit-on-passed
(disallowing retries after the job has passed, default)
Example:
bkyml command \
--command 'x' \
--retry manual \
--retry-manual-permit-on-passed \
--no-retry-manual-allowed \
--retry-manual-reason "Just because"
will result in
- command: x
retry:
manual:
allowed: false
reason: Just because
permit_on_passed: true
plugin
Example:
bkyaml plugin \
--plugin 'org/repo#1.0.0' some=var other=var \
--plugin 'org/other_repo' more=var \
--name 'My name is working'
will result in
- name: My name is working
plugins:
org/repo#1.0.0:
some: var
other: var
org/other_repo:
more: var
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
Built Distribution
Hashes for bkyml-1.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3321947f2107095119ca30ce63f1592d697fd17d0d1964aafbf4b5dac6d24a7d |
|
MD5 | 1da19fc03f5023ee0b26590edce7027d |
|
BLAKE2b-256 | a0ece47d63c45bc4ed73402eadd43257ce2c557ea3b7faf13854ac78ad7bc723 |