From 25c1a869f87f7acb03fa8022bbe62219b752773f Mon Sep 17 00:00:00 2001 From: 1209 Date: Thu, 10 Dec 2020 01:02:19 +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 a4d5d1df8925e2918775e9b8aba8a26a18ca4d80 Mon Sep 17 00:00:00 2001 From: 1209 Date: Thu, 10 Dec 2020 01:02:19 +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()