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

Modeline and file-based options on http/github endpoints #1522

Closed
nicolaferraro opened this issue Jun 11, 2020 · 9 comments
Closed

Modeline and file-based options on http/github endpoints #1522

nicolaferraro opened this issue Jun 11, 2020 · 9 comments
Milestone

Comments

@nicolaferraro
Copy link
Member

nicolaferraro commented Jun 11, 2020

This #1515 introduces new ways to run integrations from the cloud directly.

What about modeline options that can be declared in the remote file?

E.g. the file declares something like:

// camel-k: property-file=application.properties

from("").to("")

Currently file-based options are ignored on remote URLs. But can we do better? ("possibly" avoiding infinite recursion).

@nicolaferraro nicolaferraro added this to the 1.1.0 milestone Jun 11, 2020
@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jun 11, 2020

should they follow the same path? i.e.

// camel-k: property-file=github:user/repo/application.properties

@nicolaferraro
Copy link
Member Author

I'd better allow relative paths, so they work both when checking out the repo or running integrations remotely.

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jun 11, 2020

It is a little complex as you don't know what is the relative path, assuming that you can run an integration with multiple sources i.e.

kamel run github:user/repo/Source1.java github:user/repo/common/Customizer.java 

unless the relative path is related to the file being processed but that would add a slightly different behaviour when property-file is used from the CLI vs from the modeline.

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jun 11, 2020

mh, wonder if we should add a working-dir option like:

kamel run \
    --working-dir github:user/repo MyRoute.java \
    --property-file=application.property

would be translated to:

kamel run \
    github:user/repo/MyRoute.java \
    --property-file=github:user/repo/application.property

but it could be smart and detect that all the required bits are also available locally and opt to use them directly

@nicolaferraro
Copy link
Member Author

nicolaferraro commented Jun 11, 2020

The current approach, also for local files, is to ignore the current CWD dir in the shell. All file-based modeline options are always relative to the file that contains them. It can be the same for remote files.

So the --working-dir github:user/repo is implicit if you run kamel run github:user/repo/MyRoute.java.

@lburgazzoli
Copy link
Contributor

Yep but my point is that there's a different behaviour for the same option used inside a source and outside the source so property-file=application.properties may related to two different locations depending where the option is used, if that's acceptable I can work on it

@nicolaferraro
Copy link
Member Author

Yep but my point is that there's a different behaviour for the same option used inside a source and outside the source so property-file=application.properties may related to two different locations depending where the option is used, if that's acceptable I can work on it

Oh, yes. I think this difference is already there.

Take a file like ./path/It.java and a property file ./application.properties.

To run the file and link it to the properties, you should run:

kamel run ./path/It.java --property-file application.properties

Because CLI options are not related to the file but to the current location.

But if you want to link it using modeline, you should write this line in the file:

// camel-k: property-file=../application.properties

I don't see it as a big problem, we just need to document it ;)

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jun 11, 2020

I guess we can do both so:

  1. if the working-dir is set, all the non absolute paths are relative to the working dir
  2. if not set, the non absolute paths are relative to the context (to the file for modeline, to the current cwd for the CLI)

This would also mean that application-property=github:user/rep/path would also be possible from modeline.

I think this would give the max flexibility but maybe it is too much ?

@nicolaferraro nicolaferraro modified the milestones: 1.1.0, 1.2.0 Jul 16, 2020
@nicolaferraro nicolaferraro modified the milestones: 1.2.0, 1.3.0 Oct 13, 2020
@nicolaferraro nicolaferraro modified the milestones: 1.3.0, 1.4.0 Dec 22, 2020
@nicolaferraro nicolaferraro modified the milestones: 1.4.0, 1.5.0 Apr 13, 2021
@nicolaferraro nicolaferraro modified the milestones: 1.5.0, 1.6.0 Jul 5, 2021
@nicolaferraro nicolaferraro modified the milestones: 1.6.0, 1.7.0 Sep 7, 2021
@nicolaferraro nicolaferraro modified the milestones: 1.7.0, 1.8.0 Nov 15, 2021
@oscerd oscerd modified the milestones: 1.8.0, 1.9.0 Jan 19, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale due to 90 days of inactivity.
It will be closed if no further activity occurs within 15 days.
If you think that’s incorrect or the issue should never stale, please simply write any comment.
Thanks for your contributions!

@oscerd oscerd modified the milestones: 1.9.0, 1.9.1 Apr 26, 2022
@oscerd oscerd modified the milestones: 1.9.1, 1.9.2 May 13, 2022
@oscerd oscerd modified the milestones: 1.9.2, 2.0.0 May 23, 2022
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

3 participants