BagCheck
About
bagcheck is a relatively simply command line utility developed to make validating Concourse pipelines simpler. To accomplish this, bagcheck has the following functionality:
Checking a pipeline
Concourse
To check your pipeline, simply run:
bagcheck check -f /path/to/your/concourse/pipeline.yaml
at which point bagcheck will proceed to check for the following conditions:
- All git resources are pointed at the
mainbranch - All PR resource puts in the same job have the same context
- All PR statuses are accounted for in a job (success, failure, error, pending)
- All jobs have a timeout set
GitHub Actions
To check your pipeline, run:
bagcheck check -f /path/to/your/github/workflow-or-action.yaml
at which point bagcheck will proceed to check for the following conditions:
- All jobs have timeouts set
- All jobs have the required
runs-onfield set - All workflow calls pass the required inputs
- All action calls pass the required inputs
- All output references reference an output that actually exists
- All input references reference an input that actually exists
- All
needs.<job>...references reference a job that is:- Present in the needs block of the job referencing it
- Actually outputs the output specified
- All external action/workflow references use the allowed ref format
- Defaults to checking the pattern
v[0-9](\.[0-9]){0,2}" - To change the regex pattern, configure the
config.ref_regexblock as shown in the configuration below
- Defaults to checking the pattern
Configuring Bagcheck
To pull remote actions/workflows from a private repository, set
BAGCHECK_GITHUB_TOKENto your GitHub access token
Sometimes you want to skip a check across the board (e.g. you don't want timeouts in a specific pipeline) or you only want to disable a check for a specific job/resource. To do this, you'll use a .bagcheck file.
An example file looks something like this:
config:
ref_regex: v[0-9](\.[0-9]){0,2}
disable:
global:
- concourse-check-main-branch
- ...
local:
- path: '$.jobs[?(@.name = "job-name-1")]'
tests:
- concourse-check-pr-statuses
- ...
- path: '$.jobs[?(@.name = "job-name-2")]'
tests:
- concourse-check-timeout
- ...
- ...
warn:
global:
- github-check-ref
- ...
local:
- path: '$.jobs[?(@.name = "job-name-1")]'
tests:
- github-check-action-calls
- ...
- ...
with any check listed under the disable.global key being completely disabled and the tests under each path being disabled when the job meets that JSONPath criteria (the ellipsis denote that you can include as many as you want in each section).
Additionally, adding any check to warn.global will result in all errors being ignored for that check and warning statements being printed instead of errors. Additionally, you can configure the same thing locally in the same manner as the local disables
Currently the following tests are run and as a consequence can be disabled:
concourse-check-main-branchconcourse-check-timeoutconcourse-check-pr-statusesconcourse-check-pr-contextsgithub-check-timeoutgithub-check-runs-ongithub-check-workflow-callsgithub-check-action-callsgithub-check-output-wiringgithub-check-needs-wiringgithub-check-input-wiringgithub-check-ref
One thing to note is that bagcheck will first attempt to read a file located at ~/.bagcheck and then will attempt to read one at the current working directory, combining the values with whatever is located in your ~/.bagcheck file.
Summarizing a pipeline
Having to read through a 1000+ line YAML file can make it hard to understand what the pipeline is doing on a conceptual level as well as how everything ties together. To help with this, you can run:
bagcheck summary -f /path/to/your/pipeline.yaml
at which point bagcheck will print out a summarized version of your pipeline
Metadata
Release files for bagcheck 0.2.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bagcheck-0.2.13.tar.gz | 17.3 kB | Without provenance | Details for bagcheck-0.2.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bagcheck-0.2.13-py3-none-any.whl | Python 3 | none | any | Details for bagcheck-0.2.13-py3-none-any.whl |
Total release size: 38.9 kB
Release files / bagcheck-0.2.13.tar.gz
| Download URL | bagcheck-0.2.13.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21cc82b950bc2e029f58ac21cf101244b7d8be30a7768684a1bc7d0a0152279e
|
|
BLAKE2b-256 checksum How to use checksums |
6e9f612bb8613ff70dac9d59968daf990ce80d2bb8cef46246cc18dd75604955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.11.1 Linux/6.6.87.2-microsoft-standard-WSL2
|
Release files / bagcheck-0.2.13-py3-none-any.whl
| Download URL | bagcheck-0.2.13-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2096bde7d7286518dcd34eb25b733d2fd02733e4eb37998032967bf61d95d78a
|
|
BLAKE2b-256 checksum How to use checksums |
d399e4b566b048a01489abeab073e26071fecaa0898b80126496dd98dfea3b3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.11.1 Linux/6.6.87.2-microsoft-standard-WSL2
|
Security for bagcheck 0.2.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.