diff --git a/.cirrus.yml b/.cirrus.yml index 1352be767..e838d93fc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,6 +14,7 @@ env: ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa NPM_CONFIG_registry: https://repox.jfrog.io/artifactory/api/npm/npm NPM_CONFIG_//repox.jfrog.io/artifactory/api/npm/:_authToken: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token] + SENTRY_UPLOAD_TOKEN: VAULT[development/kv/data/sentry/sq-ide-upload data.token] ARTIFACTORY_PRIVATE_READER_USERNAME: $ARTIFACTORY_PRIVATE_USERNAME ARTIFACTORY_PRIVATE_READER_PASSWORD: $ARTIFACTORY_PRIVATE_PASSWORD diff --git a/build-sonarlint/deployUtils.mjs b/build-sonarlint/deployUtils.mjs index ad561aeff..c160c64d6 100644 --- a/build-sonarlint/deployUtils.mjs +++ b/build-sonarlint/deployUtils.mjs @@ -10,7 +10,7 @@ import { getPackageJSON } from './fsUtils.mjs'; import { join, extname, basename } from 'path'; import dateformat from 'dateformat'; import { computeDependencyHashes, fileHashsum } from './hashes.mjs'; -import jarDependencies from '../scripts/dependencies.json' assert { type: "json" } ; +import jarDependencies from '../scripts/dependencies.json' with { type: "json" } ; import { createReadStream } from 'fs'; import fetch, { Headers } from 'node-fetch'; import { globbySync } from 'globby'; diff --git a/webpack.config.js b/webpack.config.js index 267f057e9..32e4a1fd5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,18 +10,6 @@ const path = require('path'); -const plugins = []; -// Must be injected by CI environment -if (process.env.SENTRY_UPLOAD_TOKEN) { - /**@type {import('webpack').WebpackPluginFunction}*/ - const { sentryWebpackPlugin } = require('@sentry/webpack-plugin'); - plugins.push(sentryWebpackPlugin({ - org: 'sonar-x0', - project: 'sonarqube-vscode', - authToken: process.env.SENTRY_UPLOAD_TOKEN - })); -} - /**@type {import('webpack').Configuration}*/ const config = { // vscode extensions run in a Node.js-context -> https://webpack.js.org/configuration/node/ @@ -59,6 +47,30 @@ const config = { } ] }, - plugins + plugins: [] }; -module.exports = config; + +module.exports = (env, argv) => { + + if ( + // Injected by Vault + env.SENTRY_UPLOAD_TOKEN && + // Injected by CI + env.BUILD_NUMBER + ) { + /**@type {import('webpack').WebpackPluginFunction}*/ + const { sentryWebpackPlugin } = require('@sentry/webpack-plugin'); + const { version } = require('./package.json'); + + config.plugins.push(sentryWebpackPlugin({ + org: 'sonar-x0', + project: 'sonarqube-vscode', + authToken: process.env.SENTRY_UPLOAD_TOKEN, + release: { + name: version + } + })); + } + + return config; +}