Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Moreno <joao.moreno@microsoft.com>2021-11-20 20:01:39 +0300
committerGitHub <noreply@github.com>2021-11-20 20:01:39 +0300
commit6f2ad1994cb7bf8b4288fc52e2d6ea72aecd9b39 (patch)
tree1d5a88c42a8d6c3579b85cd4e628e74e89352c73 /build/azure-pipelines/upload-cdn.ts
parent1d8839096bf7341f7d0ac6568177445cb6236c0f (diff)
More RBAC usage (#137579)
* ci: :construction_worker: remove secret references * inline web storage account * remove unused reference * inline storage accounts * formatting * formatting * drop ticino-storage-key, web-storage-key * remove leftovers * fix build * fix build * catch errors on all upload* scripts * bump gulp-azure-storage
Diffstat (limited to 'build/azure-pipelines/upload-cdn.ts')
-rw-r--r--build/azure-pipelines/upload-cdn.ts47
1 files changed, 28 insertions, 19 deletions
diff --git a/build/azure-pipelines/upload-cdn.ts b/build/azure-pipelines/upload-cdn.ts
index 71589033867..c35582017d7 100644
--- a/build/azure-pipelines/upload-cdn.ts
+++ b/build/azure-pipelines/upload-cdn.ts
@@ -12,29 +12,38 @@ import * as vfs from 'vinyl-fs';
import * as util from '../lib/util';
import * as filter from 'gulp-filter';
import * as gzip from 'gulp-gzip';
+import { ClientSecretCredential } from '@azure/identity';
const azure = require('gulp-azure-storage');
const root = path.dirname(path.dirname(__dirname));
const commit = util.getVersion(root);
+const credential = new ClientSecretCredential(process.env['AZURE_TENANT_ID']!, process.env['AZURE_CLIENT_ID']!, process.env['AZURE_CLIENT_SECRET']!);
-function main() {
- return vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true })
- .pipe(filter(f => !f.isDirectory()))
- .pipe(gzip({ append: false }))
- .pipe(es.through(function (data: Vinyl) {
- console.log('Uploading CDN file:', data.relative); // debug
- this.emit('data', data);
- }))
- .pipe(azure.upload({
- account: process.env.AZURE_STORAGE_ACCOUNT,
- key: process.env.AZURE_STORAGE_ACCESS_KEY,
- container: process.env.VSCODE_QUALITY,
- prefix: commit + '/',
- contentSettings: {
- contentEncoding: 'gzip',
- cacheControl: 'max-age=31536000, public'
- }
- }));
+function main(): Promise<void> {
+ return new Promise((c, e) => {
+ vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true })
+ .pipe(filter(f => !f.isDirectory()))
+ .pipe(gzip({ append: false }))
+ .pipe(es.through(function (data: Vinyl) {
+ console.log('Uploading CDN file:', data.relative); // debug
+ this.emit('data', data);
+ }))
+ .pipe(azure.upload({
+ account: process.env.AZURE_STORAGE_ACCOUNT,
+ credential,
+ container: process.env.VSCODE_QUALITY,
+ prefix: commit + '/',
+ contentSettings: {
+ contentEncoding: 'gzip',
+ cacheControl: 'max-age=31536000, public'
+ }
+ }))
+ .on('end', () => c())
+ .on('error', (err: any) => e(err));
+ });
}
-main();
+main().catch(err => {
+ console.error(err);
+ process.exit(1);
+});