repoproviders

Module: binderhub.repoproviders

Classes for Repo providers

Subclass the base class, RepoProvider, to support different version control services and providers.

Note: When adding a new repo provider, add it to the allowed values for
repo providers in event-schemas/launch.json.

RepoProvider

class binderhub.repoproviders.RepoProvider(**kwargs)

Base class for a repo provider

config c.RepoProvider.banned_specs = List()

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

config c.RepoProvider.git_credentials = Unicode('')

Credentials (if any) to pass to git when cloning.

config c.RepoProvider.high_quota_specs = List()

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

config c.RepoProvider.spec_config = List()

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
config c.RepoProvider.banned_specs = List()

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

config c.RepoProvider.git_credentials = Unicode('')

Credentials (if any) to pass to git when cloning.

has_higher_quota()

Return true if the given spec has a higher quota

config c.RepoProvider.high_quota_specs = List()

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

is_banned()

Return true if the given spec has been banned

repo_config(settings)

Return configuration for this repository.

config c.RepoProvider.spec_config = List()

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

GitHubRepoProvider

class binderhub.repoproviders.GitHubRepoProvider(*args, **kwargs)

Repo provider for the GitHub service

config c.GitHubRepoProvider.access_token = Unicode('')

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

config c.GitHubRepoProvider.api_base_path = Unicode('https://api.{hostname}')

The base path of the GitHub API

Only necessary if not github.com, e.g. GitHub Enterprise.

Can use {hostname} for substitution, e.g. ‘https://{hostname}/api/v3’

config c.GitHubRepoProvider.banned_specs = List()

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

config c.GitHubRepoProvider.client_id = Unicode('')

GitHub client id for authentication with the GitHub API

For use with client_secret. Loaded from GITHUB_CLIENT_ID env by default.

config c.GitHubRepoProvider.client_secret = Unicode('')

GitHub client secret for authentication with the GitHub API

For use with client_id. Loaded from GITHUB_CLIENT_SECRET env by default.

config c.GitHubRepoProvider.git_credentials = Unicode('')

Credentials (if any) to pass to git when cloning.

config c.GitHubRepoProvider.high_quota_specs = List()

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

config c.GitHubRepoProvider.hostname = Unicode('github.com')

The GitHub hostname to use

Only necessary if not github.com, e.g. GitHub Enterprise.

config c.GitHubRepoProvider.spec_config = List()

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
config c.GitHubRepoProvider.access_token = Unicode('')

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

config c.GitHubRepoProvider.api_base_path = Unicode('https://api.{hostname}')

The base path of the GitHub API

Only necessary if not github.com, e.g. GitHub Enterprise.

Can use {hostname} for substitution, e.g. ‘https://{hostname}/api/v3’

config c.GitHubRepoProvider.client_id = Unicode('')

GitHub client id for authentication with the GitHub API

For use with client_secret. Loaded from GITHUB_CLIENT_ID env by default.

config c.GitHubRepoProvider.client_secret = Unicode('')

GitHub client secret for authentication with the GitHub API

For use with client_id. Loaded from GITHUB_CLIENT_SECRET env by default.

get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

config c.GitHubRepoProvider.hostname = Unicode('github.com')

The GitHub hostname to use

Only necessary if not github.com, e.g. GitHub Enterprise.