Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 93 additions & 3 deletions src/s-core-devcontainer/.devcontainer/s-core-local/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# shellcheck disable=SC2016
# Variables in strings with single quotes are expected to be evaluated later by `eval`

# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
Expand Down Expand Up @@ -35,6 +37,53 @@ DEBIAN_FRONTEND=noninteractive
ARCHITECTURE=$(dpkg --print-architecture)
KERNEL=$(uname -s)

# Downloads and extracts a tool from GitHub releases, based on the provided URL pattern, version and architecture-specific checksums.
# The URL pattern can include placeholders for version and architecture variant
download_and_extract_from_github() {
local url_pattern="$1"
local tool_name="$2"
local amd64_name="$3"
local arm64_name="$4"
local extract_names="$5"
local strip_components="${6:-0}"
local temp_file="/tmp/${tool_name}"

local version_name="${tool_name}_version"
export version="${!version_name}"
variant="${amd64_name}"
local sha256sum_name="${tool_name}_amd64_sha256"
if [ "${ARCHITECTURE}" = "arm64" ]; then
variant="${arm64_name}"
sha256sum_name="${tool_name}_arm64_sha256"
fi
sha256sum="${!sha256sum_name}"
export variant

local url
url="$(eval "echo ${url_pattern}")"

curl -L "${url}" -o "${temp_file}"
echo "${sha256sum} ${temp_file}" | sha256sum -c - || exit 1

local tar_options=""
if [[ "${url}" == *.tar.gz ]]; then
tar_options="-xzf"
elif [[ "${url}" == *.tar.xz ]]; then
tar_options="-xf"
elif [[ "${url}" == *.tar.zst ]]; then
tar_options="-I zstd -xf"
fi

local extract_names_expanded
extract_names_expanded="$(eval "echo ${extract_names}")"

# shellcheck disable=SC2086
# tar_options and extract_names_expanded are expected to be word-split
tar ${tar_options} "${temp_file}" -C "/usr/local/bin" --strip-components="${strip_components}" ${extract_names_expanded}

rm "${temp_file}"
}

apt-get update

# Unminimize the image to include standard packages like man pages
Expand All @@ -45,8 +94,13 @@ apt-get install -y man-db manpages manpages-dev manpages-posix manpages-posix-de
# Container build dependencies are not pinned, since they are removed anyway after container creation.
apt-get install apt-transport-https -y

# static code anylysis for shell scripts
apt-get install -y shellcheck="${shellcheck_version}*"
# static code analysis for shell scripts
download_and_extract_from_github \
'https://github.com/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.${variant}.tar.xz' \
"shellcheck" \
"x86_64" "aarch64" \
'shellcheck-v${version}/shellcheck' \
1

# GraphViz
# The Ubuntu Noble package of GraphViz
Expand All @@ -64,7 +118,7 @@ apt-get install -y gh
apt-get install -y "python${python_version}" python3-pip python3-venv
# The following packages correspond to the list of packages installed by the
# devcontainer feature "python" (cf. https://github.com/devcontainers/features/tree/main/src/python )
apt-get install -y flake8 python3-autopep8 black python3-yapf mypy pydocstyle pycodestyle bandit pipenv virtualenv python3-pytest pylint
apt-get install -y flake8 python3-autopep8 black python3-yapf mypy pydocstyle pycodestyle bandit pipenv virtualenv pylint

# OpenJDK 21, via APT
# Set JAVA_HOME environment variable system-wide, since some tools rely on it (e.g., Bazel's rules_java)
Expand All @@ -76,6 +130,42 @@ echo -e "JAVA_HOME=${JAVA_HOME}\nexport JAVA_HOME" > /etc/profile.d/java_home.sh
# qemu-system-arm
apt-get install -y --no-install-recommends --fix-broken qemu-system-arm="${qemu_system_arm_version}*"

# ruff
download_and_extract_from_github \
'https://github.com/astral-sh/ruff/releases/download/${version}/ruff-${variant}-unknown-linux-gnu.tar.gz' \
"ruff" \
"x86_64" "aarch64" \
'ruff-${variant}-unknown-linux-gnu/ruff' \
1

# actionlint
download_and_extract_from_github \
'https://github.com/rhysd/actionlint/releases/download/v${version}/actionlint_${version}_linux_${variant}.tar.gz' \
"actionlint" \
"amd64" "arm64" \
'actionlint'

# yamlfmt
download_and_extract_from_github \
'https://github.com/google/yamlfmt/releases/download/v${version}/yamlfmt_${version}_Linux_${variant}.tar.gz' \
"yamlfmt" \
"x86_64" "arm64" \
'yamlfmt'

