Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus S2I native binary can't be used with OpenShift build configuration #30829

Closed
michalvavrik opened this issue Feb 2, 2023 · 6 comments
Closed
Labels
area/kubernetes kind/bug Something isn't working

Comments

@michalvavrik
Copy link
Member

michalvavrik commented Feb 2, 2023

Describe the bug

I use OpenShift BuildConfig with S2I native binary to build Quarkus application. Previously I used ubi-quarkus-native-s2i:22.2-java17 (still works), but after #27997 I tried to switch to ubi-quarkus-native-binary-s2i:2.0 which never builds application (never runs mvn package), instead it immediately looks for *-runner which obviously does not exist.

Did I misunderstood change, please? Is ubi-quarkus-native-binary-s2i replacement for ubi-quarkus-native-s2i? ubi-quarkus-graalvmce-s2i doesn't work either.

Expected behavior

There should be a way to use s2i, but ubi-quarkus-native-s2i hasn't been updated for 4 months, 22.3 is not available and clearly different image repository should be used.

Actual behavior

Build fails with

Generating dockerfile with builder image quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0
Adding transient rw bind mount for /run/secrets/rhsm
STEP 1/10: FROM quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0
STEP 2/10: LABEL "io.openshift.build.commit.id"="00641b691281cac0daa66c952110b7c9aa189736"       "io.openshift.build.commit.ref"="main"       "io.openshift.build.commit.message"="[RELEASE] - Bump version to 2.16.1.Final"       "io.openshift.build.source-location"="https://github.com/quarkusio/quarkus-quickstarts.git"       "io.openshift.build.source-context-dir"="getting-started"       "io.openshift.build.image"="quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0"       "io.openshift.build.commit.author"="Guillaume Smet <[email protected]>"       "io.openshift.build.commit.date"="Wed Feb 1 17:56:36 2023 +0100"
STEP 3/10: ENV MAVEN_S2I_ARTIFACT_DIRS="target/quarkus-app"     S2I_SOURCE_DEPLOYMENTS_FILTER="app lib quarkus quarkus-run.jar"     JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0"     AB_JOLOKIA_OFF="true"     JAVA_APP_JAR="/deployments/quarkus-run.jar"     OPENSHIFT_BUILD_NAME="app-1"     OPENSHIFT_BUILD_NAMESPACE="mvavrik-s2i-debug"     OPENSHIFT_BUILD_SOURCE="https://github.com/quarkusio/quarkus-quickstarts.git"     OPENSHIFT_BUILD_COMMIT="00641b691281cac0daa66c952110b7c9aa189736"     MAVEN_ARGS="-s /configuration/settings.xml -DskipTests=true -DskipITs=true -Dquarkus.platform.version=2.16.1.Final -Dquarkus-plugin.version=2.16.1.Final -Dquarkus.platform.group-id=io.quarkus -Dquarkus.platform.version=2.16.1.Final -Dquarkus.platform.group-id=io.quarkus -Dquarkus-plugin.version=2.16.1.Final"
STEP 4/10: USER root
STEP 5/10: COPY upload/src /tmp/src
STEP 6/10: COPY upload/injections/var/run/configs/openshift.io/build/settings-mvn /configuration
STEP 7/10: RUN chown -R 1001:0 /tmp/src /configuration
STEP 8/10: USER 1001
STEP 9/10: RUN /usr/libexec/s2i/assemble
+ SRC_DIR=/tmp/src/
+ echo 'Building with uploaded src from /tmp/src/'
Building with uploaded src from /tmp/src/
Assemblying
+ echo Assemblying
++ ls '/tmp/src//*-runner'
++ wc -l
ls: cannot access '/tmp/src//*-runner': No such file or directory
+ '[' 0 -eq 1 ']'
+ echo 'Could not locate a native image. Have you build a native image using mvn -Pnative before?'
Could not locate a native image. Have you build a native image using mvn -Pnative before?
+ exit 1
error: build error: error building at STEP "RUN /usr/libexec/s2i/assemble": error while running runtime: exit status 1

How to Reproduce?

Reproducer:

Steps to reproduce the behavior:

  1. oc new-project mvavrik-s2i-debug
  2. oc apply -f settings-mvn.yml
  3. oc apply -f openshift.yml
  4. oc logs bc/app -n mvavrik-s2i-debug
  5. (once you collected information) oc delete project mvavrik-s2i-debug

Prerequisities:

  1. create file settings-mvn.yml with following content
apiVersion: v1
kind: ConfigMap
metadata:
  name: settings-mvn
data:
  settings.xml: |
    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
        <profiles>
            <profile>
                <id>redhat</id>
                <repositories>
                    <repository>
                        <id>redhat</id>
                        <name>Repository for Redhat dependencies</name>
                        <url>https://maven.repository.redhat.com/ga/</url>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>redhat</id>
                        <name>Repository for Redhat dependencies</name>
                        <url>https://maven.repository.redhat.com/ga/</url>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
            <profile>
                <id>customRemoteRepository</id>
                <repositories>
                    <repository>
                        <id>internal.s2i.maven.remote.repository</id>
                        <url>${internal.s2i.maven.remote.repository}</url>
                        <snapshots>
                            <enabled>false</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>internal.s2i.maven.remote.repository</id>
                        <url>${internal.s2i.maven.remote.repository}</url>
                        <snapshots>
                            <enabled>false</enabled>
                        </snapshots>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
        </profiles>
        <activeProfiles>
            <activeProfile>customRemoteRepository</activeProfile>
            <activeProfile>redhat</activeProfile>
        </activeProfiles>
    </settings>
  1. create openshift.yml with following content
