Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .conducto.cfg
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions pipeline.py
Original file line number Diff line number Diff line change
@@ -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()