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

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

- script: |
    set -e
    export npm_config_arch="$(VSCODE_ARCH)"
    if [[ "$(VSCODE_ARCH)" == "ia32" ]]; then
      export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig"
    fi

    echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
    yarn
    npm run gulp -- hygiene
    npm run monaco-compile-check
    VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
    node build/tfs/common/installDistro.js
    node build/lib/builtInExtensions.js

- script: |
    set -e
    VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- vscode-linux-$(VSCODE_ARCH)-min
  name: build

- script: |
    set -e
    npm run gulp -- "electron-$(VSCODE_ARCH)"
    DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests"
    # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)"
  name: test

- script: |
    set -e
    REPO="$(pwd)"
    ROOT="$REPO/.."
    ARCH="$(VSCODE_ARCH)"

    # Publish tarball
    PLATFORM_LINUX="linux-$(VSCODE_ARCH)"
    [[ "$ARCH" == "ia32" ]] && DEB_ARCH="i386" || DEB_ARCH="amd64"
    [[ "$ARCH" == "ia32" ]] && RPM_ARCH="i386" || RPM_ARCH="x86_64"
    BUILDNAME="VSCode-$PLATFORM_LINUX"
    BUILD="$ROOT/$BUILDNAME"
    BUILD_VERSION="$(date +%s)"
    [ -z "$VSCODE_QUALITY" ] && TARBALL_FILENAME="code-$BUILD_VERSION.tar.gz" || TARBALL_FILENAME="code-$VSCODE_QUALITY-$BUILD_VERSION.tar.gz"
    TARBALL_PATH="$ROOT/$TARBALL_FILENAME"
    PACKAGEJSON="$BUILD/resources/app/package.json"
    VERSION=$(node -p "require(\"$PACKAGEJSON\").version")

    rm -rf $ROOT/code-*.tar.*
    (cd $ROOT && tar -czf $TARBALL_PATH $BUILDNAME)

    AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
    MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
    node build/tfs/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_LINUX" archive-unsigned "$TARBALL_FILENAME" "$VERSION" true "$TARBALL_PATH"

    # Publish hockeyapp symbols
    node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" "$(VSCODE_HOCKEYAPP_ID_LINUX64)"

    # Publish DEB
    npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-deb"
    PLATFORM_DEB="linux-deb-$ARCH"
    [[ "$ARCH" == "ia32" ]] && DEB_ARCH="i386" || DEB_ARCH="amd64"
    DEB_FILENAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/)"
    DEB_PATH="$REPO/.build/linux/deb/$DEB_ARCH/deb/$DEB_FILENAME"

    AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
    MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
    node build/tfs/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_DEB" package "$DEB_FILENAME" "$VERSION" true "$DEB_PATH"

    # Publish RPM
    npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-rpm"
    PLATFORM_RPM="linux-rpm-$ARCH"
    [[ "$ARCH" == "ia32" ]] && RPM_ARCH="i386" || RPM_ARCH="x86_64"
    RPM_FILENAME="$(ls $REPO/.build/linux/rpm/$RPM_ARCH/ | grep .rpm)"
    RPM_PATH="$REPO/.build/linux/rpm/$RPM_ARCH/$RPM_FILENAME"

    AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
    MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
    node build/tfs/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_RPM" package "$RPM_FILENAME" "$VERSION" true "$RPM_PATH"

    # SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
    # SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"

    # Publish to MS repo
    IS_FROZEN="$(AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" node build/tfs/linux/frozen-check.js $VSCODE_QUALITY)"

    if [ -z "$VSCODE_QUALITY" ]; then
      echo "VSCODE_QUALITY is not set, skipping repo package publish"
    elif [ "$IS_FROZEN" = "true" ]; then
      echo "$VSCODE_QUALITY is frozen, skipping repo package publish"
    else
      if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ] || [ "$VSCODE_PUBLISH_LINUX" = "true" ]; then
        if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then
          # Write config files needed by API, use eval to force environment variable expansion
          pushd build/tfs/linux
          # Submit to apt repo
          if [ "$DEB_ARCH" = "amd64" ]; then
            # echo "{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"username\": \"vscode\", \"password\": \"$(LINUX_REPO_PASSWORD)\" }" > apt-config.json
            # ./repoapi_client.sh -config apt-config.json -addfile $DEB_PATH
          fi
          # Submit to yum repo (disabled as it's manual until signing is automated)
          # eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"<KEY>\", \"username\": \"vscode\", \"password\": \"<PASSWORD>)\" }' > yum-config.json

          # ./repoapi_client.sh -config yum-config.json -addfile $RPM_PATH
          popd
          echo "To check repo publish status run ./repoapi_client.sh -config config.json -check <id>"
        fi
      fi
    fi<commit_msg>fix linux build issue (empty if block)<commit_after>steps:
- task: NodeTool@0
  inputs:
    versionSpec: "8.9.1"

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

- script: |
    set -e
    export npm_config_arch="$(VSCODE_ARCH)"
    if [[ "$(VSCODE_ARCH)" == "ia32" ]]; then
      export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig"
    fi

    echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
    yarn
    npm run gulp -- hygiene
    npm run monaco-compile-check
    VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
    node build/tfs/common/installDistro.js
    node build/lib/builtInExtensions.js

