1

I made a JHipster application, and I want to add CI/CD with a private Gitlab runner to deploy on a private Docker registry. I get this failure:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.0.0:build (default-cli) on project powerfront: Invalid image reference :master-35274d52bd71e28f08a0428832001cc67e9c446d, perhaps you should check that the reference is formatted correctly according to https://docs.docker.com/engine/reference/commandline/tag/#extended-description
 [ERROR] For example, slash-separated name components cannot have uppercase letters: Invalid image reference: :master-35274d52bd71e28f08a0428832001cc67e9c446d

This is the relevant part of my .gitlab-ci.yml

# Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com
docker-push:
    stage: release
    variables:
        REGISTRY_URL: 10.1.10.58
        IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA
    dependencies:
        - maven-package
    script:
        - ./mvnw -ntp compile jib:build -Pprod -Djib.to.image=$IMAGE_TAG -Djib.to.auth.username=gitlab-ci-token  -Djib.to.auth.password=$CI_BUILD_TOKEN -Dmaven.repo.local=$MAVEN_USER_HOME

EDIT: There was an unconfigured variable. Now I get

 [ERROR] I/O error for image [10.1.10.58:5000/powerfront]:
 [ERROR]     javax.net.ssl.SSLException
 [ERROR]     Unrecognized SSL message, plaintext connection?

How do I tell the runner to accept unsecure (plaintext) connections?

2 Answers2

2

To publish to a private (or another public) registry, your image name must start by the host name of the registry : private.registry.io/group/image:version so that Docker daemon knows that it doesn't push to Docker Hub (which the default) but to private.registry.io

Also U can use Kaniko to publish your image, as it doesn't require dind or privileged mode on Docker daemon.

yodamad
  • 1,452
  • 14
  • 24
  • To accept unsecured registry, you have to configure your daemon : https://docs.docker.com/registry/insecure/ – yodamad May 04 '20 at 14:16
  • I'm not familiar with jib, I'd rather user Kaniko : https://github.com/GoogleContainerTools/kaniko on my CI pipelines to push images – yodamad May 04 '20 at 20:48
  • 2
    If using jib, u may set your script to something : mvn jib -Djib.allowInsecureRegistries=true or set the flag in your pom.xml ? – yodamad May 04 '20 at 20:49
0

I'm not sure that is a Gitlab CI problem. but with JHipster.
What is the value for CI_REGISTRY_IMAGE? We don't see the value in the error message.

Arash Hatami
  • 5,297
  • 5
  • 39
  • 59