From f0ac3ce6faf8d55ae750fe81edd79da313da43c5 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 7 Jul 2021 09:35:15 -0700 Subject: [PATCH] Remove webview publish build stage We now pull in the webview html/js from our a different cdn instead of from this endpoint. We will keep the endpoint around for older VS Code builds but no longer publish content to it --- .../azure-pipelines/common/publish-webview.js | 71 --------------- .../azure-pipelines/common/publish-webview.sh | 9 -- .../azure-pipelines/common/publish-webview.ts | 87 ------------------- build/azure-pipelines/product-build.yml | 2 - build/azure-pipelines/product-compile.yml | 9 +- 5 files changed, 1 insertion(+), 177 deletions(-) delete mode 100644 build/azure-pipelines/common/publish-webview.js delete mode 100755 build/azure-pipelines/common/publish-webview.sh delete mode 100644 build/azure-pipelines/common/publish-webview.ts diff --git a/build/azure-pipelines/common/publish-webview.js b/build/azure-pipelines/common/publish-webview.js deleted file mode 100644 index 27804624126..00000000000 --- a/build/azure-pipelines/common/publish-webview.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const azure = require("azure-storage"); -const mime = require("mime"); -const minimist = require("minimist"); -const path_1 = require("path"); -const fileNames = [ - 'fake.html', - 'host.js', - 'index.html', - 'main.js', - 'service-worker.js' -]; -async function assertContainer(blobService, container) { - await new Promise((c, e) => blobService.createContainerIfNotExists(container, { publicAccessLevel: 'blob' }, err => err ? e(err) : c())); -} -async function doesBlobExist(blobService, container, blobName) { - const existsResult = await new Promise((c, e) => blobService.doesBlobExist(container, blobName, (err, r) => err ? e(err) : c(r))); - return existsResult.exists; -} -async function uploadBlob(blobService, container, blobName, file) { - const blobOptions = { - contentSettings: { - contentType: mime.lookup(file), - cacheControl: 'max-age=31536000, public' - } - }; - await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(container, blobName, file, blobOptions, err => err ? e(err) : c())); -} -async function publish(commit, files) { - console.log('Publishing...'); - console.log('Commit:', commit); - const storageAccount = process.env['AZURE_WEBVIEW_STORAGE_ACCOUNT']; - const blobService = azure.createBlobService(storageAccount, process.env['AZURE_WEBVIEW_STORAGE_ACCESS_KEY']) - .withFilter(new azure.ExponentialRetryPolicyFilter(20)); - await assertContainer(blobService, commit); - for (const file of files) { - const blobName = path_1.basename(file); - const blobExists = await doesBlobExist(blobService, commit, blobName); - if (blobExists) { - console.log(`Blob ${commit}, ${blobName} already exists, not publishing again.`); - continue; - } - console.log('Uploading blob to Azure storage...'); - await uploadBlob(blobService, commit, blobName, file); - } - console.log('Blobs successfully uploaded.'); -} -function main() { - const commit = process.env['BUILD_SOURCEVERSION']; - if (!commit) { - console.warn('Skipping publish due to missing BUILD_SOURCEVERSION'); - return; - } - const opts = minimist(process.argv.slice(2)); - const [directory] = opts._; - const files = fileNames.map(fileName => path_1.join(directory, fileName)); - publish(commit, files).catch(err => { - console.error(err); - process.exit(1); - }); -} -if (process.argv.length < 3) { - console.error('Usage: node publish.js '); - process.exit(-1); -} -main(); diff --git a/build/azure-pipelines/common/publish-webview.sh b/build/azure-pipelines/common/publish-webview.sh deleted file mode 100755 index 77e222258fe..00000000000 --- a/build/azure-pipelines/common/publish-webview.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -e -REPO="$(pwd)" - -# Publish webview contents -PACKAGEJSON="$REPO/package.json" -VERSION=$(node -p "require(\"$PACKAGEJSON\").version") - -node build/azure-pipelines/common/publish-webview.js "$REPO/src/vs/workbench/contrib/webview/browser/pre/" diff --git a/build/azure-pipelines/common/publish-webview.ts b/build/azure-pipelines/common/publish-webview.ts deleted file mode 100644 index b1947ebc024..00000000000 --- a/build/azure-pipelines/common/publish-webview.ts +++ /dev/null @@ -1,87 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as azure from 'azure-storage'; -import * as mime from 'mime'; -import * as minimist from 'minimist'; -import { basename, join } from 'path'; - -const fileNames = [ - 'fake.html', - 'host.js', - 'index.html', - 'main.js', - 'service-worker.js' -]; - -async function assertContainer(blobService: azure.BlobService, container: string): Promise { - await new Promise((c, e) => blobService.createContainerIfNotExists(container, { publicAccessLevel: 'blob' }, err => err ? e(err) : c())); -} - -async function doesBlobExist(blobService: azure.BlobService, container: string, blobName: string): Promise { - const existsResult = await new Promise((c, e) => blobService.doesBlobExist(container, blobName, (err, r) => err ? e(err) : c(r))); - return existsResult.exists; -} - -async function uploadBlob(blobService: azure.BlobService, container: string, blobName: string, file: string): Promise { - const blobOptions: azure.BlobService.CreateBlockBlobRequestOptions = { - contentSettings: { - contentType: mime.lookup(file), - cacheControl: 'max-age=31536000, public' - } - }; - - await new Promise((c, e) => blobService.createBlockBlobFromLocalFile(container, blobName, file, blobOptions, err => err ? e(err) : c())); -} - -async function publish(commit: string, files: readonly string[]): Promise { - - console.log('Publishing...'); - console.log('Commit:', commit); - const storageAccount = process.env['AZURE_WEBVIEW_STORAGE_ACCOUNT']!; - - const blobService = azure.createBlobService(storageAccount, process.env['AZURE_WEBVIEW_STORAGE_ACCESS_KEY']!) - .withFilter(new azure.ExponentialRetryPolicyFilter(20)); - - await assertContainer(blobService, commit); - - for (const file of files) { - const blobName = basename(file); - const blobExists = await doesBlobExist(blobService, commit, blobName); - if (blobExists) { - console.log(`Blob ${commit}, ${blobName} already exists, not publishing again.`); - continue; - } - console.log('Uploading blob to Azure storage...'); - await uploadBlob(blobService, commit, blobName, file); - } - - console.log('Blobs successfully uploaded.'); -} - -function main(): void { - const commit = process.env['BUILD_SOURCEVERSION']; - - if (!commit) { - console.warn('Skipping publish due to missing BUILD_SOURCEVERSION'); - return; - } - - const opts = minimist(process.argv.slice(2)); - const [directory] = opts._; - - const files = fileNames.map(fileName => join(directory, fileName)); - - publish(commit, files).catch(err => { - console.error(err); - process.exit(1); - }); -} - -if (process.argv.length < 3) { - console.error('Usage: node publish.js '); - process.exit(-1); -} -main(); diff --git a/build/azure-pipelines/product-build.yml b/build/azure-pipelines/product-build.yml index e221102a87a..d2f0d5b4510 100644 --- a/build/azure-pipelines/product-build.yml +++ b/build/azure-pipelines/product-build.yml @@ -112,8 +112,6 @@ variables: value: ticino - name: AZURE_STORAGE_ACCOUNT_2 value: vscode - - name: AZURE_WEBVIEW_STORAGE_ACCOUNT - value: vscodewebviewstorage - name: MOONCAKE_CDN_URL value: https://vscode.cdn.azure.cn - name: VSCODE_MIXIN_REPO diff --git a/build/azure-pipelines/product-compile.yml b/build/azure-pipelines/product-compile.yml index 61135377ed2..b8c3fd4140c 100644 --- a/build/azure-pipelines/product-compile.yml +++ b/build/azure-pipelines/product-compile.yml @@ -12,7 +12,7 @@ steps: inputs: azureSubscription: "vscode-builds-subscription" KeyVaultName: vscode - SecretsFilter: 'github-distro-mixin-password,ticino-storage-key,vscode-webview-storage-key' + SecretsFilter: 'github-distro-mixin-password,ticino-storage-key' - script: | set -e @@ -120,13 +120,6 @@ steps: displayName: Extract Telemetry condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - - script: | - set -e - AZURE_WEBVIEW_STORAGE_ACCESS_KEY="$(vscode-webview-storage-key)" \ - ./build/azure-pipelines/common/publish-webview.sh - displayName: Publish Webview - condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false')) - - script: | set -e tar -cz --ignore-failed-read -f $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out