Python DSL for programmatically building Concourse CI/CD pipelines
Project description
ol-concourse-lib
A Python DSL for programmatically building Concourse CI/CD pipelines.
Instead of writing YAML files by hand, use typed Python classes to construct type-safe pipeline definitions that serialize to valid Concourse pipeline YAML.
Installation
pip install ol-concourse-lib
# or with Pulumi job builder support:
pip install "ol-concourse-lib[pulumi]"
Quick Start
from ol_concourse.lib.models.pipeline import Identifier
from ol_concourse.lib.resources import git_repo, registry_image
from ol_concourse.lib.resource_types import packer_build
from ol_concourse.lib.jobs.infrastructure import packer_jobs
import yaml, json
# Build a pipeline fragment for packer AMI builds
code = git_repo(
name=Identifier("packer-templates"),
uri="https://github.com/myorg/packer-templates",
branch="main",
)
fragment = packer_jobs(
dependencies=[],
image_code=code,
node_types=["web", "worker"],
)
pipeline = fragment.to_pipeline()
print(yaml.dump(json.loads(pipeline.model_dump_json())))
API
Models (ol_concourse.lib.models)
Pipeline— root pipeline definitionJob,Resource,ResourceType— core pipeline componentsGetStep,PutStep,TaskStep,InParallelStep— step typesTaskConfig,Command,Input,Output— task configurationPipelineFragment— composable pipeline unit
Builder Functions
| Module | Functions |
|---|---|
ol_concourse.lib.resources |
git_repo, registry_image, github_issues, schedule, s3_object, … |
ol_concourse.lib.resource_types |
packer_build, packer_validate, pulumi_provisioner_resource, github_issues_resource, github_deployments_resource, release_resource_type, … |
ol_concourse.lib.jobs.infrastructure |
packer_jobs, pulumi_jobs_chain, pulumi_job |
ol_concourse.lib.containers |
container_build_task |
ol_concourse.lib.notifications |
notification (Slack) |
ol_concourse.lib.tasks |
instance_refresh_task, block_for_instance_refresh_task |
Regenerating Pipeline Models
models/pipeline.py is generated from the Concourse pipeline JSON schema:
pip install datamodel-code-generator
datamodel-codegen \
--url https://raw.githubusercontent.com/nicholasdille/concourse-jsonschema/main/concourse.json \
--output src/ol_concourse/lib/models/pipeline.py \
--output-model-type pydantic_v2.BaseModel
License
BSD-3-Clause — Copyright MIT Open Learning
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ol_concourse-0.8.3.tar.gz.
File metadata
- Download URL: ol_concourse-0.8.3.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf4f14a7d74a6563c1abf7e30fc54a87d134fcf0f350446fd88610a1c1420ca
|
|
| MD5 |
0a34f8ad36c318184ffac42b9ac5aca8
|
|
| BLAKE2b-256 |
6058b930e1ffd7eea4e33ac4969517651cd35f9026de9691ecdf414a1cbfde73
|
File details
Details for the file ol_concourse-0.8.3-py3-none-any.whl.
File metadata
- Download URL: ol_concourse-0.8.3-py3-none-any.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fc8ea832ab69d4d7aae3c7bf36a747b50599817a2d2d7a9453ba9ffc11b835b
|
|
| MD5 |
4284a65cd68c265f5cca8d0b1e4bc105
|
|
| BLAKE2b-256 |
48cbff32bad195086050fe55e4fd88e6a637ed19fb737f644f5ab75f23044a1c
|