How to build Jenkins quarkus native image?

I try to convert github action to jenkins pipeline. This github action generate a native image via Jib.

This is the commande line

mvn package -Pnative -DskipTests -Dquarkus.native.container-build=true -Dquarkus.container-image.registry= -Dquarkus.container-image.push=true -Dquarkus.container-image.image=${SERVICE_NAME}:${TAG_NAME} '-Dquarkus.jib.labels."org.opencontainers.image.revision"='${TAG_NAME}

But i do not understant why it failed on jenkins.

Error raised is :

[2023-11-21T14:22:46.451Z] [ERROR]  [error]: Build step io.quarkus.container.image.deployment.ContainerImageProcessor#publishImageInfo threw an exception: java.lang.NullPointerException: Cannot invoke "String.contains(java.lang.CharSequence)" because "registry" is null

I parse google with no success ..

If someone could help me...



  • TLDR

    quarkus.container-image.image has to be full image reference, that's where your problem comes from.

    Why ?

    As specified in documentation :


    Represents the entire image string. If set, then group, name, registry, tags, additionalTags are ignored

    So there are two solutions

    Best one IMHO

    Remove ignored fields and fix your quarkus.container-image.image, as it should be full url to your image, for example :

    So in your case, it should look like this${SERVICE_NAME}:${TAG_NAME}

    Or second one

    As you provided quarkus.container-image.image, additional quarkus.container-image.registry is ignored. Simply remove quarkus.container-image.image and it should work as is.

    EDIT About private http only registry

    As documentation state :

    The registry does not support HTTPS. We do not pass authentication details on non-HTTPS connections, though this can be overridden with the sendCredentialsOverHttp system property, but it is not recommend (version 0.9.9).

    Simply add this param to your maven command :