Skip to content

Commit

Permalink
Merge pull request #489 from che-incubator/artifactsyaml
Browse files Browse the repository at this point in the history
chore: Generate artifacts.lock.yaml on rebase
  • Loading branch information
tolusha authored Jan 23, 2025
2 parents c9ebb38 + 7a53bb1 commit c8bf561
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rebase-insiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions build/artifacts/artifacts.lock.yaml
Original file line number Diff line number Diff line change
@@ -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
89 changes: 89 additions & 0 deletions build/artifacts/generate.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c8bf561

Please sign in to comment.