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

Refactor build, deploy and run workflow #107

Merged
merged 7 commits into from
Sep 20, 2018

Conversation

lburgazzoli
Copy link
Contributor

removed:

  • project build
  • intermediate copy of dependencies mvn dependency:copy-dependencies

improved:

  • maven update policy set to never

new things:

  • compute classpath with mvn dependency:build-classpath
  • classpath included in cr and runtime configmap
  • s2i/run now uses classpath from a file (from the configmap)

notes:

  • some workarounds are needed as run-java.sh appears to have troubles in case JAVA_APP_JAR is not set
  • artifacts location is different from build time /tmp/artifacts/m2 to runtime /runtime/m2

@lburgazzoli lburgazzoli added the status/wip Work in progress label Sep 20, 2018
Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally it seems ok. If it works, I can start from this to separate classpath computation from image publishing and to define different strategies for the latter..

@@ -1,9 +1,12 @@
apiVersion: camel.apache.org/v1alpha1
kind: IntegrationContext
metadata:
name: root.integrationcontexts.camel.apache.org
name: core.integrationcontexts.camel.apache.org
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just "core"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's too simple :)

@lburgazzoli
Copy link
Contributor Author

let me do some cleanup

@lburgazzoli
Copy link
Contributor Author

context with dependencies:

$ oc get ictx groovy -o yaml
apiVersion: camel.apache.org/v1alpha1
kind: IntegrationContext
metadata:
  clusterName: ""
  creationTimestamp: 2018-09-20T15:36:35Z
  generation: 0
  labels:
    app: camel-k
    camel.apache.org/context.created.by.kind: Operator
    camel.apache.org/context.created.by.name: core
    camel.apache.org/context.type: platform
  name: groovy
  namespace: camel-k
  resourceVersion: "179138"
  selfLink: /apis/camel.apache.org/v1alpha1/namespaces/camel-k/integrationcontexts/groovy
  uid: f4cc58fc-bcea-11e8-97bd-525400eed8b1
spec:
  classpath:
  - id: org.apache.camel.k:camel-k-runtime-jvm:jar:0.0.3-SNAPSHOT
    location: /tmp/artifacts/m2/org/apache/camel/k/camel-k-runtime-jvm/0.0.3-SNAPSHOT/camel-k-runtime-jvm-0.0.3-SNAPSHOT.jar
  - id: org.slf4j:slf4j-api:jar:1.7.25
    location: /tmp/artifacts/m2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar
  - id: org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.0
    location: /tmp/artifacts/m2/org/apache/logging/log4j/log4j-slf4j-impl/2.11.0/log4j-slf4j-impl-2.11.0.jar
  - id: org.apache.logging.log4j:log4j-api:jar:2.11.0
    location: /tmp/artifacts/m2/org/apache/logging/log4j/log4j-api/2.11.0/log4j-api-2.11.0.jar
  - id: org.apache.logging.log4j:log4j-core:jar:2.11.0
    location: /tmp/artifacts/m2/org/apache/logging/log4j/log4j-core/2.11.0/log4j-core-2.11.0.jar
  - id: org.jooq:joor-java-8:jar:0.9.9
    location: /tmp/artifacts/m2/org/jooq/joor-java-8/0.9.9/joor-java-8-0.9.9.jar
  - id: commons-io:commons-io:jar:2.6
    location: /tmp/artifacts/m2/commons-io/commons-io/2.6/commons-io-2.6.jar
  - id: org.apache.commons:commons-lang3:jar:3.8
    location: /tmp/artifacts/m2/org/apache/commons/commons-lang3/3.8/commons-lang3-3.8.jar
  - id: org.apache.camel:camel-core:jar:2.22.1
    location: /tmp/artifacts/m2/org/apache/camel/camel-core/2.22.1/camel-core-2.22.1.jar
  - id: com.sun.xml.bind:jaxb-core:jar:2.3.0.1
    location: /tmp/artifacts/m2/com/sun/xml/bind/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar
  - id: com.sun.xml.bind:jaxb-impl:jar:2.3.0.1
    location: /tmp/artifacts/m2/com/sun/xml/bind/jaxb-impl/2.3.0.1/jaxb-impl-2.3.0.1.jar
  - id: org.apache.camel:camel-groovy:jar:2.22.1
    location: /tmp/artifacts/m2/org/apache/camel/camel-groovy/2.22.1/camel-groovy-2.22.1.jar
  - id: org.codehaus.groovy:groovy-all:jar:2.4.15
    location: /tmp/artifacts/m2/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar
  dependencies:
  - camel:core
  - camel:groovy
