# cici.tools
<!-- BADGIE TIME -->
[![brettops tool](https://img.shields.io/badge/brettops-tool-209cdf?labelColor=162d50)](https://brettops.io)
[![pipeline status](https://img.shields.io/gitlab/pipeline-status/brettops/tools/cici?branch=main)](https://gitlab.com/brettops/tools/cici/-/commits/main)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![code style: black](https://img.shields.io/badge/code_style-black-000000.svg)](https://github.com/psf/black)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
<!-- END BADGIE TIME -->
> **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`:
```yaml
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
```bash
cici build -t gitlab
```
```yaml
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/
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/brettops/tools/cici",
"name": "cici.tools",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "ci pipeline python",
"author": "Brett Weir",
"author_email": "brett@brettops.io",
"download_url": "https://files.pythonhosted.org/packages/a1/1d/8957784e90940d995b960a1025ace6d07a4eee3be87ed7ab487106c63089/cici.tools-0.1.4.tar.gz",
"platform": null,
"description": "# cici.tools\n\n<!-- BADGIE TIME -->\n\n[![brettops tool](https://img.shields.io/badge/brettops-tool-209cdf?labelColor=162d50)](https://brettops.io)\n[![pipeline status](https://img.shields.io/gitlab/pipeline-status/brettops/tools/cici?branch=main)](https://gitlab.com/brettops/tools/cici/-/commits/main)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![code style: black](https://img.shields.io/badge/code_style-black-000000.svg)](https://github.com/psf/black)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n<!-- END BADGIE TIME -->\n\n> **WARNING:** `cici` is experimental and I can't even decide on a name for it.\n> Stay away!\n\n## Usage\n\n### `bundle`\n\n### `build`\n\nThe `build` subcommand introduces BrettOps Pipeline format, a pipeline format\nthat compiles into other pipeline formats.\n\nBrettOps Pipelines are simple and easy to write, and can be compiled to any\nformat.\n\nThey can also be executed locally with the included runner.\n\n### `update`\n\n## About BrettOps CI syntax\n\n- All data is strictly ordered and evaluated sequentially.\n\n- All jobs / pipelines are named.\n\n- Scripts, variables, and other snippets can be loaded from disk at build time.\n\n- Includes are evaluated at build time.\n\n- Can convert to GitLab CI for use with GitLab.\n\n- Uses Argo Workflow-style templating for vendor-neutral variables.\n\n## Example\n\nHere is a BrettOps pipeline, saved as `.brettops-pipeline.yml`:\n\n```yaml\nname: marp\n\nstages:\n - name: test\n - name: build\n - name: deploy\n\ninputs:\n - name: opts\n - name: footer\n - name: format_opts\n - name: svg_png_dpi\n default: \"200\"\n - name: theme_url\n\njobs:\n - name: build\n stage: build\n environment:\n image: registry.gitlab.com/brettops/containers/marp:main\n outputs:\n - type: path\n name: public\n value: public/\n scripts:\n - script:\n - marp --version\n - echo \"${{input.format_opts}}\"\n\n # inject a theme into the local environment if present\n - |-\n if [[ -n \"${{input.theme_url}}\" ]] ; then\n marp_theme_file=\"$(mktemp -u).css\"\n wget -O \"$marp_theme_file\" \"${{input.theme_url}}\"\n {{input.opts}}=\"${{input.opts}} --theme $marp_theme_file\"\n fi\n - echo \"${{input.opts}}\"\n # preprocess slides with marp-format\n - mapfile -t SLIDES < <(find . -name slides.md -type f -not -path \"./public/*\")\n - |-\n for slide in \"${SLIDES[@]}\"\n do\n preprocess=\"$(echo \"$slide\" | sed -e 's@slides\\.md$@index.md@')\"\n echo \"preprocessing '$slide' to '$preprocess'\"\n marp-format --output \"$preprocess\" \"$slide\" --metadata \"footer=${{input.footer}}\" ${{input.format_opts}}\n done\n\n # run marp on preprocessed slides\n - mapfile -t PREPROCESSED < <(find . -name index.md -type f)\n - marp ${{input.opts}} --html \"${PREPROCESSED[@]}\"\n - marp ${{input.opts}} --allow-local-files --pdf \"${PREPROCESSED[@]}\"\n\n # marshal into public directory\n - >-\n rsync -zarv\n --exclude \".git/\"\n --exclude \"public/\"\n --include \"*/\"\n --include \"index.html\"\n --include \"index.md\"\n --include \"index.pdf\"\n --include \"*.jpg\"\n --include \"*.png\"\n --include \"*.svg\"\n --exclude \"*\"\n . public/\n```\n\nThis format is intentionally verbose, as it is designed to transpile into other\nformats. It is also designed to generate pipeline documentation in a literate\nstyle. It is also intended to support being run locally using a built-in\npipeline orchestrator.\n\n### Export to GitLab CI\n\n```bash\ncici build -t gitlab\n```\n\n```yaml\nstages:\n - test\n - build\n - deploy\n\nworkflow:\n rules:\n - if: $CI_PIPELINE_SOURCE == \"push\" && $CI_OPEN_MERGE_REQUESTS\n when: never\n - when: always\n\nvariables:\n MARP_OPTS: \"\"\n MARP_FOOTER: \"\"\n MARP_FORMAT_OPTS: \"\"\n MARP_SVG_PNG_DPI: \"200\"\n MARP_THEME_URL: \"\"\n\nmarp-build:\n stage: build\n image: registry.gitlab.com/brettops/containers/marp:main\n script:\n - marp --version\n - echo \"$MARP_FORMAT_OPTS\"\n - |-\n if [[ -n \"$MARP_THEME_URL\" ]] ; then\n marp_theme_file=\"$(mktemp -u).css\"\n wget -O \"$marp_theme_file\" \"$MARP_THEME_URL\"\n MARP_OPTS=\"$MARP_OPTS --theme $marp_theme_file\"\n fi\n - echo \"$MARP_OPTS\"\n - mapfile -t SLIDES < <(find . -name slides.md -type f -not -path \"./public/*\")\n - |-\n for slide in \"${SLIDES[@]}\"\n do\n preprocess=\"$(echo \"$slide\" | sed -e 's@slides\\.md$@index.md@')\"\n echo \"preprocessing '$slide' to '$preprocess'\"\n marp-format --output \"$preprocess\" \"$slide\" --metadata \"footer=$MARP_FOOTER\" $MARP_FORMAT_OPTS\n done\n - mapfile -t PREPROCESSED < <(find . -name index.md -type f)\n - marp $MARP_OPTS --html \"${PREPROCESSED[@]}\"\n - marp $MARP_OPTS --allow-local-files --pdf \"${PREPROCESSED[@]}\"\n - >-\n rsync -zarv --exclude \".git/\" --exclude \"public/\" --include \"*/\" --include \"index.html\"\n --include \"index.md\" --include \"index.pdf\" --include \"*.jpg\" --include \"*.png\"\n --include \"*.svg\" --exclude \"*\" . public/\n artifacts:\n paths:\n - public/\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CI pipeline toolkit.",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://gitlab.com/brettops/tools/cici"
},
"split_keywords": [
"ci",
"pipeline",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3662374a0040cbee8f8f95e9ef80022fefc2b8ccfd0f1b7cb2fe0caabfb12539",
"md5": "054f36a87c5290124edd6dd8d001c3fb",
"sha256": "84d3aed2909d4455e35c792d8c3c17b267d41df561d8b313e90ad0109c7e1ee5"
},
"downloads": -1,
"filename": "cici.tools-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "054f36a87c5290124edd6dd8d001c3fb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 27292,
"upload_time": "2023-06-11T18:09:06",
"upload_time_iso_8601": "2023-06-11T18:09:06.525035Z",
"url": "https://files.pythonhosted.org/packages/36/62/374a0040cbee8f8f95e9ef80022fefc2b8ccfd0f1b7cb2fe0caabfb12539/cici.tools-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a11d8957784e90940d995b960a1025ace6d07a4eee3be87ed7ab487106c63089",
"md5": "2ab8da38a0d69bda137bb8d730b8e8f2",
"sha256": "ebf5d9354554e4bca1db798db7beee3c213427e0df41b6ba2c0c5321f89b5fe0"
},
"downloads": -1,
"filename": "cici.tools-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "2ab8da38a0d69bda137bb8d730b8e8f2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 25674,
"upload_time": "2023-06-11T18:09:08",
"upload_time_iso_8601": "2023-06-11T18:09:08.193579Z",
"url": "https://files.pythonhosted.org/packages/a1/1d/8957784e90940d995b960a1025ace6d07a4eee3be87ed7ab487106c63089/cici.tools-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-11 18:09:08",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "brettops",
"gitlab_project": "tools",
"lcname": "cici.tools"
}