Skip to content

Commit a5bd49a

Browse files
committed
SLVSCODE-951 Use token from Vault to upload source maps in CI builds
1 parent 68041d9 commit a5bd49a

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

.cirrus.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414
ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa
1515
NPM_CONFIG_registry: https://repox.jfrog.io/artifactory/api/npm/npm
1616
NPM_CONFIG_//repox.jfrog.io/artifactory/api/npm/:_authToken: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
17+
SENTRY_UPLOAD_TOKEN: VAULT[development/kv/data/sentry/sq-ide-upload data.token]
1718

1819
ARTIFACTORY_PRIVATE_READER_USERNAME: $ARTIFACTORY_PRIVATE_USERNAME
1920
ARTIFACTORY_PRIVATE_READER_PASSWORD: $ARTIFACTORY_PRIVATE_PASSWORD

build-sonarlint/deployUtils.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getPackageJSON } from './fsUtils.mjs';
1010
import { join, extname, basename } from 'path';
1111
import dateformat from 'dateformat';
1212
import { computeDependencyHashes, fileHashsum } from './hashes.mjs';
13-
import jarDependencies from '../scripts/dependencies.json' assert { type: "json" } ;
13+
import jarDependencies from '../scripts/dependencies.json' with { type: "json" } ;
1414
import { createReadStream } from 'fs';
1515
import fetch, { Headers } from 'node-fetch';
1616
import { globbySync } from 'globby';

webpack.config.js

+26-14
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@
1010

1111
const path = require('path');
1212

13-
const plugins = [];
14-
// Must be injected by CI environment
15-
if (process.env.SENTRY_UPLOAD_TOKEN) {
16-
/**@type {import('webpack').WebpackPluginFunction}*/
17-
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');
18-
plugins.push(sentryWebpackPlugin({
19-
org: 'sonar-x0',
20-
project: 'sonarqube-vscode',
21-
authToken: process.env.SENTRY_UPLOAD_TOKEN
22-
}));
23-
}
24-
2513
/**@type {import('webpack').Configuration}*/
2614
const config = {
2715
// vscode extensions run in a Node.js-context -> https://webpack.js.org/configuration/node/
@@ -59,6 +47,30 @@ const config = {
5947
}
6048
]
6149
},
62-
plugins
50+
plugins: []
6351
};
64-
module.exports = config;
52+
53+
module.exports = (env, argv) => {
54+
55+
if (
56+
// Injected by Vault
57+
env.SENTRY_UPLOAD_TOKEN &&
58+
// Injected by CI
59+
env.BUILD_NUMBER
60+
) {
61+
/**@type {import('webpack').WebpackPluginFunction}*/
62+
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');
63+
const { version } = require('./package.json');
64+
65+
config.plugins.push(sentryWebpackPlugin({
66+
org: 'sonar-x0',
67+
project: 'sonarqube-vscode',
68+
authToken: process.env.SENTRY_UPLOAD_TOKEN,
69+
release: {
70+
name: version
71+
}
72+
}));
73+
}
74+
75+
return config;
76+
}

0 commit comments

Comments
 (0)