- edited description
Errors executing populateECRCredentials via pushImage
Parameter values have been somehow vaulted for security
Some problems were found with the configuration of task ':populateECRCredentials'.
> No value has been specified for property 'repository'.
> No value has been specified for property 'registryId'.
> No value has been specified for property 'registryUrl'.
My config
def lastExitCode = 0
def TARGET_ENVIRONMENTS = [:]
TARGET_ENVIRONMENTS['AWSPRE'] = [dockerImageName: 'XX-YY', dockerImageTag: 'sprint9', targetRepository: 'ZZZZ' +
'.amazonaws.com']
TARGET_ENVIRONMENTS['AWSPRO'] = [dockerImageName: 'XX-YY', dockerImageTag: 'sprint9', targetRepository: ZZZZZ' +
'.amazonaws.com']
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:3.0.6'
classpath "gradle.plugin.com.patdouble:gradle-aws-ecr-plugin:0.3.2"
}
}
repositories {
maven {
url 'https://repo.gradle.org/gradle/libs-releases-local'
}
mavenCentral()
}
ext {
socatContainerName = 'socat'
}
apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin
apply plugin: com.patdouble.gradle.awsecr.AwsecrPlugin
docker {
registryCredentials {
url = 'https://123456789012.dkr.ecr.us-east-1.amazonaws.com'
}
}
import com.bmuschko.gradle.docker.response.*
import com.bmuschko.gradle.docker.tasks.container.*
import com.bmuschko.gradle.docker.tasks.image.*
import com.patdouble.gradle.awsecr.PopulateECRCredentials
class CheckDockerContainer
extends DockerInspectContainer {
boolean exists = false
boolean running = false
public CheckDockerContainer() {
setResponseHandler(
new ResponseHandler<Void, Object>() {
@Override
Void handle(Object container) {
exists = container?.state
running = container?.state?.running
}
})
}
@Override
public void start() {
try {
super.start()
} catch (Throwable error) {
if (error.class.name.endsWith("NotFoundException")) {
exists = false
running = false
}
}
}
}
// Check socat container
task checkSocatContainer(type: CheckDockerContainer) {
targetContainerId { '' + socatContainerName }
}
// Create one start and one stop Task per DB environment
TARGET_ENVIRONMENTS.each { envName, envProps ->
tasks.create(name: "buildImage$envName", type: DockerBuildImage, group: DOCKER_GROUP) {
dependsOn bootRepackage
dependsOn checkSocatContainer
doFirst {
if ((lastExitCode != 0) || (!checkSocatContainer.exists) || (!checkSocatContainer.running)) {
throw new GradleException("Socat container must be running in order to build images. If you already have one, start it:\n\n" +
" > docker start socat\n\n" +
"If you don't have an existing socat container, run it in this way:\n\n" +
" > docker run -d --name socat -v /var/run/docker.sock:/var/run/docker.sock -p 2375:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock")
}
}
inputDir = file('.')
tag = envProps.dockerImageName
}
tasks.create(name: "tagImage$envName", type: DockerTagImage, group: DOCKER_GROUP) {
dependsOn "buildImage$envName"
force = true
tag = envProps.dockerImageTag
imageId = envProps.dockerImageName
repository = "${envProps.targetRepository}/${imageId}"
}
tasks.create(name: "pushImage$envName", type: DefaultTask) {
dependsOn "tagImage$envName"
doLast {
exec {
commandLine DOCKER, 'push', "${envProps.targetRepository}/${envProps.dockerImageName}:${envProps.dockerImageTag}"
}
}
}
}
Comments (21)
-
reporter -
reporter - edited description
-
repo owner How are you specifying the AWS credentials?
Currently the plugin supports one registry URL with multiple repositories under that URL. In your example you are specifying multiple URLs and the one configured in the docker.registryCredentials is an example URL. Is that what you intended?
-
reporter Credentials, Via gradle -P The one in docker.registryCredentials is the one you had on the example. Yes i want to use 2 different urls, but to test the plugin i was aiming to test with one to see if it woks
Have you any clue about what is happening?
-
repo owner Issue
#7was marked as a duplicate of this issue. -
repo owner No ideas yet, but using the example registry URL is definitely not going to work. It will fail at the authentication step because that repo does not exist.
-
reporter Hi patrick
I know this url is not going to work. I use my one, but the error raises and attached on the issue when opened, is before credentials
Have you had to chance to debug/ check it? El El lun, 1 may 2017 a las 14:30, Patrick Double <
-
repo owner Are you running the
populateECRCredentials
task directly? -
repo owner I was able to reproduce with your example when running
gradle buildImageAWSPRE
. It is because thedockerImageName
isXX-YY
, there is no ECR URL here. If I change it to:TARGET_ENVIRONMENTS['AWSPRE'] = [dockerImageName: '123456789012.dkr.ecr.us-east-1.amazonaws.com/pre', dockerImageTag: 'sprint9', targetRepository: 'https://123456789012.dkr.ecr.us-east-1.amazonaws.com'] TARGET_ENVIRONMENTS['AWSPRO'] = [dockerImageName: '123456789012.dkr.ecr.us-east-1.amazonaws.com/pro', dockerImageTag: 'sprint9', targetRepository: 'https://123456789012.dkr.ecr.us-east-1.amazonaws.com']
-
reporter With this config same error. pushImageAWSPRO
def lastExitCode = 0 def TARGET_ENVIRONMENTS = [:] TARGET_ENVIRONMENTS['Nexus'] = [dockerImageName: 'osoco/ulyseo-pricing', dockerImageTag: 'sprint9', targetRepository: 'nexus.osoco.es'] TARGET_ENVIRONMENTS['AWSPRE'] = [dockerImageName: 'ulyseo-pricing', dockerImageTag: 'sprint9', targetRepository: '599613132154.dkr.ecr.eu-west-1/' + '.amazonaws.com'] TARGET_ENVIRONMENTS['AWSPRO'] = [dockerImageName: '314021470857.dkr.ecr.eu-west-1.amazonaws.com/ulyseo-pricing', dockerImageTag: 'sprint9', targetRepository: 'https://314021470857.dkr.ecr' + '.eu-west-1.amazonaws.com'] buildscript { repositories { jcenter() maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath 'com.bmuschko:gradle-docker-plugin:3.0.6' classpath "gradle.plugin.com.patdouble:gradle-aws-ecr-plugin:0.3.2" } } repositories { maven { url 'https://314021470857.dkr.ecr.eu-west-1.amazonaws.com' } mavenCentral() } ext { socatContainerName = 'socat' } apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin apply plugin: com.patdouble.gradle.awsecr.AwsecrPlugin docker { registryCredentials { url = 'https://123456789012.dkr.ecr.us-east-1.amazonaws.com' } } import com.bmuschko.gradle.docker.response.* import com.bmuschko.gradle.docker.tasks.container.* import com.bmuschko.gradle.docker.tasks.image.* import com.patdouble.gradle.awsecr.PopulateECRCredentials class CheckDockerContainer extends DockerInspectContainer { boolean exists = false boolean running = false public CheckDockerContainer() { setResponseHandler( new ResponseHandler<Void, Object>() { @Override Void handle(Object container) { exists = container?.state running = container?.state?.running } }) } @Override public void start() { try { super.start() } catch (Throwable error) { if (error.class.name.endsWith("NotFoundException")) { exists = false running = false } } } } // Check socat container task checkSocatContainer(type: CheckDockerContainer) { targetContainerId { '' + socatContainerName } } // Create one start and one stop Task per DB environment TARGET_ENVIRONMENTS.each { envName, envProps -> tasks.create(name: "buildImage$envName", type: DockerBuildImage, group: DOCKER_GROUP) { dependsOn bootRepackage dependsOn checkSocatContainer doFirst { if ((lastExitCode != 0) || (!checkSocatContainer.exists) || (!checkSocatContainer.running)) { throw new GradleException("Socat container must be running in order to build images. If you already have one, start it:\n\n" + " > docker start socat\n\n" + "If you don't have an existing socat container, run it in this way:\n\n" + " > docker run -d --name socat -v /var/run/docker.sock:/var/run/docker.sock -p 2375:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock") } } inputDir = file('.') tag = envProps.dockerImageName } tasks.create(name: "tagImage$envName", type: DockerTagImage, group: DOCKER_GROUP) { dependsOn "buildImage$envName" force = true tag = envProps.dockerImageTag imageId = envProps.dockerImageName repository = "${envProps.targetRepository}/${imageId}" } tasks.create(name: "pushImage$envName", type: DefaultTask) { dependsOn "tagImage$envName" doLast { exec { commandLine DOCKER, 'push', "${envProps.targetRepository}/${envProps.dockerImageName}:${envProps.dockerImageTag}" } } } }
:populateECRCredentials FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Some problems were found with the configuration of task ':populateECRCredentials'.
No value has been specified for property 'registryId'. No value has been specified for property 'registryUrl'. No value has been specified for property 'repository'.
- What went wrong:
Some problems were found with the configuration of task ':populateECRCredentials'.
-
repo owner I'd expect that last case to work. I'll look into it.
-
reporter Any advance?
https://mailtrack.io/ Enviado con Mailtrack https://mailtrack.io/install?source=signature&lang=es&referral=ferparis@gmail.com&idSignature=23
-
repo owner Been busy lately, nothing yet.
-
I'd try setting the tag in the
DockerTagImage
task to what is the current equivalent of"${envProps.targetRepository}/${imageId}:${envProps.dockerImageTag}"
.FWIW: your "targetRepository" seems to pointing a registry and not a repository which is potentially confusing and less useful.
-
repo owner Issue is that multiple docker registries is confusing the plugin. I'll have a fix in within the next 24 hours.
-
repo owner - changed status to open
-
repo owner - changed status to resolved
Ignore repositories with no ECR URL. Fixes
#8→ <<cset e61398d6f24f>>
-
repo owner Anyway you can test branch https://bitbucket.org/double16/gradle-aws-ecr-plugin/branch/handle-multiple-repos-8 ?
-
repo owner Merged in handle-multiple-repos-8 (pull request #8)
Ignore repositories with no ECR URL. Fixes
#8-
Ignore repositories with no ECR URL. Fixes
#8 -
Update changelog
Approved-by: Patrick Double pat@patdouble.com
→ <<cset ed49cf7165a5>>
-
-
repo owner Merged in handle-multiple-repos-8 (pull request #8)
Ignore repositories with no ECR URL. Fixes
#8-
Ignore repositories with no ECR URL. Fixes
#8 -
Update changelog
Approved-by: Patrick Double pat@patdouble.com
→ <<cset ed49cf7165a5>>
-
-
hi, I have the same issue. My gradle config is:
buildscript { repositories { mavenCentral() jcenter() maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.8.RELEASE") classpath('com.bmuschko:gradle-docker-plugin:3.2.0') classpath('gradle.plugin.com.patdouble:gradle-aws-ecr-plugin:0.3.3') } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'com.bmuschko.docker-remote-api' apply plugin: 'com.patdouble.awsecr' import com.bmuschko.gradle.docker.tasks.image.* import com.patdouble.gradle.awsecr.* sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies { compile("org.springframework.boot:spring-boot-starter-web") // tag::actuator[] compile("org.springframework.boot:spring-boot-starter-actuator") // end::actuator[] // tag::tests[] testCompile("org.springframework.boot:spring-boot-starter-test") // end::tests[] } jar { baseName = 'gs-spring-boot' version = '0.1.0' } docker { registryCredentials { url = 'https://572625494961.dkr.ecr.us-east-1.amazonaws.com' } } task copyJar(type: Copy) { dependsOn 'jar' from "build/libs/${jar.baseName}-${jar.version}.jar" into 'build/docker' rename { String fileName -> fileName.replace("-${jar.version}", "") } } task buildDockerImage(type: DockerBuildImage) { dependsOn 'copyJar' url = 'unix:///var/run/docker.sock' inputDir = file('.') tag = "latest" } build.dependsOn copyJar build.dependsOn buildDockerImage
ERROR is FAILURE: Build failed with an exception.
- What went wrong:
Some problems were found with the configuration of task ':populateECRCredentials'.
No value has been specified for property 'registryId'. No value has been specified for property 'registryUrl'.
- What went wrong:
Some problems were found with the configuration of task ':populateECRCredentials'.
- Log in to comment