From 60e353e2bfe7969107ec59888e66de0fc4a9aea2 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Tue, 21 Jan 2025 10:00:59 +0100 Subject: [PATCH 1/2] chore: Generate artifacts.lock.yaml on rebase Signed-off-by: Anatolii Bazko --- .github/workflows/rebase-insiders.yml | 2 + build/artifacts/artifacts.lock.yaml | 28 +++++++++ build/artifacts/generate.sh | 89 +++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 build/artifacts/artifacts.lock.yaml create mode 100755 build/artifacts/generate.sh diff --git a/.github/workflows/rebase-insiders.yml b/.github/workflows/rebase-insiders.yml index 1c68c5fdd8a..d159eab406a 100644 --- a/.github/workflows/rebase-insiders.yml +++ b/.github/workflows/rebase-insiders.yml @@ -56,6 +56,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | docker buildx build --memory-swap -1 --memory 10g --platform linux/amd64 -f build/dockerfiles/linux-libc-ubi9.Dockerfile . + - name: Generate artifacts.lock.yaml + run: ./build/artifacts/generate.sh - name: push changes run: | set -e diff --git a/build/artifacts/artifacts.lock.yaml b/build/artifacts/artifacts.lock.yaml new file mode 100644 index 00000000000..ce7e87f4b28 --- /dev/null +++ b/build/artifacts/artifacts.lock.yaml @@ -0,0 +1,28 @@ +--- +metadata: + version: "1.0" +artifacts: + # ms-vscode.js-debug-companion + - download_url: https://github.com/microsoft/vscode-js-debug-companion/releases/download/v1.1.3/ms-vscode.js-debug-companion.1.1.3.vsix + filename: ms-vscode.js-debug-companion.1.1.3.vsix + checksum: sha256:7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93 + # ms-vscode.js-debug + - download_url: https://github.com/microsoft/vscode-js-debug/releases/download/v1.96.0/ms-vscode.js-debug.1.96.0.vsix + filename: ms-vscode.js-debug.1.96.0.vsix + checksum: sha256:278cd8b129c133d834a8105d0e0699f2f940c5c159fa5c821c7b9a4f7ffd3581 + # ms-vscode.vscode-js-profile-table + - download_url: https://github.com/microsoft/vscode-js-profile-visualizer/releases/download/v1.0.10/ms-vscode.vscode-js-profile-table.1.0.10.vsix + filename: ms-vscode.vscode-js-profile-table.1.0.10.vsix + checksum: sha256:7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08 + # ripgrep-ppc64le + - download_url: https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-4/ripgrep-v13.0.0-4-powerpc64le-unknown-linux-gnu.tar.gz + filename: ripgrep-ppc64le + checksum: sha256:https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-4/ripgrep-v13.0.0-4-powerpc64le-unknown-linux-gnu.tar.gz + # ripgrep-s390x + - download_url: https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-4/ripgrep-v13.0.0-4-s390x-unknown-linux-gnu.tar.gz + filename: ripgrep-s390x + checksum: sha256:https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-4/ripgrep-v13.0.0-4-s390x-unknown-linux-gnu.tar.gz + # ripgrep-x86_64 + - download_url: https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-10/ripgrep-v13.0.0-10-x86_64-unknown-linux-musl.tar.gz + filename: ripgrep-x86_64 + checksum: sha256:https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-10/ripgrep-v13.0.0-10-x86_64-unknown-linux-musl.tar.gz diff --git a/build/artifacts/generate.sh b/build/artifacts/generate.sh new file mode 100755 index 00000000000..9966d35c5fc --- /dev/null +++ b/build/artifacts/generate.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# Copyright (c) 2022-2024 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e + +SCRIPT_DIR=$(dirname "$0") +ROOT_DIR=$(realpath "$SCRIPT_DIR/../..") +ARTIFACTS_LOCK_YAML="$SCRIPT_DIR/artifacts.lock.yaml" + +run () { + rm -f $ARTIFACTS_LOCK_YAML + + echo "---" >> "$ARTIFACTS_LOCK_YAML" + echo "metadata:" >> "$ARTIFACTS_LOCK_YAML" + echo " version: \"1.0\"" >> "$ARTIFACTS_LOCK_YAML" + echo "artifacts:" >> "$ARTIFACTS_LOCK_YAML" + + # Generate artifacts for built-in extensions + PRODUCT_JSON="$ROOT_DIR/code/product.json" + PLUGINS=$(jq -r '.builtInExtensions[] | .name' "$PRODUCT_JSON") + for PLUGIN in $PLUGINS; do + VERSION=$(jq -r '.builtInExtensions[] | select(.name=="'${PLUGIN}'") | .version' "$PRODUCT_JSON") + REPOSITORY=$(jq -r '.builtInExtensions[] | select(.name=="'${PLUGIN}'") | .repo' "$PRODUCT_JSON") + SHA256=$(jq -r '.builtInExtensions[] | select(.name=="'${PLUGIN}'") | .sha256' "$PRODUCT_JSON") + + if [[ ! $SHA256 == "null" ]]; then + FILENAME="$PLUGIN.$VERSION.vsix" + DOWNLOAD_URL="$REPOSITORY/releases/download/v$VERSION/$FILENAME" + check_existance "$DOWNLOAD_URL" + + echo " # $PLUGIN" >> "$ARTIFACTS_LOCK_YAML" + echo " - download_url: $DOWNLOAD_URL" >> "$ARTIFACTS_LOCK_YAML" + echo " filename: $FILENAME" >> "$ARTIFACTS_LOCK_YAML" + echo " checksum: sha256:$SHA256" >> "$ARTIFACTS_LOCK_YAML" + fi + done + + # Generate artifacts for ripgrep dependency + PACKAGE_LOCK_JSON="$ROOT_DIR/code/package-lock.json" + VSCODE_RIPGREP_VERSION=$(grep '"node_modules/@vscode/ripgrep"' "$PACKAGE_LOCK_JSON" -A 2 | grep '"version"' | head -1 | cut -d '"' -f 4) + POST_INSTALL_SCRIPT=$(curl -sSL https://raw.githubusercontent.com/microsoft/vscode-ripgrep/v${VSCODE_RIPGREP_VERSION}/lib/postinstall.js) + VSIX_RIPGREP_PREBUILT_VERSION=$(echo "${POST_INSTALL_SCRIPT}" | grep "const VERSION" | cut -d"'" -f 2 ) + VSIX_RIPGREP_PREBUILT_MULTIARCH_VERSION=$(echo "${POST_INSTALL_SCRIPT}" | grep "const MULTI_ARCH_LINUX_VERSION" | cut -d"'" -f 2 ) + + PLATFORMS=("ppc64le" "s390x" "x86_64") + for PLATFORM in "${PLATFORMS[@]}"; do + FILENAME="ripgrep-$PLATFORM" + + case $PLATFORM in + 'ppc64le') RG_ARCH_SUFFIX='powerpc64le-unknown-linux-gnu';; + 's390x') RG_ARCH_SUFFIX='s390x-unknown-linux-gnu';; + 'x86_64') RG_ARCH_SUFFIX='x86_64-unknown-linux-musl';; + esac + case $PLATFORM in + 'ppc64le' | 's390x') RG_VERSION=${VSIX_RIPGREP_PREBUILT_MULTIARCH_VERSION};; + 'x86_64') RG_VERSION="${VSIX_RIPGREP_PREBUILT_VERSION}";; + esac + + DOWNLOAD_URL="https://github.com/microsoft/ripgrep-prebuilt/releases/download/${RG_VERSION}/ripgrep-${RG_VERSION}-${RG_ARCH_SUFFIX}.tar.gz" + check_existance "$DOWNLOAD_URL" + + echo " # $FILENAME" >> "$ARTIFACTS_LOCK_YAML" + echo " - download_url: $DOWNLOAD_URL" >> "$ARTIFACTS_LOCK_YAML" + echo " filename: $FILENAME" >> "$ARTIFACTS_LOCK_YAML" + echo " checksum: sha256:$DOWNLOAD_URL" >> "$ARTIFACTS_LOCK_YAML" + done + + echo "[INFO] Done" +} + +check_existance() { + if curl -sfILo/dev/null "$1"; then + echo "[INFO] Valid url: $1" + else + echo "[ERROR] Invalid url: $1" + exit 1 + fi +} + +run \ No newline at end of file From 42f8eb16160912976f9928997e45829af205e65b Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Tue, 21 Jan 2025 10:37:17 +0100 Subject: [PATCH 2/2] Fixup Signed-off-by: Anatolii Bazko --- build/artifacts/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/artifacts/generate.sh b/build/artifacts/generate.sh index 9966d35c5fc..f0f316a290d 100755 --- a/build/artifacts/generate.sh +++ b/build/artifacts/generate.sh @@ -86,4 +86,4 @@ check_existance() { fi } -run \ No newline at end of file +run