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

The test pipeline should also perform deployment #15

Open
iocanel opened this issue Nov 22, 2023 · 8 comments
Open

The test pipeline should also perform deployment #15

iocanel opened this issue Nov 22, 2023 · 8 comments

Comments

@iocanel
Copy link
Collaborator

iocanel commented Nov 22, 2023

The pipeline currently performs a simple maven build.
It would be create if we had a deployment step.

The deployment step could just use ./mvnw quarkus:deploy -Dquarkus.openshift.deploy=true or something like this.

@cmoulliard
Copy link
Collaborator

The deployment step could just use ./mvnw quarkus:deploy -Dquarkus.openshift.deploy=true or something like this.

So it will be needed that we set different values such as:

  • namespace where deployment should take place
  • registry where image will be pushed
  • creds to push to the remote registry

NOTE: Pod created could fail if the backend system required (postgresql, etc) is not available. So do we plan to also manage the binding and/or binding + deployment of the backend ? @iocanel

@cmoulliard
Copy link
Collaborator

cmoulliard commented Nov 22, 2023

Test 1

I don t see a deployment yaml created within the namespace running the tekton task "deploy". Log just reports

[maven-deploy : mvn-goals] [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 696ms
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Selecting target 'openshift' since it has the highest priority among the implicitly enabled deployment targets
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.PropertyUtil] Openshift manifests are generated with 'The container port http' having default value '8080'. The app and manifests will get out of sync if the property 'quarkus.http.port' is changed at runtime.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 4084ms
[maven-deploy : mvn-goals] [INFO] ------------------------------------------------------------------------

Test 2

I executed a new pipelineRun and now I can see the resources deployed. FYI: I passed as param -Dquarkus.log.level=DEBUG which helps to see what it is populated and deployed

