Skip to content

Commit

Permalink
chore(camel-k): Allow to set camel-kamelets version for Camel JBang
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Aug 29, 2023
1 parent b7b2e72 commit 0f743bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ private static void addTrust() {
private static List<String> camel(String... args) {
List<String> jBangArgs = new ArrayList<>();
jBangArgs.add(String.format("-Dcamel.jbang.version=%s", CamelJBangSettings.getCamelVersion()));

if (!CamelJBangSettings.getKameletsVersion().isBlank()) {
jBangArgs.add(String.format("-Dcamel-kamelets.version=%s", CamelJBangSettings.getKameletsVersion()));
}

jBangArgs.add(CamelJBangSettings.getCamelApp());
jBangArgs.addAll(List.of(args));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public final class CamelJBangSettings {
private static final String CAMEL_VERSION_ENV = JBANG_ENV_PREFIX + "CAMEL_VERSION";
private static final String CAMEL_VERSION_DEFAULT = "3.20.4";

private static final String KAMELETS_VERSION_PROPERTY = JBANG_PROPERTY_PREFIX + "kamelets.version";
private static final String KAMELETS_VERSION_ENV = JBANG_ENV_PREFIX + "KAMELETS_VERSION";
private static final String KAMELETS_VERSION_DEFAULT = "";

private static final String KAMELETS_LOCAL_DIR_PROPERTY = JBANG_PROPERTY_PREFIX + "kamelets.local.dir";
private static final String KAMELETS_LOCAL_DIR_ENV = JBANG_ENV_PREFIX + "KAMELETS_LOCAL_DIR";

Expand Down Expand Up @@ -148,4 +152,13 @@ public static String getCamelVersion() {
System.getenv(CAMEL_VERSION_ENV) != null ? System.getenv(CAMEL_VERSION_ENV) : CAMEL_VERSION_DEFAULT);
}

/**
* Kamelets version used by the JBang runtime.
* @return
*/
public static String getKameletsVersion() {
return System.getProperty(KAMELETS_VERSION_PROPERTY,
System.getenv(KAMELETS_VERSION_ENV) != null ? System.getenv(KAMELETS_VERSION_ENV) : KAMELETS_VERSION_DEFAULT);
}

}

0 comments on commit 0f743bc

Please sign in to comment.