CI pipeline toolkit.
Project description
cici.tools
WARNING:
cici
is experimental and I can't even decide on a name for it. Stay away!
Usage
bundle
build
The build
subcommand introduces BrettOps Pipeline format, a pipeline format
that compiles into other pipeline formats.
BrettOps Pipelines are simple and easy to write, and can be compiled to any format.
They can also be executed locally with the included runner.
update
About BrettOps CI syntax
-
All data is strictly ordered and evaluated sequentially.
-
All jobs / pipelines are named.
-
Scripts, variables, and other snippets can be loaded from disk at build time.
-
Includes are evaluated at build time.
-
Can convert to GitLab CI for use with GitLab.
-
Uses Argo Workflow-style templating for vendor-neutral variables.
Example
Here is a BrettOps pipeline, saved as .brettops-pipeline.yml
:
name: marp
stages:
- name: test
- name: build
- name: deploy
inputs:
- name: opts
- name: footer
- name: format_opts
- name: svg_png_dpi
default: "200"
- name: theme_url
jobs:
- name: build
stage: build
environment:
image: registry.gitlab.com/brettops/containers/marp:main
outputs:
- type: path
name: public
value: public/
scripts:
- script:
- marp --version
- echo "${{input.format_opts}}"
# inject a theme into the local environment if present
- |-
if [[ -n "${{input.theme_url}}" ]] ; then
marp_theme_file="$(mktemp -u).css"
wget -O "$marp_theme_file" "${{input.theme_url}}"
{{input.opts}}="${{input.opts}} --theme $marp_theme_file"
fi
- echo "${{input.opts}}"
# preprocess slides with marp-format
- mapfile -t SLIDES < <(find . -name slides.md -type f -not -path "./public/*")
- |-
for slide in "${SLIDES[@]}"
do
preprocess="$(echo "$slide" | sed -e 's@slides\.md$@index.md@')"
echo "preprocessing '$slide' to '$preprocess'"
marp-format --output "$preprocess" "$slide" --metadata "footer=${{input.footer}}" ${{input.format_opts}}
done
# run marp on preprocessed slides
- mapfile -t PREPROCESSED < <(find . -name index.md -type f)
- marp ${{input.opts}} --html "${PREPROCESSED[@]}"
- marp ${{input.opts}} --allow-local-files --pdf "${PREPROCESSED[@]}"
# marshal into public directory
- >-
rsync -zarv
--exclude ".git/"
--exclude "public/"
--include "*/"
--include "index.html"
--include "index.md"
--include "index.pdf"
--include "*.jpg"
--include "*.png"
--include "*.svg"
--exclude "*"
. public/
This format is intentionally verbose, as it is designed to transpile into other formats. It is also designed to generate pipeline documentation in a literate style. It is also intended to support being run locally using a built-in pipeline orchestrator.
Export to GitLab CI
cici build -t gitlab
stages:
- test
- build
- deploy
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS
when: never
- when: always
variables:
MARP_OPTS: ""
MARP_FOOTER: ""
MARP_FORMAT_OPTS: ""
MARP_SVG_PNG_DPI: "200"
MARP_THEME_URL: ""
marp-build:
stage: build
image: registry.gitlab.com/brettops/containers/marp:main
script:
- marp --version
- echo "$MARP_FORMAT_OPTS"
- |-
if [[ -n "$MARP_THEME_URL" ]] ; then
marp_theme_file="$(mktemp -u).css"
wget -O "$marp_theme_file" "$MARP_THEME_URL"
MARP_OPTS="$MARP_OPTS --theme $marp_theme_file"
fi
- echo "$MARP_OPTS"
- mapfile -t SLIDES < <(find . -name slides.md -type f -not -path "./public/*")
- |-
for slide in "${SLIDES[@]}"
do
preprocess="$(echo "$slide" | sed -e 's@slides\.md$@index.md@')"
echo "preprocessing '$slide' to '$preprocess'"
marp-format --output "$preprocess" "$slide" --metadata "footer=$MARP_FOOTER" $MARP_FORMAT_OPTS
done
- mapfile -t PREPROCESSED < <(find . -name index.md -type f)
- marp $MARP_OPTS --html "${PREPROCESSED[@]}"
- marp $MARP_OPTS --allow-local-files --pdf "${PREPROCESSED[@]}"
- >-
rsync -zarv --exclude ".git/" --exclude "public/" --include "*/" --include "index.html"
--include "index.md" --include "index.pdf" --include "*.jpg" --include "*.png"
--include "*.svg" --exclude "*" . public/
artifacts:
paths:
- public/
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
File details
Details for the file cici.tools-0.1.4.tar.gz
.
File metadata
- Download URL: cici.tools-0.1.4.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebf5d9354554e4bca1db798db7beee3c213427e0df41b6ba2c0c5321f89b5fe0 |
|
MD5 | 2ab8da38a0d69bda137bb8d730b8e8f2 |
|
BLAKE2b-256 | a11d8957784e90940d995b960a1025ace6d07a4eee3be87ed7ab487106c63089 |
File details
Details for the file cici.tools-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: cici.tools-0.1.4-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84d3aed2909d4455e35c792d8c3c17b267d41df561d8b313e90ad0109c7e1ee5 |
|
MD5 | 054f36a87c5290124edd6dd8d001c3fb |
|
BLAKE2b-256 | 3662374a0040cbee8f8f95e9ef80022fefc2b8ccfd0f1b7cb2fe0caabfb12539 |