[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Deploying to openshift server: https://172.30.0.1:443/ in namespace: test2.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Applied: Service quarkus-helloworld.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Applied: ImageStream openjdk-11.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Applied: ImageStream quarkus-helloworld.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Applied: BuildConfig quarkus-helloworld.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Applied: DeploymentConfig quarkus-helloworld.
[maven-deploy : mvn-goals] [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 4675ms
[maven-deploy : mvn-goals] [INFO] ------------------------------------------------------------------------
...
k get svc,deploymentconfig,imagestream,buildconfig
Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
NAME                         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/quarkus-helloworld   ClusterIP   172.30.35.99   <none>        80/TCP    3m35s

NAME                                                    REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfig.apps.openshift.io/quarkus-helloworld   0          1         0         image(quarkus-helloworld:1.0-SNAPSHOT)

NAME                                                IMAGE REPOSITORY                                                            TAGS                                                       UPDATED
imagestream.image.openshift.io/openjdk-11           registry.access.redhat.com/ubi8/openjdk-11                                  1.10,1.10-1,1.10-1-source,1.10-1.1634738701 + 46 more...   2 minutes ago
imagestream.image.openshift.io/quarkus-helloworld   image-registry.openshift-image-registry.svc:5000/test2/quarkus-helloworld                                                              

NAME                                                TYPE     FROM     LATEST
buildconfig.build.openshift.io/quarkus-helloworld   Source   Binary   0

@cmoulliard
Copy link
Collaborator

cmoulliard commented Nov 22, 2023

Question: As quarkus.openshift.deploy=true generates ocp resources like buildconfig.build.openshift.io. Should we in a next step/task launch the build if the deployment was successfull ? @iocanel

@cmoulliard
Copy link
Collaborator

cmoulliard commented Nov 22, 2023

FYI. If we trigger a build - https://console-openshift-console.apps.qshift.snowdrop.dev/k8s/ns/test2/builds/quarkus-helloworld-1 the resulting image build fails to start from the pod

Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...
ERROR No such file /deployments/quarkus-run.jar
INFO exec -a "java" java -javaagent:/usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -XX:MaxRAMPercentage=80.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar
INFO running in /deployments
Error: -jar requires jar file specification
Usage: java [options] <mainclass> [args...]
(to execute a class)
or java [options] -jar <jarfile> [args...]
(to execute a jar file)
or java [options] -m <module>[/<mainclass>] [args...]
java [options] --module <module>[/<mainclass>] [args...]
(to execute the main class in a module)
or java [options] <sourcefile> [args]
(to execute a single source-file program)

Screenshot 2023-11-22 at 17 49 58

Here is the log of the s2i build

Generating dockerfile with builder image registry.access.redhat.com/ubi8/openjdk-11@sha256:67fee4b64b269f5666a1051d806635b675903ef56d07b7cc019d3d59ff1aa97c
Adding transient rw bind mount for /run/secrets/rhsm
STEP 1/9: FROM registry.access.redhat.com/ubi8/openjdk-11@sha256:67fee4b64b269f5666a1051d806635b675903ef56d07b7cc019d3d59ff1aa97c
STEP 2/9: LABEL "io.openshift.build.image"="registry.access.redhat.com/ubi8/openjdk-11@sha256:67fee4b64b269f5666a1051d806635b675903ef56d07b7cc019d3d59ff1aa97c" "io.openshift.build.source-location"="/tmp/build/inputs" "io.openshift.s2i.destination"="/tmp"
STEP 3/9: ENV OPENSHIFT_BUILD_NAME="quarkus-helloworld-1" OPENSHIFT_BUILD_NAMESPACE="test2"
STEP 4/9: USER root
STEP 5/9: COPY upload/src /tmp/src
STEP 6/9: RUN chown -R 185:0 /tmp/src
STEP 7/9: USER 185
STEP 8/9: RUN /usr/local/s2i/assemble
INFO S2I source build with plain binaries detected
INFO Copying binaries from /tmp/src to /deployments ...
STEP 9/9: CMD /usr/local/s2i/run
COMMIT temp.builder.openshift.io/test2/quarkus-helloworld-1:27e98fd4
Getting image source signatures
Copying blob sha256:1053d00b8e292c8a36bef630a0f4977b29da4e2fd60ac9425e0fcd1f7c1108d5
Copying blob sha256:b30496cd9d7b7402019d1bb2893cb544b3a20ec2b1c42e891ccedcdb7e7fe606
Copying blob sha256:a8e7738568a708ad2fdddce8e33dc850e7c6837aa50e089e5f7f47b0781a24af
Copying config sha256:ddd0ccced9b49a8b2b6fc2303de2a00a3c045518ed5d8b38275196d6fce21b22
Writing manifest to image destination
--> ddd0ccced9b4
Successfully tagged temp.builder.openshift.io/test2/quarkus-helloworld-1:27e98fd4
ddd0ccced9b49a8b2b6fc2303de2a00a3c045518ed5d8b38275196d6fce21b22
Pushing image image-registry.openshift-image-registry.svc:5000/test2/quarkus-helloworld:1.0-SNAPSHOT ...
Getting image source signatures
Copying blob sha256:a8e7738568a708ad2fdddce8e33dc850e7c6837aa50e089e5f7f47b0781a24af
Copying blob sha256:dc35b837139a95d1b9f7f7b0435a024a74ab972416bdc248f3f608c9f917a753
Copying blob sha256:4009473c181390dadf086f42ecb4b10fb87f5e79de8d0195f6c22239985b2da0
Copying config sha256:ddd0ccced9b49a8b2b6fc2303de2a00a3c045518ed5d8b38275196d6fce21b22
Writing manifest to image destination
Successfully pushed image-registry.openshift-image-registry.svc:5000/test2/quarkus-helloworld@sha256:feb19828c0594b1192b5282995ec2efc7e5cb588e83fbcfb998e8d44841a1be7
Push successful

NOTE: Red Hat documentation don't use -Ddeploy.openshift but instead -Ddeploy.kubernetes by the way -> https://access.redhat.com/documentation/en-us/red_hat_build_of_quarkus/quarkus-3.2/guide/85e494b4-4e47-4831-8294-212c4c838c7b !

@iocanel

cmoulliard added a commit that referenced this issue Nov 22, 2023
…on ocp. #15

Signed-off-by: cmoulliard <cmoulliard@redhat.com>
@cmoulliard cmoulliard mentioned this issue Nov 22, 2023
@cmoulliard
Copy link
Collaborator

Build issue fixed after I changed the maven parameters to perform the build using docker and not s2i

    - name: maven-build
      runAfter:
        - virtualmachine
      taskRef:
        name: maven
      params:
        - name: DOCKER_HOST
          value: "tcp://$(tasks.virtualmachine.results.ip):2376"
        - name: GOALS
          value:
          - package
          - -Dquarkus.openshift.build-strategy=docker
          - -Dquarkus.container-image.build=true
          - -Dquarkus.container-image.push=true

@iocanel
Copy link
Collaborator Author

iocanel commented Nov 23, 2023

We could possibly live without the registry and credentials and default to the internal registry for now (unless it requires very low effort).

Reagrding quarkus.kubernetes.deploy vs quarkus.opesnhift.deploy both are meant to work. The later is a bit more specific and is meant to bring in the openshift extension.

@cmoulliard
Copy link
Collaborator

We could possibly live without the registry and credentials and default to the internal registry for now (unless it requires very low effort).

I agree with you as tekton task (= mvn package -Dquarkus.container-image.push=true) works using internal registry ;-)

iocanel pushed a commit that referenced this issue Nov 27, 2023
…on ocp. #15

Signed-off-by: cmoulliard <cmoulliard@redhat.com>
@cmoulliard
Copy link
Collaborator

Can we close this issue ? @iocanel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants