Skip to content

Gradle plugin to generate Amazon AWS ECR (Elastic Container Repository) tokens within your gradle builds without needing external systems to do that for you.

Notifications You must be signed in to change notification settings

reines/ecr-token-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECR Token Plugin

About

Gradle plugin to help generate an AWS ECR authentication token using AWS' API for use in your gradle builds. This allows you to use tools like Google's Jib to create docker containers within your gradle build without needing external dependencies to manage the token. Just declare the plugin and use theecrToken variable in your Jib authentication block.

Example

apply {
    id "com.fuseanalytics.gradle.ecrToken"
}

jib {
    container {
        entrypoint = ["..."]
        ...
    }
    from {
        image = "amazoncorretto:17-alpine"      // this only an example image not required
    }
    to {
        // your ECR repository goes here
        image = "xxxxx.dkr.ecr.us-east-1.amazonaws.com/yourProject:${project.version}-${buildNumber}"
    }
    auth {
        // this is where you use the `ecrToken` variable to get the token
        EcrToken token = ecrToken.get()
        username = token.user
        password = token.password
    }
    ...

You'll need to set up your AWS credentials as normal with your aws_access_key_id and aws_secret_access_key. Consult AWS documentation on how to exactly do that. You can't provide your access key and secret access key in the build because that will be too likely that you'll check in those secrets in your repo and that's a serious no-no. That feature does NOT exist to keep you from doing something insecure.

Good news is there is nothing else to configure. It's very simple.

About

Gradle plugin to generate Amazon AWS ECR (Elastic Container Repository) tokens within your gradle builds without needing external systems to do that for you.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Groovy 100.0%