From e8f7e65b1c1f5edf5234ab469d0a0425335bd7fa Mon Sep 17 00:00:00 2001 From: 1228 Date: Mon, 28 Dec 2020 23:43:48 +0000 Subject: [PATCH 1/2] test pipeline starter template --- .conducto.cfg | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .conducto.cfg diff --git a/.conducto.cfg b/.conducto.cfg new file mode 100644 index 0000000..c1bf646 --- /dev/null +++ b/.conducto.cfg @@ -0,0 +1,11 @@ +# 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} + +# 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 78e0195f3ceb38014fe407de1e66cdf436ec7258 Mon Sep 17 00:00:00 2001 From: 1228 Date: Mon, 28 Dec 2020 23:43:49 +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()