- script: |
    set -e
    VSCODE_MIXIN_PASSWORD="$(<PASSWORD>)" npm run gulp -- vscode-linux-$(VSCODE_ARCH)-min
  name: build

- script: |
    set -e
    npm run gulp -- "electron-$(VSCODE_ARCH)"
    DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests"
    # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)"
  name: test

- script: |
    set -e
    REPO="$(pwd)"
    ROOT="$REPO/.."
    ARCH="$(VSCODE_ARCH)"

    # Publish tarball
    PLATFORM_LINUX="linux-$(VSCODE_ARCH)"
    [[ "$ARCH" == "ia32" ]] && DEB_ARCH="i386" || DEB_ARCH="amd64"
    [[ "$ARCH" == "ia32" ]] && RPM_ARCH="i386" || RPM_ARCH="x86_64"
    BUILDNAME="VSCode-$PLATFORM_LINUX"
    BUILD="$ROOT/$BUILDNAME"
    BUILD_VERSION="$(date +%s)"
    [ -z "$VSCODE_QUALITY" ] && TARBALL_FILENAME="code-$BUILD_VERSION.tar.gz" || TARBALL_FILENAME="code-$VSCODE_QUALITY-$BUILD_VERSION.tar.gz"
    TARBALL_PATH="$ROOT/$TARBALL_FILENAME"
    PACKAGEJSON="$BUILD/resources/app/package.json"
    VERSION=$(node -p "require(\"$PACKAGEJSON\").version")

    rm -rf $ROOT/code-*.tar.*
    (cd $ROOT && tar -czf $TARBALL_PATH $BUILDNAME)

    AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
    MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
    node build/tfs/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_LINUX" archive-unsigned "$TARBALL_FILENAME" "$VERSION" true "$TARBALL_PATH"

    # Publish hockeyapp symbols
    node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" "$(VSCODE_HOCKEYAPP_ID_LINUX64)"

    # Publish DEB
    npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-deb"
    PLATFORM_DEB="linux-deb-$ARCH"
    [[ "$ARCH" == "ia32" ]] && DEB_ARCH="i386" || DEB_ARCH="amd64"
    DEB_FILENAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/)"
    DEB_PATH="$REPO/.build/linux/deb/$DEB_ARCH/deb/$DEB_FILENAME"

    AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
    MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
    node build/tfs/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_DEB" package "$DEB_FILENAME" "$VERSION" true "$DEB_PATH"

    # Publish RPM
    npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-rpm"
    PLATFORM_RPM="linux-rpm-$ARCH"
    [[ "$ARCH" == "ia32" ]] && RPM_ARCH="i386" || RPM_ARCH="x86_64"
    RPM_FILENAME="$(ls $REPO/.build/linux/rpm/$RPM_ARCH/ | grep .rpm)"
    RPM_PATH="$REPO/.build/linux/rpm/$RPM_ARCH/$RPM_FILENAME"

    AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
    MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
    node build/tfs/common/publish.js "$VSCODE_QUALITY" "$PLATFORM_RPM" package "$RPM_FILENAME" "$VERSION" true "$RPM_PATH"

    # SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
    # SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"

    # Publish to MS repo
    IS_FROZEN="$(AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" node build/tfs/linux/frozen-check.js $VSCODE_QUALITY)"

    if [ -z "$VSCODE_QUALITY" ]; then
      echo "VSCODE_QUALITY is not set, skipping repo package publish"
    elif [ "$IS_FROZEN" = "true" ]; then
      echo "$VSCODE_QUALITY is frozen, skipping repo package publish"
    else
      if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ] || [ "$VSCODE_PUBLISH_LINUX" = "true" ]; then
        if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then
          # Write config files needed by API, use eval to force environment variable expansion
          pushd build/tfs/linux
          # Submit to apt repo
          # if [ "$DEB_ARCH" = "amd64" ]; then
            # echo "{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"username\": \"vscode\", \"password\": \"$(LINUX_REPO_PASSWORD)\" }" > apt-config.json
            # ./repoapi_client.sh -config apt-config.json -addfile $DEB_PATH
          # fi
          # Submit to yum repo (disabled as it's manual until signing is automated)
          # eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4ae<PASSWORD>421134a<PASSWORD>8d1b\", \"username\": \"vscode\", \"password\": \"$(LINUX_REPO_PASSWORD)\" }' > yum-config.json

          # ./repoapi_client.sh -config yum-config.json -addfile $RPM_PATH
          popd
          echo "To check repo publish status run ./repoapi_client.sh -config config.json -check <id>"
        fi
      fi
    fi
{'fraction_non_alphanumeric': 0.16722590006348054, 'fraction_numerical': 0.015326017955926363, 'mean_word_length': 3.631667366652667, 'pattern_counts': {'":': 24, '<': 10, '<?xml version=': 0, '>': 16, 'https://': 0, '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': '3418515', 'n_tokens_mistral': 4391, 'n_tokens_neox': 4199, 'n_words': 677}