From ae2fa5cdefb7bace4bffe5410f9f6230d4b17f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Tue, 8 Aug 2023 16:33:56 +0200 Subject: [PATCH 1/2] FUSETOOLS2-2163 - upgrade default runtime to Camel K 2.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Pupier --- .github/workflows/insider.yml | 2 +- .github/workflows/main.yml | 2 +- CHANGELOG.md | 1 + src/test/suite/versionUtils.test.ts | 12 ++++++++---- src/versionUtils.ts | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/insider.yml b/.github/workflows/insider.yml index efd41f44a..ab4b39ec0 100644 --- a/.github/workflows/insider.yml +++ b/.github/workflows/insider.yml @@ -67,7 +67,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/v1.12.1/camel-k-client-1.12.1-linux-64bit.tar.gz + 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 tar -zxvf kamel.tar.gz chmod +x kamel sudo mv kamel /usr/local/bin/ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db7f0e816..27cb79d82 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,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/v1.12.1/camel-k-client-1.12.1-linux-64bit.tar.gz + 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 tar -zxvf kamel.tar.gz chmod +x kamel sudo mv kamel /usr/local/bin/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee0630f1..e8d8c78db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to the "vscode-camelk" extension will be documented in this ## 0.0.36 - 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. +- Update default runtime version to v2.0.0 ## 0.0.35 diff --git a/src/test/suite/versionUtils.test.ts b/src/test/suite/versionUtils.test.ts index f7b32ed71..6f6b4c4fb 100644 --- a/src/test/suite/versionUtils.test.ts +++ b/src/test/suite/versionUtils.test.ts @@ -94,12 +94,16 @@ suite("VersionUtils check", () => { await validateVersion('1.12.1', Platform.LINUX, 'https://github.com/apache/camel-k/releases/download/v1.12.1/camel-k-client-1.12.1-linux-64bit.tar.gz'); }); - test("validate url for existing 1.12.1 windows version", async () => { - await validateVersion('1.12.1', Platform.WINDOWS, 'https://github.com/apache/camel-k/releases/download/v1.12.1/camel-k-client-1.12.1-windows-64bit.tar.gz'); + test("validate url for existing 2.0.0 version", async () => { + 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 1.12.1 MacOS version", async () => { - await validateVersion('1.12.1', Platform.MACOS, 'https://github.com/apache/camel-k/releases/download/v1.12.1/camel-k-client-1.12.1-mac-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.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 invalid url for xyz1 version", async () => { diff --git a/src/versionUtils.ts b/src/versionUtils.ts index 1e4858db3..928cac4cc 100644 --- a/src/versionUtils.ts +++ b/src/versionUtils.ts @@ -25,13 +25,13 @@ import { platform } from './installer'; import fetch from 'cross-fetch'; import { Platform } from './shell'; -export const version = '1.12.1'; //need to retrieve this if possible, but have a default +export const version = '2.0.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, 12 Jun 2023 08:34:33 GMT'; +const LAST_MODIFIED_DATE_OF_DEFAULT_VERSION = 'Mon, 24 Jul 2023 07:56:50 GMT'; let latestVersionFromOnline: string; export async function testVersionAvailable(versionToUse: string): Promise { From f2eb8d93acba042a92da595ba64a5f7eab2b81a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Tue, 8 Aug 2023 16:54:42 +0200 Subject: [PATCH 2/2] FUSETOOLS2-2163 - adapt to new format of kamel binary name scheme in 2.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Pupier --- .github/workflows/insider.yml | 2 +- .github/workflows/main.yml | 2 +- src/test/suite/versionUtils.test.ts | 6 +++--- src/versionUtils.ts | 22 +++++++++++++++++++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/insider.yml b/.github/workflows/insider.yml index ab4b39ec0..8ea894948 100644 --- a/.github/workflows/insider.yml +++ b/.github/workflows/insider.yml @@ -67,7 +67,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.0.0/camel-k-client-2.0.0-linux-amd64.tar.gz tar -zxvf kamel.tar.gz chmod +x kamel sudo mv kamel /usr/local/bin/ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27cb79d82..7bf701543 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,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.0.0/camel-k-client-2.0.0-linux-amd64.tar.gz tar -zxvf kamel.tar.gz chmod +x kamel sudo mv kamel /usr/local/bin/ diff --git a/src/test/suite/versionUtils.test.ts b/src/test/suite/versionUtils.test.ts index 6f6b4c4fb..ebaf4dade 100644 --- a/src/test/suite/versionUtils.test.ts +++ b/src/test/suite/versionUtils.test.ts @@ -95,15 +95,15 @@ suite("VersionUtils check", () => { }); test("validate url for existing 2.0.0 version", async () => { - 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'); + 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-amd64.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'); + 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-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'); + await validateVersion('2.0.0', Platform.MACOS, 'https://github.com/apache/camel-k/releases/download/v2.0.0/camel-k-client-2.0.0-darwin-amd64.tar.gz'); }); test("validate invalid url for xyz1 version", async () => { diff --git a/src/versionUtils.ts b/src/versionUtils.ts index 928cac4cc..0a86e3655 100644 --- a/src/versionUtils.ts +++ b/src/versionUtils.ts @@ -203,7 +203,7 @@ function setVersionAndTellUser(msg: string, newVersion: string) { extension.setRuntimeVersionSetting(newVersion); } -function toKamelOsString(platform: Platform | undefined): string | undefined { +function toKamel1xOsString(platform: Platform | undefined): string | undefined { switch (platform) { case Platform.WINDOWS: return 'windows'; @@ -215,8 +215,21 @@ function toKamelOsString(platform: Platform | undefined): string | undefined { return undefined; } +function toKamel2xOsString(platform: Platform | undefined): string | undefined { + switch (platform) { + case Platform.WINDOWS: + return 'windows'; + case Platform.LINUX: + return 'linux'; + case Platform.MACOS: + return 'darwin'; + } + return undefined; +} + export async function getDownloadURLForCamelKTag(camelKVersion: string, platform: Platform): Promise { - const platformStr = toKamelOsString(platform); + const platformStr1x = toKamel1xOsString(platform); + const platformStr2x = toKamel2xOsString(platform); const tagName: string = isOldTagNaming(camelKVersion) ? camelKVersion : `v${camelKVersion}`; const tagURL = `https://api.github.com/repos/apache/camel-k/releases/tags/${tagName}`; const headers: [string, string][] = []; @@ -230,7 +243,10 @@ export async function getDownloadURLForCamelKTag(camelKVersion: string, platform const assetsJSON: any = await latestJSON.assets; for (const asset of assetsJSON) { const aUrl: string = asset.browser_download_url; - if (aUrl.includes(`-${platformStr}-`)) { + if (aUrl.includes('camel-k-client-1') && aUrl.includes(`-${platformStr1x}-`)) { + return aUrl; + } + if (aUrl.includes('camel-k-client-2') && aUrl.includes('amd64') && aUrl.includes(`-${platformStr2x}-`)) { return aUrl; } }