<commit_before>steps:
- task: NodeTool@0
  inputs:
    versionSpec: "10.15.1"

- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
  inputs:
    versionSpec: "1.10.1"

- task: AzureKeyVault@1
  displayName: 'Azure Key Vault: Get Secrets'
  inputs:
    azureSubscription: 'vscode-builds-subscription'
    KeyVaultName: vscode

- script: |
    set -e
    export npm_config_arch="$(VSCODE_ARCH)"

    cat << EOF > ~/.netrc
    machine monacotools.visualstudio.com
    password $(<PASSWORD>)
    machine github.com
    login vscode
    password $(github-<PASSWORD>)
    EOF

    git config user.email "<EMAIL>"
    git config user.name "VSCode"
  displayName: Prepare tooling

- script: |
    set -e
    git remote add distro "https://github.com/$(VSCODE_MIXIN_REPO).git"
    git fetch distro
    git merge $(node -p "require('./package.json').distro")
  displayName: Merge distro

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
  inputs:
    keyfile: '**/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'

- script: |
    set -e
    yarn --frozen-lockfile
  displayName: Install dependencies
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))

- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
  inputs:
    keyfile: '**/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))

- script: |
    set -e
    yarn gulp mixin
  displayName: Mix in quality

- script: |
    set -e
    yarn gulp hygiene
    yarn monaco-compile-check
  displayName: Run hygiene checks
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- script: |
    set -e
    node build/azure-pipelines/common/installDistroDependencies.js
    node build/azure-pipelines/common/installDistroDependencies.js remote
    node build/lib/builtInExtensions.js
  displayName: Install distro dependencies and extensions

- script: |
    set -e
    cd $BUILD_STAGINGDIRECTORY
    git clone https://github.com/microsoft/vscode-telemetry-extractor.git
    cd vscode-telemetry-extractor
    git checkout 3b04aba5bfdfcca1a5426cd2c51a90d18740d0bc
    npm i
    npm run setup-extension-repos
    node ./out/cli-extract.js --sourceDir $BUILD_SOURCESDIRECTORY --excludedDirPattern extensions  --outputDir . --applyEndpoints --includeIsMeasurement --patchWebsiteEvents
    node ./out/cli-extract-extensions.js --sourceDir ./src/telemetry-sources --outputDir . --applyEndpoints --includeIsMeasurement
    mkdir -p $BUILD_SOURCESDIRECTORY/.build/telemetry
    mv declarations-resolved.json $BUILD_SOURCESDIRECTORY/.build/telemetry/telemetry-core.json
    mv declarations-extensions-resolved.json $BUILD_SOURCESDIRECTORY/.build/telemetry/telemetry-extensions.json
  displayName: Extract Telemetry

- script: |
    set -e
    yarn gulp compile-build
    yarn gulp compile-extensions-build
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
      yarn gulp vscode-linux-$VSCODE_ARCH-min-ci
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
      yarn gulp vscode-reh-$VSCODE_ARCH-min-ci
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>-password)" \
      yarn gulp vscode-web-$VSCODE_ARCH-min-ci
  displayName: Build

- script: |
    set -e
    yarn gulp "electron-$(VSCODE_ARCH)"

    # xvfb seems to be crashing often, let's make sure it's always up
    service xvfb start

    DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests"
    # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)"
  displayName: Run unit tests
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- script: |
    set -e
    AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
    VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \
    ./build/azure-pipelines/linux/publish.sh
  displayName: Publish

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
  displayName: 'Component Detection'
  continueOnError: true

- task: PublishPipelineArtifact@0
  displayName: 'Publish Pipeline Artifact'
  inputs:
    artifactName: snap-$(VSCODE_ARCH)
    targetPath: .build/linux/snap-tarball
<commit_msg>fix linux build<commit_after>steps:
- task: NodeTool@0
  inputs:
    versionSpec: "10.15.1"

- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
  inputs:
    versionSpec: "1.10.1"

- task: AzureKeyVault@1
  displayName: 'Azure Key Vault: Get Secrets'
  inputs:
    azureSubscription: 'vscode-builds-subscription'
    KeyVaultName: vscode

- script: |
    set -e
    export npm_config_arch="$(VSCODE_ARCH)"

    cat << EOF > ~/.netrc
    machine monacotools.visualstudio.com
    password $(devops-pat)
    machine github.com
    login vscode
    password $(github-distro-mixin-password)
    EOF

    git config user.email "<EMAIL>"
    git config user.name "VSCode"
  displayName: Prepare tooling

- script: |
    set -e
    git remote add distro "https://github.com/$(VSCODE_MIXIN_REPO).git"
    git fetch distro
    git merge $(node -p "require('./package.json').distro")
  displayName: Merge distro

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
  inputs:
    keyfile: '**/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'

- script: |
    set -e
    yarn --frozen-lockfile
  displayName: Install dependencies
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))

- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
  inputs:
    keyfile: '**/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))

- script: |
    set -e
    yarn gulp mixin
  displayName: Mix in quality

- script: |
    set -e
    yarn gulp hygiene
    yarn monaco-compile-check
  displayName: Run hygiene checks
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- script: |
    set -e
    node build/azure-pipelines/common/installDistroDependencies.js
    node build/azure-pipelines/common/installDistroDependencies.js remote
    node build/lib/builtInExtensions.js
  displayName: Install distro dependencies and extensions

- script: |
    set -e
    cd $BUILD_STAGINGDIRECTORY
    git clone https://github.com/microsoft/vscode-telemetry-extractor.git
    cd vscode-telemetry-extractor
    git checkout 3b04aba5bfdfcca1a5426cd2c51a90d18740d0bc
    npm i
    npm run setup-extension-repos
    node ./out/cli-extract.js --sourceDir $BUILD_SOURCESDIRECTORY --excludedDirPattern extensions  --outputDir . --applyEndpoints --includeIsMeasurement --patchWebsiteEvents
    node ./out/cli-extract-extensions.js --sourceDir ./src/telemetry-sources --outputDir . --applyEndpoints --includeIsMeasurement
    mkdir -p $BUILD_SOURCESDIRECTORY/.build/telemetry
    mv declarations-resolved.json $BUILD_SOURCESDIRECTORY/.build/telemetry/telemetry-core.json
    mv declarations-extensions-resolved.json $BUILD_SOURCESDIRECTORY/.build/telemetry/telemetry-extensions.json
  displayName: Extract Telemetry

- script: |
    set -e
    yarn gulp compile-build
    yarn gulp compile-extensions-build
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
      yarn gulp vscode-linux-$VSCODE_ARCH-min-ci
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
      yarn gulp vscode-linux-reh-$VSCODE_ARCH-min-ci
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
      yarn gulp vscode-linux-web-$VSCODE_ARCH-min-ci
  displayName: Build

- script: |
    set -e
    yarn gulp "electron-$(VSCODE_ARCH)"

    # xvfb seems to be crashing often, let's make sure it's always up
    service xvfb start

    DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests"
    # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)"
  displayName: Run unit tests
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- script: |
    set -e
    AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" \
    VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \
    ./build/azure-pipelines/linux/publish.sh
  displayName: Publish

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
  displayName: 'Component Detection'
  continueOnError: true

- task: PublishPipelineArtifact@0
  displayName: 'Publish Pipeline Artifact'
  inputs:
    artifactName: snap-$(VSCODE_ARCH)
    targetPath: .build/linux/snap-tarball

{'fraction_non_alphanumeric': 0.129223343571742, 'fraction_numerical': 0.009433962264150943, 'mean_word_length': 3.7757988475641695, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5930711', 'n_tokens_mistral': 3285, 'n_tokens_neox': 3178, 'n_words': 590}