diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0ea33039..f07341d1 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -66,7 +66,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/CHANGELOG.md b/CHANGELOG.md index 3a276d16..cab48325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to the "vscode-debug-adapter-apache-camel" extension will be ## 1.6.0 +- Update default Camel version used for Camel JBang from 4.8.1 to 4.8.2 + ## 1.5.0 - Use containing folder by default with commands and quick editor action when launching a specific Camel Route. It allows to have other relative parameters still working when it is inside a subfolder. 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: diff --git a/Jenkinsfile b/Jenkinsfile index 2005128a..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') { @@ -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" @@ -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 e4db3e4f..f96bc4a6 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "camel.debugAdapter.JBangVersion": { "type": "string", "markdownDescription": "Apache Camel JBang CLI version used for internal VS Code JBang commands execution. Camel JBang CLI requirements can differ between versions, it is recommended to use `default` version to ensure all extension features work properly.\n\n**Note**: This change will affect only commands provided by Debug Adapter for Apache Camel extension.", - "default": "4.8.1" + "default": "4.8.2" }, "camel.debugAdapter.CamelVersion": { "type": "string", @@ -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-openshift.json b/src/ui-test/resources/vscode-settings-openshift.json new file mode 100644 index 00000000..a7692d17 --- /dev/null +++ b/src/ui-test/resources/vscode-settings-openshift.json @@ -0,0 +1,6 @@ +{ + "camel.debugAdapter.KubernetesRunParameters": [ + "--cluster-type=openshift", + "--dev" + ] +} \ No newline at end of file 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.openshift.test.ts b/src/ui-test/tests/deploy.openshift.test.ts new file mode 100644 index 00000000..2892cd30 --- /dev/null +++ b/src/ui-test/tests/deploy.openshift.test.ts @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License", destination); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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 { + ActivityBar, + after, + before, + EditorAction, + EditorView, + SideBarView, + VSBrowser, +} from 'vscode-extension-tester'; +import { killTerminal, waitUntilTerminalHasText } from '../utils'; + +/** + * Note: OC login needs to be done before executing this test + */ +describe('Camel standalone file deployment using Camel JBang Kubernetes Run', function () { + this.timeout(600_000); // 10 minutes + + let editorView: EditorView; + const RESOURCES_PATH: string = resolve('src', 'ui-test', 'resources'); + + before(async function () { + 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); + + editorView = new EditorView(); + await editorView.getDriver().wait(async function () { + return (await editorView.getOpenEditorTitles()).find(title => title === CAMEL_ROUTE_YAML_WITH_SPACE); + }, 10_000, `The test file ${CAMEL_ROUTE_YAML_WITH_SPACE} was not opened`); + }); + + after(async function () { + await killTerminal(); + await editorView.closeAllEditors(); + }); + + it('Deploy integration to OpenShift cluster', async function () { + const action = (await editorView.getAction('Deploy Integration with Apache Camel Kubernetes Run')) as EditorAction; + await action.click(); + + await waitUntilTerminalHasText(action.getDriver(), ['BUILD SUCCESS'], 5_000, 600_000); + await waitUntilTerminalHasText(action.getDriver(), ['Hello Camel from'], 3_000, 30_000); + }); + +}); diff --git a/src/ui-test/uitest_runner.ts b/src/ui-test/uitest_runner.ts index d84f96d8..e7350ca7 100644 --- a/src/ui-test/uitest_runner.ts +++ b/src/ui-test/uitest_runner.ts @@ -26,15 +26,32 @@ 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] === 'minikube' ? 'minikube' : process.argv[2] === 'openshift' ? 'openshift' : undefined; 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.openshift*.test.js'; + settings += 'vscode-settings-openshift.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 +61,7 @@ async function main(): Promise { }, { 'cleanup': true, - 'settings': './src/ui-test/resources/vscode-settings.json', + 'settings': settings, resources: [] } );