Files
vscode/build/azure-pipelines/linux/snap-build-linux.yml
João Moreno e5515ac702 Adopt 1ES PT (#207844)
* extend 1es pipeline template

* oops

* fix template references

* argh

* hmm

* hm

* hm

* use outputs for compilation artifact

* this

* use 1ES.PublishPipelineArtifact@1 instead of publish

* more 1ES.PublishPipelineArtifact@1 adoption

* provide windows pool for sdl sources

* sdl

* fix pools

* fix macos

* disable sbom for intermediate artifacts

* use mariner linux

* try inline tsa options

* fix credscan

* hm

* sudo it

* more suppressions

* be explicit with SBOM build drop paths

* fix indentation

* fix file extensions

* fix cli sbom build drop paths

* fix more build

* fix unzip cli

* careful with _manifest in artifacts

* do not close file

* add logging

* debug

* use snapcraft container

* remove size check

* fix macos cli step

* fix snap permissions

* fix macos

* better logs

* fix snap

* more cred scan suppressions

* even more supressiong

* alpine-arm64: try using x64

* Revert "alpine-arm64: try using x64"

This reverts commit bf2003bf60.

* test docker

* I wonder

* logs

* hm

* fix indentation

* hm

* hm

* fix snap finds

* remove auth

* use hostArchitecture

* snap: limit find

* hm

* sudo

* Add validateToolOutput: None to the build pipeline

* bring back sdl-scan

* try all tools: true

* use release

* Update Azure Pipelines YAML file for Linux product build and test

* hm

* hm

* same for win32

* hm

* hm

* Revert "hm"

This reverts commit 1b9dcae85b.

* use branch

* fix template file

* fix template paths
2024-03-21 14:16:32 +01:00

74 lines
2.5 KiB
YAML

steps:
- task: NodeTool@0
inputs:
versionSource: fromFile
versionFilePath: .nvmrc
nodejsMirror: https://github.com/joaomoreno/node-mirror/releases/download
- task: DownloadPipelineArtifact@0
displayName: "Download Pipeline Artifact"
inputs:
artifactName: snap-$(VSCODE_ARCH)
targetPath: .build/linux/snap-tarball
- script: |
set -e
# Get snapcraft version
snapcraft --version
# Make sure we get latest packages
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y curl apt-transport-https ca-certificates
# Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install -y yarn
# Define variables
SNAP_ROOT="$(pwd)/.build/linux/snap/$(VSCODE_ARCH)"
# Install build dependencies
(cd build && yarn)
# Unpack snap tarball artifact, in order to preserve file perms
(cd .build/linux && tar -xzf snap-tarball/snap-$(VSCODE_ARCH).tar.gz)
# Create snap package
BUILD_VERSION="$(date +%s)"
SNAP_FILENAME="code-$VSCODE_QUALITY-$(VSCODE_ARCH)-$BUILD_VERSION.snap"
SNAP_PATH="$SNAP_ROOT/$SNAP_FILENAME"
case $(VSCODE_ARCH) in
x64) SNAPCRAFT_TARGET_ARGS="" ;;
*) SNAPCRAFT_TARGET_ARGS="--target-arch $(VSCODE_ARCH)" ;;
esac
(cd $SNAP_ROOT/code-* && sudo --preserve-env snapcraft snap $SNAPCRAFT_TARGET_ARGS --output "$SNAP_PATH")
displayName: Prepare for publish
- script: |
set -e
SNAP_ROOT="$(pwd)/.build/linux/snap/$(VSCODE_ARCH)"
SNAP_EXTRACTED_PATH=$(find $SNAP_ROOT -maxdepth 1 -type d -name 'code-*')
SNAP_PATH=$(find $SNAP_ROOT -maxdepth 1 -type f -name '*.snap')
# SBOM tool doesn't like recursive symlinks
sudo find $SNAP_EXTRACTED_PATH -type l -delete
echo "##vso[task.setvariable variable=SNAP_EXTRACTED_PATH]$SNAP_EXTRACTED_PATH"
echo "##vso[task.setvariable variable=SNAP_PATH]$SNAP_PATH"
target:
container: host
displayName: Find host snap path & prepare for SBOM
- task: 1ES.PublishPipelineArtifact@1
inputs:
targetPath: $(SNAP_PATH)
artifactName: vscode_client_linux_$(VSCODE_ARCH)_snap
sbomBuildDropPath: $(SNAP_EXTRACTED_PATH)
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) SNAP"
sbomPackageVersion: $(Build.SourceVersion)
displayName: Publish snap package