Screwdriver CD Python SDK
Table of Contents
- screwdriver_cd_python_sdk.events.create_and_start_event(screwdriver_api_url: str, body: object, token: str) object [source]
Creates and starts a specific event.
If an error occurs, this function returns nothing but throws the causing error.
- Parameters
screwdriver_api_url – The URL of the Screwdriver API server. For example: http://192.168.7.2:9001 or https://mysd.com
body – The exact same body as the one used in “POST /v4/events” Swagger API
token – The Screwdriver API token
- Returns
The exact same response body as the “POST /v4/events” Swagger API in JSON
- screwdriver_cd_python_sdk.events.start_build(pipeline_id: int, screwdriver_api_url: str, token: str) object [source]
Creates and starts a pipeline build.
- Parameters
pipeline_id – The ID of the pipeline to trigger the build
screwdriver_api_url – The URL of the Screwdriver API server. For example: http://192.168.7.2:9001 or https://mysd.com
token – The Screwdriver API token
- Returns
The exact same response body as the “POST /v4/events” Swagger API in JSON
- screwdriver_cd_python_sdk.pipeline.create_pipeline(checkout_url: str, screwdriver_api_url: str, token: str, source_directory: object = None) object [source]
Creates a new Screwdriver pipeline for a particular repo and an optional source directory.
If the source_directory is not specified, it defaults to the repo root.
- Parameters
checkout_url – The URL of the repository containing the screwdriver.yaml file of the pipeline created
screwdriver_api_url – The URL of the Screwdriver API server
token – The Screwdriver API token
source_directory – The custom directory that this pipeline is based upon. See
- Source Directory
for more details
- Returns
the native API response body object with the following fields:
{ "id":1, "name":"QubitPi/screwdriver-cd-python-sdk", "scmUri":"github.com:746187061:master", "scmContext":"github:github.com", "scmRepo":{ "branch":"master", "name":"QubitPi/screwdriver-cd-python-sdk", "url":"https://github.com/QubitPi/screwdriver-cd-python-sdk/tree/master", "rootDir":"", "private":false }, "createTime":"2024-02-17T09:55:32.632Z", "admins":{ "QubitPi":true }, "workflowGraph":{ "nodes":[ ... ], "edges":[ ... ] }, "annotations":{ }, "prChain":false, "state":"ACTIVE", "subscribedScmUrlsWithActions":[ ] }
- screwdriver_cd_python_sdk.pipeline.search_pipelines_by_name(name: str, screwdriver_api_url: str, token: str) list[object] [source]
Returns, at most 50 entries, all pipelines whose name contains a specified pipeline name
- Parameters
name – The pipeline name to search. e.g. “QubitPi/my-project”
screwdriver_api_url – The URL of the Screwdriver API server
token – The Screwdriver API token
- Returns
the native API response body object with the following fields:
[ { "id":6, "name":"QubitPi/theresa", "scmUri":"github.com:631185801:master", "scmContext":"github:github.com", "scmRepo":{ "branch":"master", "name":"QubitPi/theresa", "url":"https://github.com/QubitPi/theresa/tree/master", "rootDir":"", "private":true }, "createTime":"2024-02-17T11:00:30.036Z", "admins":{ "QubitPi":true }, "workflowGraph":{ "nodes":[ ... ], "edges":[ ... ] }, "annotations":{ }, "prChain":false, "parameters":{ }, "settings":{ }, "state":"ACTIVE", "subscribedScmUrlsWithActions":[ ] } ]
- screwdriver_cd_python_sdk.screwdriver_initializer.initialize(pipelines_config_path: str, screwdriver_api_url: str, token: str) None [source]
Given a JSON file containing Screwdriver pipeline definitions, this method initializes all pipelines on a running Screwdriver instance.
The basics works like this
[ { "git": "git@github.com:QubitPi/hashicorp-aws.git" }, { "git": "git@github.com:QubitPi/docker-kong.git" }, ]
We also support loading AWS secrets into Screwdriver instances. To do that, download the IAM credentials CSV file and specify the absolute path of that file by
[ { "git": "git@github.com:QubitPi/docker-kong.git", "awsCredentialFile": "abs-path-to/aws_accessKeys.csv", } ]
In addition, one can also preload Screwdriver Secrets with, for example
[ { "git": "git@github.com:QubitPi/docker-kong.git", "secrets": [ { "name": "MY_CREDENTIAL_FILE", "type": "file", "value": "/home/root/credential.json" }, { "name": "MY_PASSWORD", "type": "value", "value": "23efdsf324gfdg" } ], } ]
Note that both value and file based secrets are supported as shown in the example above
- Parameters
pipelines_config_path – The absolute JSON file containing Screwdriver pipeline definitions
screwdriver_api_url – The Screwdriver API URL. For example, https://screwdriver.mycompany.com
token – The Screwdriver API Token