Skip to content
Merged
5 changes: 3 additions & 2 deletions .github/workflows/test-pr-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ jobs:
strategy:
matrix:
features: ${{ fromJSON(needs.detect-changes.outputs.features) }}
# NOTE: ubuntu:focal and debian:11 are excluded because they ship
# GLIBC 2.31, but PowerShell >= 7.6.0 requires GLIBC 2.33+ on arm64.
# ubuntu:focal reached EOL Apr 2025; debian:11 reaches EOL Aug 2026.
baseImage:
[
"ubuntu:focal",
Comment thread
abdurriq marked this conversation as resolved.
"ubuntu:jammy",
"debian:11",
"debian:12",
"mcr.microsoft.com/devcontainers/base:ubuntu",
"mcr.microsoft.com/devcontainers/base:debian",
Expand Down
2 changes: 1 addition & 1 deletion src/powershell/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "powershell",
"version": "2.0.1",
"version": "2.0.2",
"name": "PowerShell",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/powershell",
"description": "Installs PowerShell along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",
Expand Down
23 changes: 14 additions & 9 deletions src/powershell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ find_preview_version_from_git_tags() {
local requested_version=${!variable_name}
local repository_url=$2

if [ -z "${googlegit_cmd_name}" ]; then
if [ -z "${git_cmd_name}" ]; then
if type git > /dev/null 2>&1; then
git_cmd_name="git"
else
Expand All @@ -135,22 +135,22 @@ find_preview_version_from_git_tags() {
fi
fi

# Fetch tags from remote repository
# Fetch tags from remote repository (match both -preview.X and -rc.X tags)
local tags
tags=$(git ls-remote --tags "${repository_url}" 2>/dev/null | grep -oP 'refs/tags/v\K[0-9]+\.[0-9]+\.[0-9]+-preview\.[0-9]+' | sort -V)
tags=$(git ls-remote --tags "${repository_url}" 2>/dev/null | grep -oP 'refs/tags/v\K[0-9]+\.[0-9]+\.[0-9]+-(preview|rc)\.[0-9]+' | sort -V)

if [ -z "${tags}" ]; then
echo "No preview tags found in repository."
echo "No preview/rc tags found in repository."
return 1
fi

local version=""

if [ "${requested_version}" = "preview" ] || [ "${requested_version}" = "latest" ]; then
# Get the latest preview version
# Get the latest preview/rc version
version=$(echo "${tags}" | tail -n 1)
elif [[ "${requested_version}" =~ ^[0-9]+\.[0-9]+$ ]]; then
# Partial version provided (e.g., "7.6"), find latest preview matching that major.minor
# Partial version provided (e.g., "7.6"), find latest preview/rc matching that major.minor
version=$(echo "${tags}" | grep "^${requested_version}\." | tail -n 1)
elif [[ "${requested_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-preview$ ]]; then
# Version like "7.6.0-preview" provided, find latest preview for that version
Expand All @@ -161,6 +161,11 @@ find_preview_version_from_git_tags() {
if echo "${tags}" | grep -q "^${requested_version}$"; then
version="${requested_version}"
fi
elif [[ "${requested_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ ]]; then
# Exact RC version provided, verify it exists
if echo "${tags}" | grep -q "^${requested_version}$"; then
version="${requested_version}"
fi
fi

if [ -z "${version}" ]; then
Expand Down Expand Up @@ -382,7 +387,7 @@ install_using_github() {
fi
pwsh_url="https://github.com/PowerShell/PowerShell"
# Check if we need to find a preview version or stable version
if [[ "${POWERSHELL_VERSION}" == *"preview"* ]] || [ "${POWERSHELL_VERSION}" = "preview" ]; then
if [[ "${POWERSHELL_VERSION}" == *"preview"* ]] || [ "${POWERSHELL_VERSION}" = "preview" ] || [[ "${POWERSHELL_VERSION}" == *"-rc."* ]]; then
echo "Finding preview version..."
find_preview_version_from_git_tags POWERSHELL_VERSION "${pwsh_url}"
else
Expand Down Expand Up @@ -446,9 +451,9 @@ if ! type pwsh >/dev/null 2>&1; then
POWERSHELL_ARCHIVE_ARCHITECTURES="${POWERSHELL_ARCHIVE_ARCHITECTURES_ALMALINUX}"
fi

if [[ "${POWERSHELL_ARCHIVE_ARCHITECTURES}" = *"${POWERSHELL_ARCHIVE_ARCHITECTURES_UBUNTU}"* ]] && [[ "${POWERSHELL_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]] && [[ "${POWERSHELL_VERSION}" != *"preview"* ]]; then
if [[ "${POWERSHELL_ARCHIVE_ARCHITECTURES}" = *"${POWERSHELL_ARCHIVE_ARCHITECTURES_UBUNTU}"* ]] && [[ "${POWERSHELL_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]] && [[ "${POWERSHELL_VERSION}" != *"preview"* ]] && [[ "${POWERSHELL_VERSION}" != *"-rc."* ]]; then
install_using_apt || use_github="true"
elif [[ "${POWERSHELL_ARCHIVE_ARCHITECTURES}" = *"${POWERSHELL_ARCHIVE_ARCHITECTURES_ALMALINUX}"* ]] && [[ "${POWERSHELL_VERSION}" != *"preview"* ]]; then
elif [[ "${POWERSHELL_ARCHIVE_ARCHITECTURES}" = *"${POWERSHELL_ARCHIVE_ARCHITECTURES_ALMALINUX}"* ]] && [[ "${POWERSHELL_VERSION}" != *"preview"* ]] && [[ "${POWERSHELL_VERSION}" != *"-rc."* ]]; then
install_using_dnf && install_powershell_dnf || use_github="true"
else
use_github="true"
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/powershell_preview_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source dev-container-features-test-lib

# Test preview version installation
check "pwsh is installed" bash -c "command -v pwsh"
check "pwsh version is preview" bash -c "pwsh --version | grep -i 'preview'"
check "pwsh version is preview" bash -c "pwsh --version | grep -iE 'preview|rc\.[0-9]+'"
check "pwsh can execute basic command" bash -c "pwsh -Command 'Write-Output Hello'"

# Report result
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/powershell_preview_version_almalinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source dev-container-features-test-lib

# Test preview version installation on AlmaLinux
check "pwsh is installed" bash -c "command -v pwsh"
check "pwsh version is preview" bash -c "pwsh --version | grep -i 'preview'"
check "pwsh version is preview" bash -c "pwsh --version | grep -iE 'preview|rc\.[0-9]+'"
check "pwsh can execute basic command" bash -c "pwsh -Command 'Write-Output Hello'"

# Report result
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/powershell_preview_version_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source dev-container-features-test-lib

# Test preview version installation on Debian
check "pwsh is installed" bash -c "command -v pwsh"
check "pwsh version is preview" bash -c "pwsh --version | grep -i 'preview'"
check "pwsh version is preview" bash -c "pwsh --version | grep -iE 'preview|rc\.[0-9]+'"
check "pwsh can execute basic command" bash -c "pwsh -Command 'Write-Output Hello'"

# Report result
Expand Down
Loading