176 lines
6.4 KiB
YAML
176 lines
6.4 KiB
YAML
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: "16.x"
|
|
|
|
- task: AzureKeyVault@1
|
|
displayName: "Azure Key Vault: Get Secrets"
|
|
inputs:
|
|
azureSubscription: "vscode-builds-subscription"
|
|
KeyVaultName: vscode
|
|
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
|
|
|
- script: |
|
|
set -e
|
|
cat << EOF > ~/.netrc
|
|
machine github.com
|
|
login vscode
|
|
password $(github-distro-mixin-password)
|
|
EOF
|
|
|
|
git config user.email "vscode@microsoft.com"
|
|
git config user.name "VSCode"
|
|
displayName: Prepare tooling
|
|
|
|
- script: |
|
|
set -e
|
|
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
|
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
|
git checkout FETCH_HEAD
|
|
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
|
displayName: Checkout override commit
|
|
|
|
- script: |
|
|
set -e
|
|
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
|
displayName: Merge distro
|
|
|
|
- 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
|
|
inputs:
|
|
key: "nodeModules | $(Agent.OS) | .build/yarnlockhash"
|
|
path: .build/node_modules_cache
|
|
cacheHitVar: NODE_MODULES_RESTORED
|
|
displayName: Restore node_modules cache
|
|
|
|
- task: Cache@2
|
|
inputs:
|
|
key: '"builtInDeps" | .build/builtindepshash'
|
|
path: .build/builtInExtensions
|
|
displayName: Restore built-in extensions
|
|
|
|
- script: |
|
|
set -e
|
|
tar -xzf .build/node_modules_cache/cache.tgz
|
|
displayName: Extract node_modules cache
|
|
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
|
|
|
- script: |
|
|
set -e
|
|
npm install -g node-gyp@latest
|
|
node-gyp --version
|
|
displayName: Update node-gyp
|
|
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
|
|
|
- script: |
|
|
set -e
|
|
npx https://aka.ms/enablesecurefeed standAlone
|
|
timeoutInMinutes: 5
|
|
retryCountOnTaskFailure: 3
|
|
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true'))
|
|
displayName: Switch to Terrapin packages
|
|
|
|
- script: |
|
|
set -e
|
|
export npm_config_arch=$(VSCODE_ARCH)
|
|
export npm_config_node_gyp=$(which node-gyp)
|
|
|
|
for i in {1..3}; do # try 3 times, for Terrapin
|
|
yarn --frozen-lockfile --check-files && break
|
|
if [ $i -eq 3 ]; then
|
|
echo "Yarn failed too many times" >&2
|
|
exit 1
|
|
fi
|
|
echo "Yarn failed $i, trying again..."
|
|
done
|
|
env:
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
|
displayName: Install dependencies
|
|
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
|
|
|
- script: |
|
|
set -e
|
|
node build/lib/builtInExtensions.js
|
|
env:
|
|
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
|
displayName: Download missing built-in extensions
|
|
|
|
- script: |
|
|
set -e
|
|
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
|
|
mkdir -p .build/node_modules_cache
|
|
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
|
|
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
|
displayName: Create node_modules archive
|
|
|
|
- download: current
|
|
artifact: unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive
|
|
displayName: Download $(VSCODE_ARCH) artifact
|
|
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
version: 2.x
|
|
|
|
- task: EsrpClientTool@1
|
|
displayName: Download ESRPClient
|
|
|
|
- script: |
|
|
set -e
|
|
node build/azure-pipelines/common/sign "$(esrpclient.toolpath)/$(esrpclient.toolname)" darwin-sign $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(Pipeline.Workspace)/unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive VSCode-darwin-$(VSCODE_ARCH).zip
|
|
displayName: Codesign
|
|
|
|
- script: |
|
|
set -e
|
|
node build/azure-pipelines/common/sign "$(esrpclient.toolpath)/$(esrpclient.toolname)" darwin-notarize $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(Pipeline.Workspace)/unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive VSCode-darwin-$(VSCODE_ARCH).zip
|
|
displayName: Notarize
|
|
|
|
- script: |
|
|
set -e
|
|
unzip $(Pipeline.Workspace)/unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive/VSCode-darwin-$(VSCODE_ARCH).zip -d $(Agent.BuildDirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
|
displayName: Extract signed app
|
|
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
|
|
|
- script: |
|
|
set -e
|
|
APP_ROOT="$(Agent.BuildDirectory)/VSCode-darwin-$(VSCODE_ARCH)"
|
|
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
|
echo "##vso[task.setvariable variable=APP_PATH]$APP_ROOT/$APP_NAME"
|
|
displayName: Find application path
|
|
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
|
|
|
- script: |
|
|
set -e
|
|
codesign -dv --deep --verbose=4 "$(APP_PATH)"
|
|
displayName: Verify signature
|
|
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
|
|
|
- script: |
|
|
set -e
|
|
"$(APP_PATH)/Contents/Resources/app/bin/code" --export-default-configuration=.build
|
|
displayName: Verify signed application starts OK
|
|
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
|
|
|
- script: |
|
|
# For legacy purposes, arch for x64 is just 'darwin'
|
|
case $VSCODE_ARCH in
|
|
x64) ASSET_ID="darwin" ;;
|
|
arm64) ASSET_ID="darwin-arm64" ;;
|
|
universal) ASSET_ID="darwin-universal" ;;
|
|
esac
|
|
echo "##vso[task.setvariable variable=ASSET_ID]$ASSET_ID"
|
|
displayName: Set asset id variable
|
|
|
|
- script: mv $(Pipeline.Workspace)/unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive/VSCode-darwin-x64.zip $(Pipeline.Workspace)/unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive/VSCode-darwin.zip
|
|
displayName: Rename x64 build to its legacy name
|
|
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
|
|
|
|
- publish: $(Pipeline.Workspace)/unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive/VSCode-$(ASSET_ID).zip
|
|
artifact: vscode_client_darwin_$(VSCODE_ARCH)_archive
|