---
apiVersion: "v1"
kind: "List"
items:
- apiVersion: "image.openshift.io/v1"
  kind: "ImageStream"
  metadata:
    labels:
      scenarioId: "OpenShiftS2iQuickstartUsingDefaultsIT-1675362556927"
    name: "app"
    namespace: "mvavrik-s2i-debug"
  spec:
    lookupPolicy:
      local: false
- apiVersion: "build.openshift.io/v1"
  kind: "BuildConfig"
  metadata:
    labels:
      scenarioId: "OpenShiftS2iQuickstartUsingDefaultsIT-1675362556927"
    name: "app"
    namespace: "mvavrik-s2i-debug"
  spec:
    output:
      to:
        kind: "ImageStreamTag"
        name: "app:latest"
    source:
      configMaps:
      - configMap:
          name: "settings-mvn"
        destinationDir: "/configuration"
      contextDir: "getting-started"
      git:
        uri: "https://github.com/quarkusio/quarkus-quickstarts.git"
      type: "Git"
    strategy:
      sourceStrategy:
        env:
        - name: "MAVEN_ARGS"
          value: "-s /configuration/settings.xml -DskipTests=true -DskipITs=true -Dquarkus.platform.version=2.16.1.Final\
            \ -Dquarkus-plugin.version=2.16.1.Final -Dquarkus.platform.group-id=io.quarkus\
            \ -Dquarkus.platform.version=2.16.1.Final -Dquarkus.platform.group-id=io.quarkus\
            \ -Dquarkus-plugin.version=2.16.1.Final"
        from:
          kind: "DockerImage"
          name: "quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0"
      type: "Source"
    triggers:
    - type: "ConfigChange"
    - imageChange: {}
      type: "ImageChange"
- apiVersion: "apps.openshift.io/v1"
  kind: "DeploymentConfig"
  metadata:
    labels:
      scenarioId: "OpenShiftS2iQuickstartUsingDefaultsIT-1675362556927"
    name: "app"
    namespace: "mvavrik-s2i-debug"
  spec:
    replicas: 1
    selector:
      name: "app"
    template:
      metadata:
        labels:
          name: "app"
          tsLogWatch: "app"
          scenarioId: "OpenShiftS2iQuickstartUsingDefaultsIT-1675362556927"
        namespace: "mvavrik-s2i-debug"
      spec:
        containers:
        - env:
          - name: "quarkus.log.console.format"
            value: "%d{HH:mm:ss,SSS} %s%e%n"
          image: "app:latest"
          name: "app"
          ports:
          - containerPort: 8080
            protocol: "TCP"
    test: false
    triggers:
    - type: "ConfigChange"
    - imageChangeParams:
        automatic: true
        containerNames:
        - "app"
        from:
          kind: "ImageStreamTag"
          name: "app:latest"
      type: "ImageChange"
- apiVersion: "v1"
  kind: "Service"
  metadata:
    labels:
      scenarioId: "OpenShiftS2iQuickstartUsingDefaultsIT-1675362556927"
    name: "app"
    namespace: "mvavrik-s2i-debug"
  spec:
    ports:
    - name: "8080-tcp"
      port: 8080
      protocol: "TCP"
      targetPort: 8080
    selector:
      name: "app"
- apiVersion: "route.openshift.io/v1"
  kind: "Route"
  metadata:
    labels:
      scenarioId: "OpenShiftS2iQuickstartUsingDefaultsIT-1675362556927"
    name: "app"
    namespace: "mvavrik-s2i-debug"
  spec:
    to:
      name: "app"

Output of uname -a or ver

Linux

Output of java -version

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

GraalVM version (if different from Java)

22.3

Quarkus version or git rev

2.16.1.FInal

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

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)

Additional information

No response

@michalvavrik michalvavrik added the kind/bug Something isn't working label Feb 2, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 2, 2023

/cc @geoand (openshift), @iocanel (openshift)

@michalvavrik
Copy link
Member Author

/cc @cescoffier

@cescoffier
Copy link
Member

@michalvavrik I don't believe you use the right s2i. You need quay.io/quarkus/ubi-quarkus-graalvmce-s2i:VERSION

The binary one is expected to have built a native executable already. See https://github.com/quarkusio/quarkus-images#s2i---source-to-image.

@michalvavrik
Copy link
Member Author

Thank you @cescoffier . I honestly don't know where I could read that fact. I can't find any reference of ubi-quarkus-graalvmce-s2i in Quarkus main project and there is no description https://quay.io/repository/quarkus/ubi-quarkus-graalvmce-s2i?tab=info. Is there some source of truth so that other people don't have same problems as me, or am I not looking properly?

@cescoffier
Copy link
Member

The Quarkus-images readme would be the right source.

@michalvavrik
Copy link
Member Author

I see, didn't know about that project. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants