From 62121a521e81d5e34f7997f11d0beee0174e978c Mon Sep 17 00:00:00 2001 From: Dominik Jelinek Date: Tue, 14 Jan 2025 13:52:37 +0100 Subject: [PATCH 1/3] docs: fix url to a new Jenkins DNO instance --- Contributing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contributing.md b/Contributing.md index 229371f8..979aa274 100644 --- a/Contributing.md +++ b/Contributing.md @@ -25,8 +25,8 @@ When testing new version of the Camel Debug Adapter Server, just replace the jar * Create the Pull Request * Wait for Pull Request to be merged * Check that someone listed as _submitter_ in the [Jenkinsfile](Jenkinsfile) is available -* Check build is working fine on [GitHub Actions](https://github.com/camel-tooling/camel-dap-client-vscode/actions) and [Jenkins CI](https://master-jenkins-csb-fusetools-qe.apps.ocp-c1.prod.psi.redhat.com/view/VS%20Code%20-%20release/job/vscode/job/eng/job/vscode-camel-dap-release/) -* Start build on [Jenkins CI](https://master-jenkins-csb-fusetools-qe.apps.ocp-c1.prod.psi.redhat.com/view/VS%20Code%20-%20release/job/vscode/job/eng/job/vscode-camel-dap-release/) with _publishToMarketPlace_ and _publishToOVSX_ parameters checked +* Check build is working fine on [GitHub Actions](https://github.com/camel-tooling/camel-dap-client-vscode/actions) and [Jenkins CI](https://jenkins-csb-fusetools-qe-master.dno.corp.redhat.com/view/VS%20Code%20-%20release/job/vscode/job/eng/job/vscode-camel-dap-release/) +* Start build on [Jenkins CI](https://jenkins-csb-fusetools-qe-master.dno.corp.redhat.com/view/VS%20Code%20-%20release/job/vscode/job/eng/job/vscode-camel-dap-release/) with _publishToMarketPlace_ and _publishToOVSX_ parameters checked * Wait the build is waiting on step _Publish to Marketplace_ * Check manually the `vsix` file pushed on [snapshots area](https://download.jboss.org/jbosstools/vscode/snapshots/vscode-debug-adapter-apache-camel/) * For someone from _submitter_ list: From 8901b9c8d415515531bceadc33d60c3fe6eb51a0 Mon Sep 17 00:00:00 2001 From: Dominik Jelinek Date: Tue, 14 Jan 2025 21:49:27 +0100 Subject: [PATCH 2/3] ci(jenkinsfile): bump from jdk11 to jdk17 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2005128a..7587d48f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ node('rhel9'){ } stage('Build') { - env.JAVA_HOME="${tool 'openjdk-11'}" + env.JAVA_HOME="${tool 'openjdk-17'}" env.PATH="${env.JAVA_HOME}/bin:${env.PATH}" sh "java -version" From aee4c4dd278a085e9345fd0944b4a11840a70f42 Mon Sep 17 00:00:00 2001 From: Dominik Jelinek Date: Tue, 14 Jan 2025 13:52:11 +0100 Subject: [PATCH 3/3] test: add downstream UI test for deployment into OpenShift cluster which is an extension default setting for deployment feature --- .github/workflows/deploy.yaml | 2 +- Jenkinsfile | 28 ++++++++++---- package.json | 3 +- .../resources/vscode-settings-minikube.json | 6 +++ src/ui-test/resources/vscode-settings.json | 6 +-- .../tests/deploy.kubernetes.run.test.ts | 37 +++++++++++++------ src/ui-test/uitest_runner.ts | 32 ++++++++++++---- 7 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 src/ui-test/resources/vscode-settings-minikube.json diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 8218d6ba..a732dac3 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -69,7 +69,7 @@ jobs: - name: UI Tests run: | eval $(minikube -p minikube docker-env) - xvfb-run --auto-servernum npm run ui-test:deploy + xvfb-run --auto-servernum npm run ui-test:deploy:minikube - name: Upload Coverage Results uses: actions/upload-artifact@v4 diff --git a/Jenkinsfile b/Jenkinsfile index 7587d48f..3576e7df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,8 +3,8 @@ node('rhel9'){ stage('Checkout repo') { deleteDir() - git url: 'https://github.com/camel-tooling/camel-dap-client-vscode.git', - branch: 'main' + git url: "https://github.com/${FORK}/camel-dap-client-vscode.git", + branch: "${BRANCH}" } stage('Install requirements') { @@ -27,13 +27,25 @@ node('rhel9'){ withEnv(['JUNIT_REPORT_PATH=report.xml']) { stage('Test') { - wrap([$class: 'Xvnc']) { - sh "npm test --silent" - junit 'report.xml' - } + wrap([$class: 'Xvnc']) { + sh "npm test --silent" + junit 'report.xml' + } } } + withEnv(['TEST_RESOURCES=test-resources','CODE_VERSION=max']) { + stage('UI Test: OpenShift deployment') { + wrap([$class: 'Xvnc']) { + withCredentials([[$class: 'StringBinding', credentialsId: 'oc_developer_token', variable: 'TOKEN']]) { + sh 'oc login --token=${TOKEN} --server=https://api.ft-417-a.fuse.integration-qe.com:6443 --insecure-skip-tls-verify=true' + sh 'oc project camel-dap-uitest' + } + sh 'npm run ui-test:deploy:openshift' + } + } + } + stage('Package') { def packageJson = readJSON file: 'package.json' sh "vsce package -o vscode-debug-adapter-apache-camel-${packageJson.version}-${env.BUILD_NUMBER}.vsix --no-yarn" @@ -92,8 +104,8 @@ node('rhel9'){ sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-debug-adapter-apache-camel/ <<< \$'put -p -r ${tgz[0].path}'" sh "npm install -g ovsx" - withCredentials([[$class: 'StringBinding', credentialsId: 'open-vsx-access-token', variable: 'OVSX_TOKEN']]) { - sh 'ovsx publish -p ${OVSX_TOKEN}' + " ${vsix[0].path}" + withCredentials([[$class: 'StringBinding', credentialsId: 'open-vsx-access-token', variable: 'OVSX_TOKEN']]) { + sh 'ovsx publish -p ${OVSX_TOKEN}' + " ${vsix[0].path}" } } } diff --git a/package.json b/package.json index bc931e8f..e49141ea 100644 --- a/package.json +++ b/package.json @@ -331,7 +331,8 @@ "lint": "eslint src", "test": "node ./out/test/runTest.js", "ui-test": "node ./out/ui-test/uitest_runner.js", - "ui-test:deploy": "npm run ui-test -- deploy", + "ui-test:deploy:minikube": "npm run ui-test -- minikube", + "ui-test:deploy:openshift": "npm run ui-test -- openshift", "ui-test:coverage": "npm run ui-test -- coverage" }, "devDependencies": { diff --git a/src/ui-test/resources/vscode-settings-minikube.json b/src/ui-test/resources/vscode-settings-minikube.json new file mode 100644 index 00000000..9fd2ab95 --- /dev/null +++ b/src/ui-test/resources/vscode-settings-minikube.json @@ -0,0 +1,6 @@ +{ + "camel.debugAdapter.KubernetesRunParameters": [ + "--cluster-type=minikube", + "--build-property=quarkus.kubernetes.image-pull-policy=Never" + ] +} diff --git a/src/ui-test/resources/vscode-settings.json b/src/ui-test/resources/vscode-settings.json index 2c5e1b00..dbd670d9 100644 --- a/src/ui-test/resources/vscode-settings.json +++ b/src/ui-test/resources/vscode-settings.json @@ -14,9 +14,5 @@ "window.title": "${dirty}${activeEditorLong}${separator}${rootPath}${separator}${appName}", "redhat.telemetry.enabled": false, "terminal.integrated.sendKeybindingsToShell": true, - "git.autoRepositoryDetection": false, - "camel.debugAdapter.KubernetesRunParameters": [ - "--cluster-type=minikube", - "--build-property=quarkus.kubernetes.image-pull-policy=Never" - ] + "git.autoRepositoryDetection": false } diff --git a/src/ui-test/tests/deploy.kubernetes.run.test.ts b/src/ui-test/tests/deploy.kubernetes.run.test.ts index 6cbab899..8000f8ab 100644 --- a/src/ui-test/tests/deploy.kubernetes.run.test.ts +++ b/src/ui-test/tests/deploy.kubernetes.run.test.ts @@ -14,35 +14,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { resolve } from 'node:path'; -import { CAMEL_ROUTE_YAML_WITH_SPACE } from '../variables'; +import { resolve, join } from 'node:path'; import { - ActivityBar, after, + ArraySetting, before, BottomBarPanel, EditorAction, EditorView, - SideBarView, VSBrowser, Workbench, } from 'vscode-extension-tester'; import { killTerminal, waitUntilTerminalHasText } from '../utils'; import { execSync } from 'child_process'; +import { CAMEL_ROUTE_YAML_WITH_SPACE } from '../variables'; +/** + * Note: OC login needs to be done before executing this test for deployment into OpenShift + */ describe('Camel standalone file deployment using Camel JBang Kubernetes Run', function () { - this.timeout(180_000); + this.timeout(600_000); // 10 minutes let editorView: EditorView; let jbangVersion: string; + let kubernetesRunParameters: string[]; const RESOURCES_PATH: string = resolve('src', 'ui-test', 'resources'); before(async function () { jbangVersion = await getJBangVersion(); + kubernetesRunParameters = await getKubernetesRunParameters(); await VSBrowser.instance.openResources(RESOURCES_PATH); - await (await new ActivityBar().getViewControl('Explorer'))?.openView(); - const section = await new SideBarView().getContent().getSection('resources'); - await section.openItem(CAMEL_ROUTE_YAML_WITH_SPACE); + await VSBrowser.instance.openResources(join(RESOURCES_PATH, CAMEL_ROUTE_YAML_WITH_SPACE)); editorView = new EditorView(); await editorView.getDriver().wait(async function () { @@ -54,16 +56,22 @@ describe('Camel standalone file deployment using Camel JBang Kubernetes Run', fu await killTerminal(); await editorView.closeAllEditors(); // remove deployed integration from a local cluster - execSync(`jbang -Dcamel.jbang.version=${jbangVersion} camel@apache/camel kubernetes delete --name=demoroute`, { stdio: 'inherit', cwd: RESOURCES_PATH }); + if (kubernetesRunParameters[0].includes('openshift')) { + // workaround: because of issues with 'camel kubernetes delete --name=' in versions 4.8.1+ and OpenShift we need to cleanup using 'oc' + execSync(`oc delete deployment demoroute`, { stdio: 'inherit' }); + } else { + // minikube + execSync(`jbang -Dcamel.jbang.version=${jbangVersion} camel@apache/camel kubernetes delete --name=demoroute`, { stdio: 'inherit', cwd: RESOURCES_PATH }); + } }); - it('Deploy integration to Kubernetes (Minikube)', async function () { + it('Deploy integration to OpenShift or Kubernetes (Minikube)', async function () { const action = (await editorView.getAction('Deploy Integration with Apache Camel Kubernetes Run')) as EditorAction; await action.click(); // using some additional steps for CAMEL 4.9.0-SNAPSHOT / 4.8.1 version // because the '--dev' parameter is not working for a deployment to Kubernetes - await waitUntilTerminalHasText(action.getDriver(), ['BUILD SUCCESS'], 3_000, 120_000); + await waitUntilTerminalHasText(action.getDriver(), ['BUILD SUCCESS'], 3_000, 600_000); // OpenShift requires higher timeout because it is pulling more dependencies await killTerminal(); const terminalView = await new BottomBarPanel().openTerminalView(); @@ -84,4 +92,11 @@ describe('Camel standalone file deployment using Camel JBang Kubernetes Run', fu return value; } + async function getKubernetesRunParameters(): Promise { + const setting = await (await new Workbench().openSettings()).findSetting('Kubernetes Run Parameters', 'Camel', 'Debug Adapter') as ArraySetting; + const values = await setting.getValues(); + await new EditorView().closeEditor('Settings'); + return values; + } + }); diff --git a/src/ui-test/uitest_runner.ts b/src/ui-test/uitest_runner.ts index d84f96d8..24033012 100644 --- a/src/ui-test/uitest_runner.ts +++ b/src/ui-test/uitest_runner.ts @@ -26,15 +26,33 @@ const releaseType: ReleaseQuality = process.env.CODE_TYPE === 'insider' ? Releas export const projectPath = path.resolve(__dirname, '..', '..'); const extensionFolder = variables.EXTENSION_DIR; const coverage = process.argv[2] === 'coverage'; -const deploy = process.argv[2] === 'deploy'; +const deploy = process.argv[2]; async function main(): Promise { const tester = new ExTester(storageFolder, releaseType, extensionFolder, coverage); - const tests = deploy ? 'out/ui-test/tests/deploy*.test.js' : [ - 'out/ui-test/env/set.camel.version.js', - 'out/ui-test/tests/!(deploy)*.test.js', // run everything, except deployment tests - 'out/ui-test/env/check.camel.version.js' - ]; + + let tests: string | string[] = ''; + let settings: string = './src/ui-test/resources/'; + + switch (deploy) { + case 'minikube': + tests = 'out/ui-test/tests/deploy.kubernetes*.test.js'; + settings += 'vscode-settings-minikube.json'; + break; + case 'openshift': + tests = 'out/ui-test/tests/deploy.kubernetes*.test.js'; + // openshift deployment is tested with default settings deploy parameters + settings += 'vscode-settings.json'; + break; + default: + tests = [ + 'out/ui-test/env/set.camel.version.js', + 'out/ui-test/tests/!(deploy)*.test.js', // run everything, except deployment tests + 'out/ui-test/env/check.camel.version.js' + ]; + settings += 'vscode-settings.json'; + break; + } await tester.setupAndRunTests( tests, @@ -44,7 +62,7 @@ async function main(): Promise { }, { 'cleanup': true, - 'settings': './src/ui-test/resources/vscode-settings.json', + 'settings': settings, resources: [] } );