-
Notifications
You must be signed in to change notification settings - Fork 350
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
[proposal] Publish a generated extension for Java #3994
Conversation
Thanks for submitting the PR. However I am not able to entirely understand how this is going to work. Is it some user that need to run some command with the proposed configuration? Can you please provide a step by step description of the process? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this would go in substitution of the crd extension for camel-k coming from the Kubernetes client project?
@squakez Sure, sorry for the missing context, here the ultimate goal is to provide the users a Java library to easily interact with typed Camel-K Custom Resources using the //REPOS mavencentral,jitpack
//DEPS io.fabric8:kubernetes-client:6.4.0
//DEPS io.fabric8:generator-annotations:6.4.0
//DEPS com.github.andreaTP:camel-k:0.0.2-SNAPSHOT
import io.fabric8.kubernetes.client.*;
import org.apache.camel.v1.*;
public class testCamelKExtension {
public static void main(String... args) {
var client = new KubernetesClientBuilder().build();
var camelCatalogClient = client.resources(CamelCatalog.class);
camelCatalogClient.list().getItems().forEach(c -> {
System.out.println(c.getMetadata().getName());
});
}
} This is a user experience very close to the one offered by the current extension, let me know if you have any additional doubt or question, happy to clarify 🙂 .
@oscerd this is completely up for discussion, I'm proposing this alternative approach and we can think about keeping the 2 available for some time to see how this works out, wdyt? |
What I still miss to understand who is going to consume such new configurations and how the jar will end up into |
Here we are publishing standard Java Artifacts (i.e. a
that's jitpack.io , you can publish the library to Maven Central but this will require more setup/credentials etc. |
Thanks for the explaination. So, this is not really going to replace the dependency in a repo, but instead would create one on demand when it's requested by the user. I'm not totally against this approach, but I think it may not be seen as something "official". Also, there may be environment where you're not supposed to use jitpack repo and it requires downloading tools (ie, may not work for other OS). However, I do like the simplicity of the action and I'd propose instead to convert that script into a github action that is run when we create a tag for Camel K repo (which means, we do a release). We may support a simple distribution pom that push the dependency to Apache Maven repo (we do something similar in Camel K Runtime, see https://github.com/apache/camel-k-runtime/blob/main/.github/workflows/ci-build.yml#L196). We can start by creating the action and pushing the snapshot on each PR merge, as an additional step in https://github.com/apache/camel-k/blob/main/.github/actions/release-nightly/action.yml#L103 |
Hi @squakez , thanks for bearing with me!
this is not accurate, Jitpack does releases (pretty much like Maven Central), so the artifact is going to be built once.
This is already the case 😄 , the
Happy to go in this direction if it's the desired one 🙂 , it will be a little difficult for an external contributor to get everything right and I would need some support but we can definitely do it! |
I wasn't aware of this feature and it is definetely interesting. I still prefer to publish the dependency under the Apache umbrella, wdyt @oscerd?
Count on it. I think the very first thing is to have a distribution pom with the same configuration of the camel-k-runtime. When we run the push action we'll simply leverage a couple of secrets that we'll configure. |
I think we should follow the Apache guidlines for releasing this stuff. It's true that this is not really critical and it's more a commodity, but probably we should do the normal workflow. |
Sounds like a plan 👍 Give me a little to follow up! |
Updated the PR using a Let me know how this looks to you, and, if possible, please, test it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor changes required, but the overall work looks good, thanks!
.github/workflows/release.yml
Outdated
- name: Deploy to ASF Snapshots Repository | ||
working-directory: java | ||
run: | | ||
./mvnw ${MAVEN_ARGS} clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may use mvn
as there is no wrapper available in the java directory. I guess we need an action to install it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to mvn
, seems like Maven it's already installed:
camel-k/.github/workflows/release.yml
Line 85 in f755475
javaVersion: "11" |
java/pom.xml
Outdated
|
||
<parent> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-dependencies</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd avoid depending by Camel project. We're trying to add all decoupling possible. The maven repo distribution managment info are stored in apache pom from which that camel-dependencies
inherit. So we better use the apache pom directly:
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>23</version>
</parent>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
java/pom.xml
Outdated
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-extension</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer calling it camel-k-model
or maybe even camel-k-crd
. @oscerd wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to camel-k-crd
, no strong opinions though
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.apache.camel.k</groupId> | ||
<artifactId>camel-k-extension</artifactId> | ||
<version>1.17.0-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to edit the make codegen
action to refresh this value, but we can take care of this later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 thanks!
@squakez thanks for the review! Should be ready for the next round! |
@oscerd just to double check with you if I can merge this. As a first thing we should verify that snapshot is published correctly through the action process. Once this is okey, we can add the steps required to release the stable version, wdyt? |
+1 from my side. Thanks |
🎉 thanks to everyone involved! Feel free to ping me if there is any issue I can help with! |
yeah, stick around... we may have some other iteration :) |
Hi all and thanks for the amazing and widely used project!
For some time we are delivering a
java-generator
from CRD as part of the fabric8 kubernetes-client project.We are dissatisfied with the current "extensions" mechanism and, sometimes, we struggle to keep it up to date and maintained.
Here I'm proposing a possible implementation of the automation needed in this repository to publish a package functionally equivalent to the current extension but with close to zero maintenance involved.
You can check the resulting artifacts built from my fork: https://jitpack.io/#andreaTP/camel-k/0.0.2-SNAPSHOT
I'm happy to receive feedback on all the pieces, the automation(
jbang
andjitpack
), the generated code, where to publish etc.cc. @lburgazzoli @manusa
Release Note