diff --git a/src/main/groovy/io/seqera/wave/service/inspect/ContainerInspectServiceImpl.groovy b/src/main/groovy/io/seqera/wave/service/inspect/ContainerInspectServiceImpl.groovy index 567208d16..14417b3e3 100644 --- a/src/main/groovy/io/seqera/wave/service/inspect/ContainerInspectServiceImpl.groovy +++ b/src/main/groovy/io/seqera/wave/service/inspect/ContainerInspectServiceImpl.groovy @@ -95,14 +95,16 @@ class ContainerInspectServiceImpl implements ContainerInspectService { repos.add(cacheRepo) final result = credsJson(repos, identity) if( buildRepo && result && !result.contains(host0(buildRepo)) ) - throw new BadRequestException("Missing credentials for target build repository: $buildRepo") + throw new BadRequestException("Missing credentials for container repository: $buildRepo") if( cacheRepo && result && !result.contains(host0(cacheRepo)) ) - throw new BadRequestException("Missing credentials for target cache repository: $buildRepo") + throw new BadRequestException("Missing credentials for container repository: $cacheRepo") return result } static protected String host0(String repo) { - repo.tokenize('/')[0] + ContainerCoordinates + .parse(repo) + .registry } protected String credsJson(Set repositories, PlatformId identity) { diff --git a/src/test/groovy/io/seqera/wave/service/builder/ContainerBuildServiceTest.groovy b/src/test/groovy/io/seqera/wave/service/builder/ContainerBuildServiceTest.groovy index 537806fd2..1f9f72ddf 100644 --- a/src/test/groovy/io/seqera/wave/service/builder/ContainerBuildServiceTest.groovy +++ b/src/test/groovy/io/seqera/wave/service/builder/ContainerBuildServiceTest.groovy @@ -337,9 +337,11 @@ class ContainerBuildServiceTest extends Specification { expect: ContainerInspectServiceImpl.host0(CONTAINER) == EXPECTED where: - CONTAINER | EXPECTED - 'docker.io' | 'docker.io' - 'docker.io/foo/'| 'docker.io' + CONTAINER | EXPECTED + 'docker.io' | 'docker.io' + 'docker.io/foo/' | 'docker.io' + 'foo/bar' | 'docker.io' + 'quay.io/foo/bar' | 'quay.io' } def 'should handle job completion event and update build store'() {