Skip to content

Maven properties in image name not replaced (Zero-Config mode) #1858

@kuhhpid

Description

@kuhhpid

Describe the bug

In a Zero-Config mode it is currently not possible to use ${git.commit.id.abbrev} in the jkube.generator.name property or other properties defined by the git-commit-id-plugin. @rohanKanojia made the assumption that https://github.com/eclipse/jkube/blob/master/jkube-kit/build/service/docker/src/main/java/org/eclipse/jkube/kit/build/service/docker/helper/ImageNameFormatter.java does not handle this.

Here is the public demo project to reproduce this issue: https://github.com/kuhhpid/jkube-git-commit-id

Eclipse JKube version

1.9.1

Component

Kubernetes Maven Plugin

Apache Maven version

No response

Gradle version

No response

Steps to reproduce

  1. git clone https://github.com/kuhhpid/jkube-git-commit-id
  2. cd jkube-git-commit-id
  3. run mvn package
  4. See described error that ${git.commit.id.abbrev} was not replaced and violates the validation pattern

Expected behavior

The property ${git.commit.id.abbrev} should be replaced with the current git commit id abbrev.

Runtime

other (please specify in additional context)

Kubernetes API Server version

1.24.1

Environment

Linux

Eclipse JKube Logs

[INFO] ----------------< eu.awag.examples:jkube-git-commit-id >----------------
[INFO] Building jkube-git-commit-id 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- git-commit-id-plugin:4.9.10:revision (default) @ jkube-git-commit-id ---
[INFO] 
...
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.9.1:resource (default) @ jkube-git-commit-id ---
[INFO] k8s: Running generator wildfly-jar
[INFO] k8s: wildfly-jar: Using Docker image quay.io/jkube/jkube-java:0.0.16 as base / builder
[INFO] k8s: Using resource templates from /home/alexander/IdeaProjects/jkube-git-commit-id/src/main/jkube
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.168 s
[INFO] Finished at: 2022-10-18T08:51:47+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.9.1:resource (default) on project jkube-git-commit-id: Execution default of goal org.eclipse.jkube:kubernetes-maven-plugin:1.9.1:resource failed: Given Docker name 'registry.gitlab.com/myproject/myrepo/mycontainer:${git.commit.id.abbrev}' is invalid:
[ERROR]    * tag part '${git.commit.id.abbrev}' doesn't match allowed pattern '^[\w][\w.-]{0,127}$'

Sample Reproducer Project

https://github.com/kuhhpid/jkube-git-commit-id

Additional context

My Kubernates flavor is microk8s (https://microk8s.io)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions