Skip to content

Jitpack not working as expected #4998

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

Closed
pai911 opened this issue Dec 20, 2023 · 4 comments
Closed

Jitpack not working as expected #4998

pai911 opened this issue Dec 20, 2023 · 4 comments
Labels
kind/bug Something isn't working

Comments

@pai911
Copy link

pai911 commented Dec 20, 2023

What happened?

When running the example code of Jitpack (https://github.com/apache/camel-k-examples/tree/main/generic-examples/jitpack)

kamel run Jitpack.java -d github:squakez/samplejp:1.0.0-SNAPSHOT

It seemed the integration always goes into Error status without clear error message.

╰─ kamel get
NAME	PHASE	KIT
jitpack	Error	camel/kit-cm1cpb4qqlkcmha0bpv0

I looked up the status of several components, but couldn't figure out why it failed...

Steps to reproduce

Just follow the steps in the Jitpack example from camel-k examples github

Relevant log output

╰─ kubectl get it -o yaml
apiVersion: v1
items:
- apiVersion: camel.apache.org/v1
  kind: Integration
  metadata:
    annotations:
      camel.apache.org/operator.id: camel-k
    creationTimestamp: "2023-12-20T11:14:52Z"
    generation: 1
    name: jitpack
    namespace: camel
    resourceVersion: "4714827818"
    uid: ef70090e-fde1-48b4-95cc-94b05caf21fb
  spec:
    dependencies:
    - github:squakez/samplejp:1.0.0-SNAPSHOT
    sources:
    - content: |-
        /*
         * Licensed to the Apache Software Foundation (ASF) under one or more
         * contributor license agreements.  See the NOTICE file distributed with
         * this work for additional information regarding copyright ownership.
         * The ASF licenses this file to You under the Apache License, Version 2.0
         * (the "License"); you may not use this file except in compliance with
         * the License.  You may obtain a copy of the License at
         *
         *      http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing, software
         * distributed under the License is distributed on an "AS IS" BASIS,
         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         * See the License for the specific language governing permissions and
         * limitations under the License.
         */

        // camel-k: language=java

        import org.apache.camel.builder.RouteBuilder;
        import acme.App;

        public class Jitpack extends RouteBuilder {
          @Override
          public void configure() throws Exception {
              from("timer:tick?period=2000")
                .setBody()
                  .simple(App.capitalize("hello"))
                .to("log:info");

          }
        }
      name: Jitpack.java
    traits: {}
  status:
    conditions:
    - firstTruthyTime: "2023-12-20T11:14:52Z"
      lastTransitionTime: "2023-12-20T11:14:52Z"
      lastUpdateTime: "2023-12-20T11:14:52Z"
      message: camel/camel-k
      reason: IntegrationPlatformAvailable
      status: "True"
      type: IntegrationPlatformAvailable
    - lastTransitionTime: "2023-12-20T11:14:52Z"
      lastUpdateTime: "2023-12-20T11:14:52Z"
      message: creating a new integration kit
      reason: IntegrationKitAvailable
      status: "False"
      type: IntegrationKitAvailable
    dependencies:
    - camel:log
    - camel:timer
    - github:squakez/samplejp:1.0.0-SNAPSHOT
    - mvn:org.apache.camel.k:camel-k-runtime
    - mvn:org.apache.camel.quarkus:camel-quarkus-java-joor-dsl
    digest: vRIQ0j9pvxlbEHd1kgTe57CxEGeCk7p3pJmPS2qW9sO0
    integrationKit:
      name: kit-cm1cpb4qqlkcmha0bpv0
      namespace: camel
    lastInitTimestamp: "2023-12-20T11:14:52Z"
    observedGeneration: 1
    phase: Building Kit
    platform: camel-k
    profile: Kubernetes
    runtimeProvider: quarkus
    runtimeVersion: 3.2.0
    version: 2.1.0
kind: List
metadata:
  resourceVersion: ""
klogs camel-k-operator-6bcfd5b9b6-cc9kt

{"level":"error","ts":"2023-12-20T11:17:26Z","msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"jitpack","namespace":"camel"},"namespace":"camel","name":"jitpack","reconcileID":"c29cf20a-2c70-45eb-b9cf-6da09bad8c74","error":"error during trait customization: mount trait execution failed: unable to find integration container: jitpack","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
{"level":"error","ts":"2023-12-20T11:17:36Z","msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"jitpack","namespace":"camel"},"namespace":"camel","name":"jitpack","reconcileID":"59f337aa-e25b-4918-9660-7010973b583f","error":"error during trait customization: mount trait execution failed: unable to find integration container: jitpack","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
{"level":"error","ts":"2023-12-20T11:17:56Z","msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"jitpack","namespace":"camel"},"namespace":"camel","name":"jitpack","reconcileID":"d7d29122-8cb3-4316-bcef-611dbeb08c9c","error":"error during trait customization: mount trait execution failed: unable to find integration container: jitpack","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
{"level":"error","ts":"2023-12-20T11:18:37Z","msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"jitpack","namespace":"camel"},"namespace":"camel","name":"jitpack","reconcileID":"09c0ff18-3320-44bc-93e9-c893e34940ba","error":"error during trait customization: mount trait execution failed: unable to find integration container: jitpack","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
{"level":"error","ts":"2023-12-20T11:19:59Z","msg":"Reconciler error","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","Integration":{"name":"jitpack","namespace":"camel"},"namespace":"camel","name":"jitpack","reconcileID":"b8871452-998f-4a68-845d-26a8f1592cd4","error":"error during trait customization: mount trait execution failed: unable to find integration container: jitpack","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226"}
╰─ kc describe ik kit-cm1cpb4qqlkcmha0bpv0
Name:         kit-cm1cpb4qqlkcmha0bpv0
Namespace:    camel
Labels:       camel.apache.org/created.by.kind=Integration
              camel.apache.org/created.by.name=jitpack
              camel.apache.org/created.by.namespace=camel
              camel.apache.org/created.by.version=4714827814
              camel.apache.org/kit.layout=fast-jar
              camel.apache.org/kit.priority=1000
              camel.apache.org/kit.type=platform
              camel.apache.org/runtime.provider=quarkus
              camel.apache.org/runtime.version=3.2.0
Annotations:  camel.apache.org/operator.id: camel-k
API Version:  camel.apache.org/v1
Kind:         IntegrationKit
Metadata:
  Creation Timestamp:  2023-12-20T11:14:52Z
  Generation:          1
  Resource Version:    4714832017
  UID:                 32a3ef7c-4bea-4c9c-8d09-eb434ad3aa46
Spec:
  Dependencies:
    camel:log
    camel:timer
    github:squakez/samplejp:1.0.0-SNAPSHOT
    mvn:org.apache.camel.k:camel-k-runtime
    mvn:org.apache.camel.quarkus:camel-quarkus-java-joor-dsl
  Traits:
Status:
  Conditions:
    Last Transition Time:  2023-12-20T11:14:52Z
    Last Update Time:      2023-12-20T11:14:52Z
    Message:               IntegrationPlatform (camel-k)
    Reason:                IntegrationPlatformAvailable
    Status:                True
    Type:                  IntegrationPlatformAvailable
  Digest:                  v480vYI81ZKtdL9vqCv2yT5Z91tIQ8iCuEnjYmZPPubI
  Failure:
    Reason:  failure while building project: : exit status 1
    Recovery:
      Attempt:          5
      Attempt Max:      5
      Attempt Time:     2023-12-20T11:17:12Z
    Time:               2023-12-20T11:14:55Z
  Observed Generation:  1
  Phase:                Error
  Platform:             camel-k
  Runtime Provider:     quarkus
  Runtime Version:      3.2.0
  Version:              2.1.0
Events:
  Type    Reason                      Age    From                                Message
  ----    ------                      ----   ----                                -------
  Normal  IntegrationKitPhaseUpdated  6m39s  camel-k-integration-kit-controller  Integration Kit "kit-cm1cpb4qqlkcmha0bpv0" in phase "Build Submitted"
  Normal  IntegrationKitPhaseUpdated  6m39s  camel-k-integration-kit-controller  Integration Kit "kit-cm1cpb4qqlkcmha0bpv0" in phase "Build Running"
  Normal  IntegrationKitPhaseUpdated  4m16s  camel-k-integration-kit-controller  Integration Kit "kit-cm1cpb4qqlkcmha0bpv0" in phase "Error"

Camel K version

╰─ kamel version
Camel K Client 2.1.0

@pai911 pai911 added the kind/bug Something isn't working label Dec 20, 2023
@squakez
Copy link
Contributor

squakez commented Dec 20, 2023

Strange. It works for me:

$ kamel run Jitpack.java -d github:squakez/samplejp:1.0.0-SNAPSHOT --dev
Integration "jitpack" created
Progress: integration "jitpack" in phase Initialization
...
[1] 2023-12-20 11:50:41,554 INFO  [org.apa.cam.k.Runtime] (main) Apache Camel K Runtime 3.2.0
[1] 2023-12-20 11:50:41,556 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
[1] 2023-12-20 11:50:41,559 INFO  [org.apa.cam.mai.MainSupport] (main) Apache Camel (Main) 4.0.0 is starting
[1] 2023-12-20 11:50:41,588 INFO  [org.apa.cam.k.sup.SourcesSupport] (main) Loading routes from: SourceDefinition{name='Jitpack', language='java', type='source', location='file:/etc/camel/sources/Jitpack.java', }
[1] 2023-12-20 11:50:42,484 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.0.0 (camel-1) is starting
[1] 2023-12-20 11:50:42,494 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes startup (started:1)
[1] 2023-12-20 11:50:42,494 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route1 (timer://tick)
[1] 2023-12-20 11:50:42,495 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.0.0 (camel-1) started in 10ms (build:0ms init:0ms start:10ms)
[1] 2023-12-20 11:50:42,498 INFO  [io.quarkus] (main) camel-k-integration 2.1.0 on JVM (powered by Quarkus 3.2.6.Final) started in 2.244s. 
[1] 2023-12-20 11:50:42,499 INFO  [io.quarkus] (main) Profile prod activated. 
[1] 2023-12-20 11:50:42,499 INFO  [io.quarkus] (main) Installed features: [camel-bean, camel-core, camel-java-joor-dsl, camel-k-core, camel-k-runtime, camel-kubernetes, camel-log, camel-timer, cdi, kubernetes-client, smallrye-context-propagation, vertx]
[1] 2023-12-20 11:50:43,520 INFO  [info] (Camel (camel-1) thread #1 - timer://tick) Exchange[ExchangePattern: InOnly, BodyType: String, Body: v1.0.0-SNAPSHOT:HELLO]

Maybe your failure is related to the registry or any other cause. Have a look at the Camel Integration troubleshooting guide.

@squakez squakez added the status/waiting-for-feedback Needs some feedback label Dec 20, 2023
@pai911
Copy link
Author

pai911 commented Dec 20, 2023

Is there a way to see any more detailed error message than the following? message: 'integration kit camel/kit-cm1d10cqqlkcmha0bq30 is in state "Error". Failure: failure while building project: : exit status 1'

status:
    conditions:
    - lastTransitionTime: "2023-12-20T11:31:13Z"
      lastUpdateTime: "2023-12-20T11:33:36Z"
      message: 'integration kit camel/kit-cm1d10cqqlkcmha0bq30 is in state "Error".
        Failure: failure while building project: : exit status 1'
      reason: IntegrationKitAvailable
      status: "False"
      type: IntegrationKitAvailable
    dependencies:
    - camel:log
    - camel:timer
    - github:squakez/samplejp:main
    - mvn:org.apache.camel.k:camel-k-runtime
    - mvn:org.apache.camel.quarkus:camel-quarkus-java-joor-dsl
    digest: vx7jL06sJVJ9Nd9ZGCk0Upvp7teRikbc1dIHO6QLu0uA
    integrationKit:
      name: kit-cm1d10cqqlkcmha0bq30
      namespace: camel
    lastInitTimestamp: "2023-12-20T11:31:13Z"
    observedGeneration: 3
    phase: Error
    profile: Kubernetes
    runtimeProvider: quarkus
    runtimeVersion: 3.2.0
    version: 2.1.0

It only happens when I try to run the Jitpack example. Is it possible that the registry issue only affects Jitpack example?

With Jitpack (Failure)

╰─ kamel run Jitpack.java -d github:squakez/samplejp:1.0.0-SNAPSHOT --dev
Integration "jitpack" created
Progress: integration "jitpack" in phase Initialization
Integration "jitpack" in phase "Initialization"
Progress: integration "jitpack" in phase Building Kit
Condition "IntegrationPlatformAvailable" is "True" for Integration jitpack: camel/camel-k
Integration "jitpack" in phase "Initialization"
Integration "jitpack" in phase "Building Kit"
Condition "IntegrationKitAvailable" is "False" for Integration jitpack: integration kit camel/kit-cm1ib0kqqlkcmha0bq6g is in state "Build Running"
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Initialization" (recovery 2 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Scheduling" (recovery 2 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Pending" (recovery 2 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Running" (recovery 2 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Failed" (recovery 2 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Initialization" (recovery 3 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Scheduling" (recovery 3 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Pending" (recovery 3 of 5)
Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Running" (recovery 3 of 5)
(combined from similar events): Build "kit-cm1ib0kqqlkcmha0bq6g", created by Integration "jitpack", changed phase to "Failed" (recovery 3 of 5)

Without Jitpack (Success)

╰─ kamel run Sample.java --dev
Integration "sample" created
Progress: integration "sample" in phase Initialization
Progress: integration "sample" in phase Building Kit
Progress: integration "sample" in phase Deploying
Progress: integration "sample" in phase Running
Condition "IntegrationPlatformAvailable" is "True" for Integration sample: camel/camel-k
Integration "sample" in phase "Initialization"
Integration "sample" in phase "Building Kit"
Condition "IntegrationKitAvailable" is "True" for Integration sample: kit-clspaa75nhnt34k4ek30
Integration "sample" in phase "Deploying"
Condition "CronJobAvailable" is "False" for Integration sample: different controller strategy used (deployment)
Condition "DeploymentAvailable" is "True" for Integration sample: deployment name is sample
Condition "ServiceAvailable" is "False" for Integration sample: no http service required
Condition "ExposureAvailable" is "False" for Integration sample: no service defined
Condition "Ready" is "False" for Integration sample
Integration "sample" in phase "Running"
Condition "Ready" is "True" for Integration sample: 1/1 ready replicas
...
[1] 2023-12-20 17:38:33,667 INFO  [org.apa.cam.k.Runtime] (main) Apache Camel K Runtime 3.2.0
[1] 2023-12-20 17:38:33,672 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
[1] 2023-12-20 17:38:33,676 INFO  [org.apa.cam.mai.MainSupport] (main) Apache Camel (Main) 4.0.0 is starting
[1] 2023-12-20 17:38:33,735 INFO  [org.apa.cam.k.sup.SourcesSupport] (main) Loading routes from: SourceDefinition{name='Sample', language='java', type='source', location='file:/etc/camel/sources/Sample.java', }
[1] 2023-12-20 17:38:35,260 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.0.0 (camel-1) is starting
[1] 2023-12-20 17:38:35,275 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes startup (started:1)
[1] 2023-12-20 17:38:35,275 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route1 (timer://tick)
[1] 2023-12-20 17:38:35,276 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.0.0 (camel-1) started in 14ms (build:0ms init:0ms start:14ms)

Any other info is much appreciated!

@squakez
Copy link
Contributor

squakez commented Dec 21, 2023

The guide I've provided above [1] should give you more details on how to troubleshoot an Integration. In your case what is clearly happening is a Maven build failure. I guess there could be some problem accessing the Jitpack repository by your cluster. You can have a more detailed trace checking the log of the Camel K operator Pod (kubectl logs camel-k-operator-xyz) [2].

[1] https://camel.apache.org/camel-k/2.1.x/troubleshooting/troubleshooting.html
[2] https://camel.apache.org/camel-k/2.1.x/troubleshooting/troubleshooting.html#troubleshoot-operator-log

@pai911
Copy link
Author

pai911 commented Dec 21, 2023

Thank you for the clue!

It seems my setting.xml uses company Nexus server as proxy.

To make it work, I had to add the following to Maven settings.xml
(in addition to other basic configs, like adding Jitpack repositories)

  <mirrors>
    <mirror>
      <id>repo-through-public</id>
      <mirrorOf>*,!jitpack.io</mirrorOf>
      <url>https://COMPANY-MAVEN-REPO/</url>
  </mirror>
  <mirror>
      <id>jitpack.io</id>
      <mirrorOf>jitpack.io</mirrorOf>
      <url>https://jitpack.io</url>
  </mirror>
  </mirrors>

It'll make Jitpack related dependencies go around company Nexus.

However, we can also do it the proper way -- that is make company Nexus server support Jitpack

See: jitpack/jitpack.io#506 (comment)

Thank you @squakez

I think we can close this issue?

@pai911 pai911 closed this as completed Dec 21, 2023
@squakez squakez removed the status/waiting-for-feedback Needs some feedback label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants