From 17a0f44dd8fdf5c66f3a654292b10437819fa952 Mon Sep 17 00:00:00 2001 From: 0104 Date: Mon, 4 Jan 2021 23:36:33 +0000 Subject: [PATCH 1/2] test pipeline starter template --- .conducto.cfg | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .conducto.cfg diff --git a/.conducto.cfg b/.conducto.cfg new file mode 100644 index 0000000..90ea878 --- /dev/null +++ b/.conducto.cfg @@ -0,0 +1,12 @@ +# Define when and how to trigger a CI/CD pipeline. + +# Launch a pipeline on every Pull Request. +[pr test] +command = python pipeline.py pr --branch={branch} +slack_channel = jhendry + +# Launch a pipeline every time a branch is updated. +# TODO: Replace "my_awesome_branch" with your production branch. +[push production] +filter = {branch} == my_awesome_branch +command = python pipeline.py deploy \ No newline at end of file From e0ef0a1de0ad21fb45ef0d7987eb331c6189e3d3 Mon Sep 17 00:00:00 2001 From: 0104 Date: Mon, 4 Jan 2021 23:36:34 +0000 Subject: [PATCH 2/2] test pipeline starter template --- pipeline.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pipeline.py diff --git a/pipeline.py b/pipeline.py new file mode 100644 index 0000000..e20150e --- /dev/null +++ b/pipeline.py @@ -0,0 +1,34 @@ +"Define a CI/CD pipeline." + +import conducto as co + + +def pr(branch) -> co.Parallel: + # Boilerplate: Define Docker image with code from repo. + image = co.Image(copy_repo=True, copy_branch=branch) + + # Run commands in parallel to interact with repo's files. + # + # co.Parallel: run children at same time + # co.Serial: run children one after another + # co.Exec: run a shell command in a container + # + # TODO: Add your own commands to build, test, and deploy. + with co.Parallel(image=image) as root: + co.Exec(f"echo {branch}", name="print branch") + co.Exec("pwd", name="print working directory") + co.Exec("ls -la", name="list files") + + # Boilerplate: Add GitHub status callbacks. + co.git.apply_status_all(root) + + return root + + +def deploy() -> co.Serial: + raise NotImplementedError("TODO: Implement deploy pipeline.") + + +# Boilerplate: Expose commands from .conducto.cfg. +if __name__ == "__main__": + co.main()