Credentials and Credential¶
Credentials¶
This module implements the Credentials class, which is intended to be a container-like interface for all of the Global credentials defined on a single Jenkins node.
- class jenkinsapi.credentials.Credentials(baseurl: str, jenkins_obj: Jenkins)[source]¶
Bases:
JenkinsBase
This class provides a container-like API which gives access to all global credentials on a Jenkins node.
Returns a list of Credential Objects.
- class jenkinsapi.credentials.Credentials2x(baseurl: str, jenkins_obj: Jenkins)[source]¶
Bases:
Credentials
This class provides a container-like API which gives access to all global credentials on a Jenkins node.
Returns a list of Credential Objects.
Credential¶
Module for jenkinsapi Credential class
- class jenkinsapi.credential.AmazonWebServicesCredentials(cred_dict)[source]¶
Bases:
Credential
AWS credential using the CloudBees AWS Credentials Plugin See https://wiki.jenkins.io/display/JENKINS/CloudBees+AWS+Credentials+Plugin
- Constructor expects following dict:
- {
‘credential_id’: str, Automatically set by jenkinsapi ‘displayName’: str, Automatically set by Jenkins ‘fullName’: str, Automatically set by Jenkins ‘description’: str, ‘accessKey’: str, ‘secretKey’: str, ‘iamRoleArn’: str, ‘iamMfaSerialNumber’: str
}
When creating credential via jenkinsapi automatic fields not need to be in dict
- class jenkinsapi.credential.Credential(cred_dict, jenkins_class='')[source]¶
Bases:
object
Base abstract class for credentials
Credentials returned from Jenkins don’t hold any sensitive information, so there is nothing useful can be done with existing credentials besides attaching them to Nodes or other objects.
You can create concrete Credential instance: UsernamePasswordCredential or SSHKeyCredential by passing credential’s description and credential dict.
Each class expects specific credential dict, see below.
- class jenkinsapi.credential.SSHKeyCredential(cred_dict: dict)[source]¶
Bases:
Credential
SSH key credential
- Constructr expects following dict:
- {
‘credential_id’: str, Automatically set by jenkinsapi ‘displayName’: str, Automatically set by Jenkins ‘fullName’: str, Automatically set by Jenkins ‘typeName’: str, Automatically set by Jenkins ‘description’: str, ‘userName’: str, ‘passphrase’: str, SSH key passphrase, ‘private_key’: str Private SSH key
}
private_key value is parsed to find type of credential to create:
private_key starts with - the value is private key itself
These credential variations are no longer supported by SSH Credentials plugin. jenkinsapi will raise ValueError if they are used:
private_key starts with / the value is a path to key private_key starts with ~ the value is a key from ~/.ssh
When creating credential via jenkinsapi automatic fields not need to be in dict
- property attrs¶
- class jenkinsapi.credential.SecretTextCredential(cred_dict)[source]¶
Bases:
Credential
Secret text credential
- Constructor expects following dict:
- {
‘credential_id’: str, Automatically set by jenkinsapi ‘displayName’: str, Automatically set by Jenkins ‘fullName’: str, Automatically set by Jenkins ‘typeName’: str, Automatically set by Jenkins ‘description’: str, ‘secret’: str,
}
When creating credential via jenkinsapi automatic fields not need to be in dict
- class jenkinsapi.credential.UsernamePasswordCredential(cred_dict: dict)[source]¶
Bases:
Credential
Username and password credential
- Constructor expects following dict:
- {
‘credential_id’: str, Automatically set by jenkinsapi ‘displayName’: str, Automatically set by Jenkins ‘fullName’: str, Automatically set by Jenkins ‘typeName’: str, Automatically set by Jenkins ‘description’: str, ‘userName’: str, ‘password’: str
}
When creating credential via jenkinsapi automatic fields not need to be in dict