From 7970bce01f6f12eaea979d322fdd953d971dde98 Mon Sep 17 00:00:00 2001 From: new Date: Sat, 7 Nov 2020 02:05:42 +0000 Subject: [PATCH 1/2] test pipeline starter template --- .conducto.cfg | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .conducto.cfg diff --git a/.conducto.cfg b/.conducto.cfg new file mode 100644 index 0000000..e38369d --- /dev/null +++ b/.conducto.cfg @@ -0,0 +1,17 @@ +# The .conducto.cfg file defines how and when to trigger a CI/CD pipeline. +# Each section defines a command that is launches a pipeline. +# You can trigger a pipeline on pull request and branch push events. + + +# This section launches a pipeline on every Pull Request. +[pr] +command = python pipeline.py pr --branch={branch} + + +# Uncomment this section to trigger the "deploy" pipeline whenever the "main" +# branch is updated. If the slack integation is installed, the slack_channel +# will automatically receive useful updates as the pipeline runs. +; [push production] +; filter = {branch} == main +; command = python pipeline.py deploy +; slack_channel = github-deploy From 0b7cbcfa22f88d5982ff2b74a4f7c31af369ad98 Mon Sep 17 00:00:00 2001 From: new Date: Sat, 7 Nov 2020 02:05:43 +0000 Subject: [PATCH 2/2] test pipeline starter template --- pipeline.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pipeline.py diff --git a/pipeline.py b/pipeline.py new file mode 100644 index 0000000..8f7ebea --- /dev/null +++ b/pipeline.py @@ -0,0 +1,26 @@ +# Define your CI/CD pipeline in a Python script. + +import conducto as co + + +# `pr()` creates and returns a CI/CD pipeline for a Pull Request. Run from the command +# line with `python pipeline.py pr --branch=`. +def pr(branch) -> co.Parallel: + # Make a Docker image, based on python:alpine, with the whole repo and the contents + # of the given branch. + image = co.Image("python:alpine", copy_repo=True, copy_branch=branch) + + # Using that Docker image, run three commands in parallel to interact with the + # repo's files. + 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") + + co.git.apply_status_all(root) + + return root + + +if __name__ == "__main__": + co.main()