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
17 changes: 17 additions & 0 deletions .conducto.cfg
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions pipeline.py
Original file line number Diff line number Diff line change
@@ -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=<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()