mirror of https://github.com/microsoft/vscode.git
build: do proper hashing for built-in dependencies (#157295)
Fixes #157244
This commit is contained in:
parent
81978e984b
commit
fbda011715
|
@ -0,0 +1,15 @@
|
|||
"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 fs = require("fs");
|
||||
const path = require("path");
|
||||
const crypto = require("crypto");
|
||||
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../product.json'), 'utf8'));
|
||||
const shasum = crypto.createHash('sha1');
|
||||
for (const ext of productjson.builtInExtensions) {
|
||||
shasum.update(`${ext.name}@${ext.version}`);
|
||||
}
|
||||
process.stdout.write(shasum.digest('hex'));
|
|
@ -0,0 +1,17 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../product.json'), 'utf8'));
|
||||
const shasum = crypto.createHash('sha1');
|
||||
|
||||
for (const ext of productjson.builtInExtensions) {
|
||||
shasum.update(`${ext.name}@${ext.version}`);
|
||||
}
|
||||
|
||||
process.stdout.write(shasum.digest('hex'));
|
|
@ -38,6 +38,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -49,7 +50,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -49,7 +50,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -83,7 +84,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "alpine" $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -69,7 +70,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
|
@ -111,7 +112,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -21,7 +22,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
# using `genericNodeModules` instead of `nodeModules` here to avoid sharing the cache with builds running inside containers
|
||||
|
@ -59,7 +60,7 @@ steps:
|
|||
# Cache built-in extensions to avoid GH rate limits.
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ steps:
|
|||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "web" $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -60,7 +61,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ steps:
|
|||
"$(VSCODE_ARCH)" | Out-File -Encoding ascii -NoNewLine .build\arch
|
||||
"$env:ENABLE_TERRAPIN" | Out-File -Encoding ascii -NoNewLine .build\terrapin
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js > .build/yarnlockhash
|
||||
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
|
@ -91,7 +92,7 @@ steps:
|
|||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"$(Agent.OS)" | product.json'
|
||||
key: '"builtInDeps" | .build/builtindepshash'
|
||||
path: .build/builtInExtensions
|
||||
displayName: Restore built-in extensions
|
||||
|
||||
|
|
Loading…
Reference in New Issue