status:
  digest: vTA1Ab9PkI7TjboutWhUsury6fw-NYeOzlzHNUfydMfw
  image: 172.30.1.1:5000/camel-k/camel-k-context-groovy:179015
  phase: Ready

@lburgazzoli
Copy link
Contributor Author

classpath file content:

[jboss@3787dd263f1e deployments]$ cat classpath 
dependencies/org.apache.camel.k/camel-k-runtime-jvm-0.0.3-SNAPSHOT.jar
dependencies/org.slf4j/slf4j-api-1.7.25.jar
dependencies/org.apache.logging.log4j/log4j-slf4j-impl-2.11.0.jar
dependencies/org.apache.logging.log4j/log4j-api-2.11.0.jar
dependencies/org.apache.logging.log4j/log4j-core-2.11.0.jar
dependencies/org.jooq/joor-java-8-0.9.9.jar
dependencies/commons-io/commons-io-2.6.jar
dependencies/org.apache.commons/commons-lang3-3.8.jar
dependencies/org.apache.camel/camel-core-2.22.1.jar
dependencies/com.sun.xml.bind/jaxb-core-2.3.0.1.jar
dependencies/com.sun.xml.bind/jaxb-impl-2.3.0.1.jar
dependencies/org.apache.camel/camel-groovy-2.22.1.jar
dependencies/org.codehaus.groovy/groovy-all-2.4.15.jar

Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good! Just few comments, mainly for clarification..

@@ -125,6 +125,7 @@ type IntegrationContext struct {
// IntegrationContextSpec --
type IntegrationContextSpec struct {
Dependencies []string `json:"dependencies,omitempty"`
Classpath []ClasspathEntry `json:"classpath,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this to "status"? I don't think it's something the user should set. It's computed from the dependencies.

// ClasspathEntry --
type ClasspathEntry struct {
ID string `json:"id" yaml:"id"`
Location string `json:"location,omitempty" yaml:"location,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We store both the ID and the relative location?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or that is intended to be the location in the m2 repo in the builder pod? (or both?)

<modelVersion>4.0.0</modelVersion>
<packaging>maven-plugin</packaging>

<artifactId>camel-k-runtime-dependency-lister</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can give it a more generic name and reuse it for other tasks (in the future, not necessarily now). E.g. "camel-k-runtime-meta-plugin".
I'm thinking e.g. to have a mojo that extract info on the route (to be called out-of-band respect to image build), in order to have full info about the route and then apply the optimizations we talked about in the dev mailing list. Just thinking..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, feel free to rename it :)

Copy link
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

@lburgazzoli
Copy link
Contributor Author

@nicolaferraro here the new context:

apiVersion: camel.apache.org/v1alpha1
kind: IntegrationContext
metadata:
  clusterName: ""
  creationTimestamp: 2018-09-20T16:17:00Z
  generation: 0
  labels:
    app: camel-k
    camel.apache.org/context.created.by.kind: Operator
    camel.apache.org/context.created.by.name: core
    camel.apache.org/context.type: platform
  name: groovy
  namespace: camel-k
  resourceVersion: "182724"
  selfLink: /apis/camel.apache.org/v1alpha1/namespaces/camel-k/integrationcontexts/groovy
  uid: 9a9901a5-bcf0-11e8-97bd-525400eed8b1
spec:
  dependencies:
  - camel:core
  - camel:groovy
status:
  classpath:
  - org.apache.camel.k:camel-k-runtime-jvm:jar:0.0.3-SNAPSHOT
  - org.slf4j:slf4j-api:jar:1.7.25
  - org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.0
  - org.apache.logging.log4j:log4j-api:jar:2.11.0
  - org.apache.logging.log4j:log4j-core:jar:2.11.0
  - org.jooq:joor-java-8:jar:0.9.9
  - commons-io:commons-io:jar:2.6
  - org.apache.commons:commons-lang3:jar:3.8
  - org.apache.camel:camel-core:jar:2.22.1
  - com.sun.xml.bind:jaxb-core:jar:2.3.0.1
  - com.sun.xml.bind:jaxb-impl:jar:2.3.0.1
  - org.apache.camel:camel-groovy:jar:2.22.1
  - org.codehaus.groovy:groovy-all:jar:2.4.15
  digest: vTA1Ab9PkI7TjboutWhUsury6fw-NYeOzlzHNUfydMfw
  image: 172.30.1.1:5000/camel-k/camel-k-context-groovy:182662
  phase: Ready

Copy link
Member

@nicolaferraro nicolaferraro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@nicolaferraro nicolaferraro merged commit 8ffe7b5 into apache:master Sep 20, 2018
@lburgazzoli lburgazzoli removed the status/wip Work in progress label Sep 21, 2018
@lburgazzoli lburgazzoli deleted the maven-classpath branch September 21, 2018 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants