quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.76k stars 2.68k forks source link

Kubernetes manifests are not created when building with gradle kotlin DSL #30975

Open fjlobaton opened 1 year ago

fjlobaton commented 1 year ago

Describe the bug

When building images for kubernetes with the jib and kubernetes extension and building with gradle with kotlin DSL, it does not create the kubernetes manifests. Works on regular gradle Works on maven

Expected behavior

build with no errors and created kubernetes manifests

Actual behavior

Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring. Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring. No project was detected, skipping generation of kubernetes manifests!

How to Reproduce?

Reproducer: Not working example: https://github.com/fjlobaton/gradle-kotlin-dsl-kubernetes-bug

  1. execute ./gradlew build
  2. see error No project was detected, skipping generation of kubernetes manifests! There are other errors as the docker registry is not configured and should be ignored

Working example https://github.com/fjlobaton/gradle-workin-kubernetes same steps as above, and this creates the kubernetes manifest files

Output of uname -a or ver

No response

Output of java -version

OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

io.quarkus.platform:quarkus-bom:pom:2.16.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 7.5.1

Additional information

`5:42:05 p. m.: Executing 'build'...

Task :processResources Task :quarkusGenerateCode Task :quarkusGenerateCodeDev UP-TO-DATE Task :compileJava Task :classes Task :jar Task :quarkusGenerateCodeTests Task :compileTestJava NO-SOURCE Task :processTestResources NO-SOURCE Task :testClasses UP-TO-DATE Task :test NO-SOURCE Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring. Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring. No project was detected, skipping generation of kubernetes manifests! Base image 'registry.access.redhat.com/ubi8/openjdk-17-runtime:1.14' does not use a specific image digest - build may not be reproducible Task :quarkusBuild Task :assemble Task :check UP-TO-DATE Task :build

BUILD SUCCESSFUL in 20s 7 actionable tasks: 6 executed, 1 up-to-date 5:42:25 p. m.: Execution finished 'build'. `

quarkus-bot[bot] commented 1 year ago

/cc @Sgitario (kubernetes), @evanchooly (kotlin), @geoand (jib,kotlin,kubernetes), @glefloch, @iocanel (kubernetes), @quarkusio/devtools

geoand commented 1 year ago

Any chance you can put together a small sample that shows this problem in action?

iocanel commented 1 year ago

The problem is that the kotlin DSL is not supported in dekorate and thus it fails to actually read some of the project information. We should either build support for the kotlin DSL in dekorate, or compose the missing information from build items.

iocanel commented 1 year ago

Hmmm, it seems that the kotlin DSL is supported in dekorate after all. I need to take a closer look.

fjlobaton commented 1 year ago

@geoand

Any chance you can put together a small sample that shows this problem in action?

Fixed the report and added the faulty example and a working example with regular gradle

geoand commented 1 year ago

@iocanel @Sgitario is this still a problem with Dekorate?

Sgitario commented 1 year ago

@iocanel @Sgitario is this still a problem with Dekorate?

I have no clues about what @iocanel mentioned in his previous comments, so let's wait for him.