Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
FUSETOOLS2-2163 - Upgrade to Camel K 2.1.0
Browse files Browse the repository at this point in the history
- remove command to deploy with a resource as it was provided only for
files and this feature has been deprecated in 2.0 and removed in 2.1
- the telemetry indicates that his feature was almost never used anyway
see apache/camel-k#4853 (comment)

Signed-off-by: Aurélien Pupier <[email protected]>
  • Loading branch information
apupier committed Oct 24, 2023
1 parent b21bf9d commit 2a6e6d0
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/insider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Configure Kamel (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
curl -Lo kamel.tar.gz https://github.com/apache/camel-k/releases/download/v2.0.0/camel-k-client-2.0.0-linux-64bit.tar.gz
curl -Lo kamel.tar.gz https://github.com/apache/camel-k/releases/download/v2.1.0/camel-k-client-2.1.0-linux-amd64.tar.gz
tar -zxvf kamel.tar.gz
chmod +x kamel
sudo mv kamel /usr/local/bin/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Configure Kamel (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
curl -Lo kamel.tar.gz https://github.com/apache/camel-k/releases/download/v2.0.0/camel-k-client-2.0.0-linux-64bit.tar.gz
curl -Lo kamel.tar.gz https://github.com/apache/camel-k/releases/download/v2.1.0/camel-k-client-2.1.0-linux-amd64.tar.gz
tar -zxvf kamel.tar.gz
chmod +x kamel
sudo mv kamel /usr/local/bin/
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ All notable changes to the "vscode-camelk" extension will be documented in this

- Requires jbang for java standalone completion. It allows also to get rid of internal dependency to `kamel local` which is removed from kamel 2.x.
- Fix Java standalone support on Windows
- Update default runtime version to v2.0.0
- Update default runtime version to v2.1.0
- Removal of `Start integration with resources` command as Camel K 2.1 is no more supporting it with files (which was the only implemented use case)

## 0.0.35

Expand Down
3 changes: 0 additions & 3 deletions docs/content/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ You can start a new Camel K integration with or without additional options such
- **Secret - Apache Camel K Integration with Kubernetes Secret as Runtime Configuration**
Select a Secret from a list of the published Secrets in your current Kubernetes system. For more information about configuration with ConfigMaps or Secrets, see [Configuration via ConfigMap or Secret](https://camel.apache.org/camel-k/next/configuration/runtime-config.html) in the Apache Camel K documentation.

- **Resource - Apache Camel K Integration with Resource file**
Select one or more resource files from the file selection dialog.

- **Property - Apache Camel K Integration with Property**
Specify property name/property value pairs, with the option to specify more than one. For more information about configuration with properties, see [Configure Integrations](https://camel.apache.org/camel-k/latest/configuration/configuration.html) in the Apache Camel K documentation.

Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
},
"camelk.yaml.schema": {
"type": "string",
"default": "https://raw.githubusercontent.com/apache/camel/camel-3.20.1/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json",
"default": "https://raw.githubusercontent.com/apache/camel/camel-4.0.0/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json",
"description": "Yaml Schema applied when Camel K modeline is set. (I.e. file starting with '# camel-k: ')"
},
"redhat.telemetry.enabled": {
Expand Down Expand Up @@ -288,11 +288,6 @@
"format": "<akey>=<avalue>",
"uniqueItems": true
},
"resources": {
"type": "array",
"description": "List of additional resources.",
"uniqueItems": true
},
"secret": {
"type": "string",
"description": "Secret key. The secret corresponding to the key is added to the integration as runtime configuration."
Expand Down
35 changes: 2 additions & 33 deletions src/IntegrationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ import { TelemetryEvent } from '@redhat-developer/vscode-redhat-telemetry/lib';
let selectedConfigMap : any = undefined;

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (windows-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (windows-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (windows-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (macos-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (macos-latest, max, stable)

Unexpected any. Specify a different type

Check warning on line 102 in src/IntegrationUtils.ts

View workflow job for this annotation

GitHub Actions / main (macos-latest, max, stable)

Unexpected any. Specify a different type
let selectedSecret : any = undefined;
let devMode = false;
let selectedResource : any = undefined;
let errorEncountered = false;
let selectedProperty : any = undefined;
let selectedDependency : any = undefined;
Expand Down Expand Up @@ -135,18 +134,6 @@ import { TelemetryEvent } from '@redhat-developer/vscode-redhat-telemetry/lib';
errorEncountered = true;
});
break;
case constants.resourceIntegration:
await getSelectedResources().then( (selection) => {
selectedResource = selection;
if (selectedResource === undefined) {
reject (new Error('No Resource selected.'));
errorEncountered = true;
}
}).catch ( (error) => {
reject(error);
errorEncountered = true;
});
break;
case constants.propertyIntegration:
await getSelectedProperties().then ( (selection) => {
selectedProperty = selection;
Expand Down Expand Up @@ -187,7 +174,7 @@ import { TelemetryEvent } from '@redhat-developer/vscode-redhat-telemetry/lib';

if (!errorEncountered) {
try {
const isSuccess = await createNewIntegration(context, devMode, selectedConfigMap, selectedSecret, selectedResource, selectedProperty, selectedDependency);
const isSuccess = await createNewIntegration(context, devMode, selectedConfigMap, selectedSecret, selectedProperty, selectedDependency);
sendStartIntegrationTelemetryEvent(choice, context);
resolve(isSuccess);
} catch(err) {
Expand Down Expand Up @@ -270,17 +257,6 @@ function getSelectedSecret(): Promise<string | undefined> {
});
}

function getSelectedResources(): Promise<string[]> {
return new Promise<string[]> ( async (resolve, reject) => {
const fileUris = await vscode.window.showOpenDialog(ResourceOptions);
if (fileUris === undefined || fileUris.length === 0) {
reject(new Error('No Resource file(s) specified.'));
} else {
resolve(fileUris.map(fileUri => path.normalize(fileUri.path)));
}
});
}

function getSelectedProperties(): Promise<string[]> {
return new Promise<string[]> ( async (resolve, reject) => {
let hasMoreProperties = true;
Expand Down Expand Up @@ -358,7 +334,7 @@ function getSelectedDependencies(): Promise<string[]> {
}

// use command-line "kamel" utility to start a new integration
export function createNewIntegration(integrationFileUri: vscode.Uri, devMode? : boolean, configmap? : string, secret? : string, resourceArray? : string[], propertyArray? : string[], dependencyArray? : string[]): Promise<boolean> {
export function createNewIntegration(integrationFileUri: vscode.Uri, devMode? : boolean, configmap? : string, secret? : string, propertyArray? : string[], dependencyArray? : string[]): Promise<boolean> {
return new Promise( async (resolve, reject) => {
const filename = integrationFileUri.fsPath;
const foldername = path.dirname(filename);
Expand All @@ -372,7 +348,6 @@ export function createNewIntegration(integrationFileUri: vscode.Uri, devMode? :
devMode,
configmap,
secret,
resourceArray,
dependencyArray,
propertyArray);
if (devMode && devMode === true) {
Expand Down Expand Up @@ -407,7 +382,6 @@ export function computeKamelArgs(absoluteRoot: string,
devMode: boolean | undefined,
configmap: string | undefined,
secret: string | undefined,
resourceArray: string[] | undefined,
dependencyArray: string[] | undefined,
propertyArray: string[] | undefined,
traitsArray?: string[] | undefined,
Expand All @@ -433,11 +407,6 @@ export function computeKamelArgs(absoluteRoot: string,
if (profile && profile.trim().length > 0) {
kamelArgs.push(`--profile=${profile}`);
}
if (resourceArray && resourceArray.length > 0) {
resourceArray.forEach(resource => {
kamelArgs.push(`--resource=file:${resource}`);
});
}
if (dependencyArray && dependencyArray.length > 0) {
dependencyArray.forEach(dependency => {
kamelArgs.push(`--dependency=${dependency}`);
Expand Down
2 changes: 0 additions & 2 deletions src/task/CamelKRunTaskDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface CamelKRunTaskDefinition extends vscode.TaskDefinition {
file: string;
profile?: string;
properties?: Array<string>;
resources?: Array<string>;
secret?: string;
traits?: Array<string>;
volumes?: Array<string>;
Expand Down Expand Up @@ -73,7 +72,6 @@ export class CamelKRunTaskProvider implements vscode.TaskProvider {
definition.dev,
definition.configmap,
definition.secret,
definition.resources,
definition.dependencies,
definition.properties,
definition.traits,
Expand Down
121 changes: 0 additions & 121 deletions src/test/suite/StartIntegrationWithResource.test.ts

This file was deleted.

12 changes: 8 additions & 4 deletions src/test/suite/versionUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,16 @@ suite("VersionUtils check", () => {
await validateVersion('2.0.0', Platform.LINUX, 'https://github.com/apache/camel-k/releases/download/v2.0.0/camel-k-client-2.0.0-linux-64bit.tar.gz');
});

test("validate url for existing 2.0.0 windows version", async () => {
await validateVersion('2.0.0', Platform.WINDOWS, 'https://github.com/apache/camel-k/releases/download/v2.0.0/camel-k-client-2.0.0-windows-64bit.tar.gz');
test("validate url for existing 2.1.0 version", async () => {
await validateVersion('2.1.0', Platform.LINUX, 'https://github.com/apache/camel-k/releases/download/v2.1.0/camel-k-client-2.1.0-linux-amd64.tar.gz');
});

test("validate url for existing 2.0.0 MacOS version", async () => {
await validateVersion('2.0.0', Platform.MACOS, 'https://github.com/apache/camel-k/releases/download/v2.0.0/camel-k-client-2.0.0-mac-64bit.tar.gz');
test("validate url for existing 2.1.0 windows version", async () => {
await validateVersion('2.1.0', Platform.WINDOWS, 'https://github.com/apache/camel-k/releases/download/v2.1.0/camel-k-client-2.1.0-windows-amd64.tar.gz');
});

test("validate url for existing 2.1.0 MacOS version", async () => {
await validateVersion('2.1.0', Platform.MACOS, 'https://github.com/apache/camel-k/releases/download/v2.1.0/camel-k-client-2.1.0-darwin-amd64.tar.gz');
});

test("validate invalid url for xyz1 version", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/versionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import { platform } from './installer';
import fetch from 'cross-fetch';
import { Platform } from './shell';

export const version = '2.0.0'; //need to retrieve this if possible, but have a default
export const version = '2.1.0'; //need to retrieve this if possible, but have a default

/*
* Can be retrieved using `curl -i https://api.github.com/repos/apache/camel-k/releases/latest | grep last-modified`
* To be updated when updating the default "version" attribute
*/
const LAST_MODIFIED_DATE_OF_DEFAULT_VERSION = 'Mon, 24 Jul 2023 07:56:50 GMT';
const LAST_MODIFIED_DATE_OF_DEFAULT_VERSION = 'Mon, 23 Oct 2023 08:52:28 GMT';
let latestVersionFromOnline: string;

export async function testVersionAvailable(versionToUse: string): Promise<boolean> {
Expand Down

0 comments on commit 2a6e6d0

Please sign in to comment.