Class DockerCredential
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- io.github.cdklabs.cdkpipelines.github.DockerCredential
-
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.62.0 (build 293ac17)", date="2022-07-16T00:20:23.447Z") @Stability(Stable) public class DockerCredential extends software.amazon.jsii.JsiiObject
Represents a credential used to authenticate to a docker registry.Uses the official Docker Login GitHub Action to authenticate.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDockerCredential(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)protectedDockerCredential(software.amazon.jsii.JsiiObjectRef objRef)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DockerCredentialcustomRegistry(String registry, ExternalDockerCredentialSecrets creds)Create a credential for a custom registry.static DockerCredentialdockerHub()Reference credential secrets to authenticate to DockerHub.static DockerCredentialdockerHub(DockerHubCredentialSecrets creds)Reference credential secrets to authenticate to DockerHub.static DockerCredentialecr(String registry)Create a credential for ECR.StringgetName()StringgetPasswordKey()StringgetRegistry()StringgetUsernameKey()-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Method Detail
-
customRegistry
@Stability(Stable) @NotNull public static DockerCredential customRegistry(@NotNull String registry, @NotNull ExternalDockerCredentialSecrets creds)
Create a credential for a custom registry.This method assumes that you will have long-lived GitHub Secrets stored under the usernameKey and passwordKey that will authenticate to the registry you provide.
- Parameters:
registry- This parameter is required.creds- This parameter is required.- See Also:
- https://github.com/marketplace/actions/docker-login
-
dockerHub
@Stability(Stable) @NotNull public static DockerCredential dockerHub(@Nullable DockerHubCredentialSecrets creds)
Reference credential secrets to authenticate to DockerHub.This method assumes that your credentials will be stored as long-lived GitHub Secrets under the usernameKey and personalAccessTokenKey.
The default for usernameKey is
DOCKERHUB_USERNAME. The default for personalAccessTokenKey isDOCKERHUB_TOKEN. If you do not set these values, your credentials should be found in your GitHub Secrets under these default keys.- Parameters:
creds-
-
dockerHub
@Stability(Stable) @NotNull public static DockerCredential dockerHub()
Reference credential secrets to authenticate to DockerHub.This method assumes that your credentials will be stored as long-lived GitHub Secrets under the usernameKey and personalAccessTokenKey.
The default for usernameKey is
DOCKERHUB_USERNAME. The default for personalAccessTokenKey isDOCKERHUB_TOKEN. If you do not set these values, your credentials should be found in your GitHub Secrets under these default keys.
-
ecr
@Stability(Stable) @NotNull public static DockerCredential ecr(@NotNull String registry)
Create a credential for ECR.This method will reuse your AWS credentials to log in to AWS. Your AWS credentials are already used to deploy your CDK stacks. It can be supplied via GitHub Secrets or using an IAM role that trusts the GitHub OIDC identity provider.
NOTE - All ECR repositories in the same account and region share a domain name (e.g., 0123456789012.dkr.ecr.eu-west-1.amazonaws.com), and can only have one associated set of credentials (and DockerCredential). Attempting to associate one set of credentials with one ECR repo and another with another ECR repo in the same account and region will result in failures when using these credentials in the pipeline.
- Parameters:
registry- This parameter is required.
-
getName
@Stability(Stable) @NotNull public String getName()
-
getPasswordKey
@Stability(Stable) @Nullable public String getPasswordKey()
-
getRegistry
@Stability(Stable) @Nullable public String getRegistry()
-
getUsernameKey
@Stability(Stable) @Nullable public String getUsernameKey()
-
-