# uv
download_and_extract_from_github \
'https://github.com/astral-sh/uv/releases/download/0.10.4/uv-x86_64-unknown-linux-gnu.tar.gz' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the hard-coded version and architecture are wrong

Copy link
Contributor Author

@lurtz lurtz Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is already fixed in a commit not visible in this pull request. I have no idea why it is not showing. Will recreate the PR

"uv" \
"x86_64" "aarch64" \
'uv-${variant}-unknown-linux-gnu/uv uv-${variant}-unknown-linux-gnu/uvx' \
1

# basedpyright
su $(ls /home) -c "uv tool install basedpyright@\"${basedpyright_version}\""

# pytest
su $(ls /home) -c "uv tool install pytest@\"${pytest_version}\""

# sshpass
apt-get install -y sshpass="${sshpass_version}*"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ check "validate git-lfs is working and has the correct version" bash -c "git lfs
check "validate python3 is working and has the correct version" bash -c "python3 --version | grep '${python_version}'"
check "validate pip3 is working and has the correct version" bash -c "pip3 --version | grep '${python_version}'"
check "validate black is working and has the correct version" bash -c "black --version | grep '${python_version}'"
check "validate pytest is working and has the correct version" bash -c "pytest --version | grep '${pytest_version}'"
check "validate basedpyright is working and has the correct version" bash -c "basedpyright --version | grep '${basedpyright_version}'"
# cannot grep versions as they do not match the Python version
check "validate virtualenv is working" bash -c "virtualenv --version"
check "validate flake8 is working" bash -c "flake8 --version"
Expand All @@ -54,6 +56,19 @@ check "validate pylint is working" bash -c "pylint --version"
check "validate java is working and has the correct version" bash -c "java -version 2>&1 | grep '${openjdk_21_version}'"
check "validate JAVA_HOME is set correctly" bash -c "echo ${JAVA_HOME} | xargs readlink -f | grep \"java-21-openjdk\""

# ruff
check "validate ruff is working and has the correct version" bash -c "ruff --version | grep '${ruff_version}'"

# actionlint
check "validate actionlint is working and has the correct version" bash -c "actionlint --version | grep '${actionlint_version}'"

# yamlfmt
check "validate yamlfmt is working and has the correct version" bash -c "yamlfmt --version | grep '${yamlfmt_version}'"

# uv
check "validate uv is working and has the correct version" bash -c "uv --version | grep '${uv_version}'"
check "validate uvx is working and has the correct version" bash -c "uvx --version | grep '${uv_version}'"

# additional developer tools
check "validate gdb is working and has the correct version" bash -c "gdb --version | grep '${gdb_version}'"
check "validate gh is working and has the correct version" bash -c "gh --version | grep '${gh_version}'"
Expand Down
40 changes: 39 additions & 1 deletion src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

actionlint:
version: 1.7.7
amd64:
sha256: 023070a287cd8cccd71515fedc843f1985bf96c436b7effaecce67290e7e0757
arm64:
sha256: 401942f9c24ed71e4fe71b76c7d638f66d8633575c4016efd2977ce7c28317d0

basedpyright:
version: 1.35.0

graphviz:
version: 2.42.2

Expand All @@ -37,14 +47,35 @@ git_lfs:
python:
version: '3.12'

pytest:
version: 9.0.2

gh:
version: 2.45.0

openjdk_21:
version: 21.0.10

ruff:
version: 0.11.13
amd64:
sha256: 01aa32d29d00876b8d1429c617ed63a00b1fc81abfa4183bb05c9cb647fbc3d0
arm64:
sha256: 551af2ebc439d8268dcaf871ea60ad035f688728d30943dcbb2bf775e105213e

shellcheck:
version: 0.9.0
version: 0.10.0
amd64:
sha256: 6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87
arm64:
sha256: 324a7e89de8fa2aed0d0c28f3dab59cf84c6d74264022c00c22af665ed1a09bb

uv:
version: 0.10.4
amd64:
sha256: 6b52a47358deea1c5e173278bf46b2b489747a59ae31f2a4362ed5c6c1c269f7
arm64:
sha256: c84a6e6405715caa6e2f5ef8e5f29a5d0bc558a954e9f1b5c082b9d4708c222e

codeql:
# the coding_standards_version below dictates the codeql version
Expand All @@ -61,3 +92,10 @@ codeql_coding_standards:

valgrind:
version: 3.22.0

yamlfmt:
version: 0.17.0
amd64:
sha256: e91dd8722001596b8e4777a29d4a526a10ff276c4ff8a5ae39ff59be5a033054
arm64:
sha256: ebe78a5547dac68f05a01c9a2845901b3c658095432b107bef3084dfe0b2629d
Loading