jaypore_ci.remotes package

Submodules

jaypore_ci.remotes.email module

An email remote.

This is used to report pipeline status via email. Multiple updates appear as a single thread.

class jaypore_ci.remotes.email.Email(*, host: str, port: int, addr: str, password: str, email_to: str, email_from: str, subject: str, only_on_failure: bool = False, publish_interval: int = 30, **kwargs)[source]

Bases: Remote

You can send pipeline status via email using this remote. In order to use it you can specify the following environment variables in your secrets:

JAYPORE_EMAIL_ADDR=email-account@gmail.com
JAYPORE_EMAIL_PASSWORD=some-app-password
JAYPORE_EMAIL_TO=myself@gmail.com,mailing-list@gmail.com
JAYPORE_EMAIL_FROM=noreply@gmail.com

If you’re using something other than gmail, you can specify JAYPORE_EMAIL_HOST and JAYPORE_EMAIL_PORT as well.

Once that is done you can supply this remote to your pipeline instead of the usual gitea one.

from jaypore_ci import jci, remotes, repos

git = repos.Git.from_env()
email = remotes.Email.from_env(repo=git)
with jci.Pipeline(repo=git, remote=email) as p:
    pass
    # Do something
Parameters:
  • host – What smtp host to use.

  • port – Smtp port to use.

  • addr – Smtp address to use for login.

  • password – Smtp password to use for login.

  • email_to – Which address the email should go to.

  • email_from – Which address should be the sender of this email.

  • subject – The subject line of the email.

  • only_on_failure – If set to True, a single email will be sent when the pipeline fails. In all other cases no email is sent.

  • publish_interval – Determines the delay in sending another email when we are sending multiple email updates in a single email thread. If only_on_failure is set, this option is ignored.

classmethod from_env(*, repo: Repo) Email[source]

Creates a remote instance from the environment.

logging()[source]

Return’s a logging instance with information about gitea bound to it.

publish(report: str, status: str) None[source]

Will publish the report via email.

Parameters:
  • report – Report to write to remote.

  • status – One of [“pending”, “success”, “error”, “failure”, “warning”] This is the dot next to each commit in gitea.

property smtp

jaypore_ci.remotes.git module

This is used to save the pipeline status to git itself.

class jaypore_ci.remotes.git.GitRemote(*, repo, **kwargs)[source]

Bases: Remote

You can save pipeline status to git using this remote.

To push/fetch your local refs to a git remote you can run

git fetch   origin refs/jayporeci/*:refs/jayporeci/*
git push    origin refs/jayporeci/*:refs/jayporeci/*
classmethod from_env(*, repo: Git) GitRemote[source]

Creates a remote instance from the environment.

logging()[source]

Return’s a logging instance with information about git bound to it.

publish(report: str, status: str) None[source]

Will publish the report via email.

Parameters:
  • report – Report to write to remote.

  • status – One of [“pending”, “success”, “error”, “failure”, “warning”] This is the dot next to each commit in gitea.

jaypore_ci.remotes.gitea module

A gitea remote git host.

This is used to report pipeline status to the remote.

class jaypore_ci.remotes.gitea.Gitea(*, root, owner, repo, token, **kwargs)[source]

Bases: Remote

The remote implementation for gitea.

classmethod from_env(*, repo: Repo) Gitea[source]

Creates a remote instance from the environment. It will:

  • Find the remote location using git remote.

  • Find the current branch

  • Create a new pull request for that branch

  • Allow posting updates using the gitea token provided

get_pr_id()[source]

Returns the pull request ID for the current branch.

logging()[source]

Return’s a logging instance with information about gitea bound to it.

publish(report: str, status: str)[source]

Will publish the report to the remote.

Parameters:
  • report – Report to write to remote.

  • status – One of [“pending”, “success”, “error”, “failure”, “warning”] This is the dot next to each commit in gitea.

jaypore_ci.remotes.github module

A github remote git host.

This is used to report pipeline status to the remote.

class jaypore_ci.remotes.github.Github(*, root, owner, repo, token, **kwargs)[source]

Bases: Remote

The remote implementation for github.

classmethod from_env(*, repo: Repo) Github[source]

Creates a remote instance from the environment. It will:

  • Find the remote location using git remote.

  • Find the current branch

  • Create a new pull request for that branch

  • Allow posting updates using the gitea token provided

get_pr_id()[source]

Returns the pull request ID for the current branch.

logging()[source]

Return’s a logging instance with information about gitea bound to it.

publish(report: str, status: str)[source]

Will publish the report to the remote.

Parameters:
  • report – Report to write to remote.

  • status – One of [“pending”, “success”, “error”, “failure”] This is the dot/tick next to each commit in gitea.

jaypore_ci.remotes.mock module

A mock remote.

This is used to test pipelines.

class jaypore_ci.remotes.mock.Mock(*, sha, branch)[source]

Bases: Remote

A mock remote implementation.

classmethod from_env(*, repo: Repo)[source]

This function should create a Remote instance from the given environment. It can read git information / look at environment variables etc.

get_pr_id()[source]

Returns the pull request ID for the current branch.

logging()[source]

Return’s a logging instance with information about gitea bound to it.

publish(report: str, status: str)[source]

Will publish the report to the remote.

Module contents