sjednac / sbt-ecr

An SBT plugin for managing Docker images within Amazon ECR.
Other
53 stars 25 forks source link

Incompatible with latest AWS SDK #21

Closed fooblahblah closed 6 years ago

fooblahblah commented 6 years ago

I'm using the latest aws-java-sdk (1.11.289) and it appears sbt-ecr is only compatible with sdks around version 1.11.33.

Following the examples in the README I hit a couple errors.

Here's the subset of my build.sbt pertaining to sbt-ecr:


region           in Ecr := Region.getRegion(Regions.US_EAST_1)
repositoryName   in Ecr := "homebay"
localDockerImage in Ecr := (packageName in Docker).value + ":" + (version in Docker).value

// Create the repository before authentication takes place (optional)
login in Ecr := ((login in Ecr) dependsOn (createRepository in Ecr)).value

// Authenticate and publish a local Docker image before pushing to ECR
push in Ecr := ((push in Ecr) dependsOn (publishLocal in Docker, login in Ecr)).value

The first is the createRepository task fails to instantiate com.amazonaws.services.ecr.AmazonECRClient:

[homebay] $ reload
[info] Loading global plugins from /home/jsimpson/.sbt/0.13/plugins
[info] Loading project definition from /home/jsimpson/workspace/homebay/project
[info] Set current project to homebay (in build file:/home/jsimpson/workspace/homebay/)
[homebay] $ feeds/ecr:push
[info] Wrote /home/jsimpson/workspace/homebay/feeds/target/scala-2.12/feeds_2.12-1.0.0.pom
[info] Wrote /home/jsimpson/workspace/homebay/target/scala-2.12/homebay_2.12-c9f759ef98a419ade612c71f1663c5eb48b33a9f-SNAPSHOT.pom
[info] Sending build context to Docker daemon  223.4MB
[info] Step 1/7 : FROM openjdk:latest
[info]  ---> db77212ffe05
[info] Step 2/7 : LABEL MAINTAINER "Jeff Simpson <jeff@homebay.com>"
[info]  ---> Using cache
[info]  ---> 99b1f1d6ca3a
[info] Step 3/7 : WORKDIR /.
[info]  ---> Using cache
[info]  ---> 46528284043e
[info] Step 4/7 : ADD --chown=daemon:daemon . /.
[info]  ---> Using cache
[info]  ---> f3e17eb90f59
[info] Step 5/7 : USER daemon
[info]  ---> Using cache
[info]  ---> b32c0ead8e64
[info] Step 6/7 : ENTRYPOINT bin/feeds
[info]  ---> Using cache
[info]  ---> b7e7906a8bbc
[info] Step 7/7 : CMD
[info]  ---> Using cache
[info]  ---> 5a109b8f36ca
[info] Successfully built 5a109b8f36ca
[info] Successfully tagged homebay-feeds:1.0.0
[info] Built image homebay-feeds:1.0.0
[trace] Stack trace suppressed: run last feeds/ecr:createRepository for the full output.
[error] (feeds/ecr:createRepository) Couldn't instantiate instance of class com.amazonaws.services.ecr.AmazonECRClient
[error] Total time: 3 s, completed Mar 6, 2018 9:31:57 PM

I also tried changing the login task to not depend on createRepository and then get a different error more telling

[homebay] $ feeds/ecr:push
[info] Wrote /home/jsimpson/workspace/homebay/feeds/target/scala-2.12/feeds_2.12-1.0.0.pom
[info] Wrote /home/jsimpson/workspace/homebay/target/scala-2.12/homebay_2.12-c9f759ef98a419ade612c71f1663c5eb48b33a9f-SNAPSHOT.pom
[info] Sending build context to Docker daemon  223.4MB
[info] Step 1/7 : FROM openjdk:latest
[info]  ---> db77212ffe05
[info] Step 2/7 : LABEL MAINTAINER "Jeff Simpson <jeff@homebay.com>"
[info]  ---> Using cache
[info]  ---> 99b1f1d6ca3a
[info] Step 3/7 : WORKDIR /.
[info]  ---> Using cache
[info]  ---> 46528284043e
[info] Step 4/7 : ADD --chown=daemon:daemon . /.
[info]  ---> Using cache
[info]  ---> f3e17eb90f59
[info] Step 5/7 : USER daemon
[info]  ---> Using cache
[info]  ---> b32c0ead8e64
[info] Step 6/7 : ENTRYPOINT bin/feeds
[info]  ---> Using cache
[info]  ---> b7e7906a8bbc
[info] Step 7/7 : CMD
[info]  ---> Using cache
[info]  ---> 5a109b8f36ca
[info] Successfully built 5a109b8f36ca
[info] Successfully tagged homebay-feeds:1.0.0
[info] Built image homebay-feeds:1.0.0
[trace] Stack trace suppressed: run last feeds/ecr:login for the full output.
[error] (feeds/ecr:login) java.lang.NoSuchMethodError: com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient.getCallerIdentity(Lcom/amazonaws/services/securitytoken/model/GetCallerIdentityRequest;)Lcom/amazonaws/services/securitytoken/model/GetCallerIdentityResult;
[error] Total time: 3 s, completed Mar 6, 2018 9:33:31 PM

Any chance we could get a new release updated against the latest API?

sjednac commented 6 years ago

Should be fixed in 0.9.0. Thanks for reporting this!