Skip to content
Merged
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ POSTGRESQL_CLIENT_VERSION=18

# Programming languages
DOTNET_VERSION=10.0.201
POWERSHELL_VERSION=v7.6.4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

line="$(rg -n -m1 '^[[:space:]]*POWERSHELL_VERSION=' .env.example | cut -d: -f1)"
start=$((line > 5 ? line - 5 : 1))
sed -n "${start},${line}p" .env.example

Repository: Taegost/DevOps-Toolbox

Length of output: 283


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "--- .env.example around PowerShell ---"
line="$(rg -n -m1 '^[[:space:]]*POWERSHELL_VERSION=' .env.example | cut -d: -f1)"
start=$((line > 8 ? line - 8 : 1))
sed -n "${start},${line}p" .env.example

echo "--- Dockerfile PowerShell references ---"
if [ -f Dockerfile ]; then
  rg -n -C3 'POWERSHELL|powershell|Powershell' Dockerfile || true
fi
if [ -f docker-compose.yml ]; then
  rg -n -C2 'POWERSHELL|powershell|Powershell' docker-compose.yml || true
fi

Repository: Taegost/DevOps-Toolbox

Length of output: 1154


Add the release-page comment above POWERSHELL_VERSION.

.env.example currently only tags this entry under # Programming languages, but the guideline requires a link to the release page for each tool version. Add a short comment above this line pointing to the PowerShell release page.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.env.example at line 55, Add a short release-page URL comment immediately
above the POWERSHELL_VERSION entry in .env.example, while preserving the
existing Programming languages categorization and version value.

Source: Coding guidelines

PYTHON_VERSION=3.12
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ RUN curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV DOTNET_NOLOGO=1

# -----------------------------------------------------------------------------
# PowerShell
# Cross-platform shell and scripting language built on .NET.
# Installed via Microsoft GitHub releases for exact version pinning.
# PowerShell uses x64/arm64 naming — maps from TARGETARCH with a remap
# for amd64 (PowerShell calls it x64).
# URL: https://github.com/PowerShell/PowerShell
# -----------------------------------------------------------------------------
ARG POWERSHELL_VERSION=v7.6.4

RUN PS_ARCH=$([ "${TARGETARCH}" = "arm64" ] && echo "arm64" || echo "x64") \
&& curl -fsSL \
"https://github.com/PowerShell/PowerShell/releases/download/${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION#v}-linux-${PS_ARCH}.tar.gz" \
-o /tmp/powershell.tar.gz \
&& mkdir -p /usr/local/pwsh \
&& tar -xzf /tmp/powershell.tar.gz -C /usr/local/pwsh \
&& rm /tmp/powershell.tar.gz \
&& ln -s /usr/local/pwsh/pwsh /usr/local/bin/pwsh \
&& pwsh --version
Comment on lines +127 to +130

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Dockerfile relevant section =="
sed -n '100,140p' Dockerfile | cat -n

echo
echo "== PowerShell archive entries in local files, if present =="
python3 - <<'PY'
import tarfile, glob, os, zipfile, pathlib
for p in pathlib.Path('.').rglob('*.tar.gz'):
    if 'powershell' in p.name.lower():
        print(f"\n{T}--- {p}")
        try:
            with tarfile.open(p, 'r:gz') as tf:
                for m in tf.getmembers():
                    if os.path.basename(m.name) in {'pwsh'} or any(part in {'pwsh'} for part in m.name.split('/')[max(0, len(m.name.split('/'))-3):]):
                        print(m.name, oct(m.mode), "dir?" if m.isdir() else "executable?" if m.isreg() else "other", stat.S_ISEXEC(m.mode) if m.isreg() else None)
        except Exception as e:
            print("ERR", e)
PY

echo
echo "== Repository references to pwsh/powershell =="
rg -n "pwsh|powershell|chmod|TARGETARCH|uname -m" Dockerfile Dockerfile* dependencies .github 2>/dev/null || true

echo
echo "== GitHub tag artifact entry modes if available =="
python3 - <<'PY'
import sys, urllib.request, json, tarfile, gzip, io, re
tag = "7.6.4"
prefixes = ["powershell/7.6.4/", ""]
names = [f"powershell-{tag}-linux-{arch}.tar.gz" for arch in ["x64","amd64","arm64"]]
print(f"Tag: {tag}")
for name in names:
    url=f"https://github.com/PowerShell/PowerShell/releases/download/v{tag}/{name}"
    print(f"\n-- {name} -- URL: {url}")
    try:
        with urllib.request.urlopen(url, timeout=20) as r:
            data=r.read(2_097_152)
        tf=tarfile.open(fileobj=io.BytesIO(data), mode='r:gz')
        matches=[]
        for m in tf.getmembers():
            if os.path.basename(m.name) == 'pwsh':
                matches.append((m.name, oct(m.mode), m.isreg()))
        for mm in matches[:5]:
            print(mm)
    except Exception as e:
        print("ERR", type(e).__name__, e)
PY

Repository: Taegost/DevOps-Toolbox

Length of output: 13640


🌐 Web query:

PowerShell 7.6.4 Linux tarball archive permissions pwsh executable tar -xzf chmod instructions

💡 Result:

When installing PowerShell 7.6.4 on Linux using the tarball archive, you must manually set the executable permission bit on the pwsh binary after extraction [1][2][3]. While recent efforts have been made to address historical permission inconsistencies in Linux releases [4][5], the official Microsoft documentation continues to explicitly include a chmod instruction as part of the standard manual installation procedure [1][2][3]. To install PowerShell 7.6.4 and set the correct permissions, follow these steps: 1. Download the appropriate tar.gz archive for your Linux distribution and architecture (e.g., x64, arm64) from the official PowerShell GitHub releases page [1][3][6]. 2. Create a target directory (typically /opt/microsoft/powershell/7) and extract the archive into it [1][2][3]: sudo mkdir -p /opt/microsoft/powershell/7 sudo tar zxf /path/to/powershell-7.6.4-linux-x64.tar.gz -C /opt/microsoft/powershell/7 3. Set the required execute permissions on the pwsh executable [1][2][3]: sudo chmod +x /opt/microsoft/powershell/7/pwsh 4. Optionally, create a symbolic link to make pwsh accessible globally in your PATH [1][2][3]: sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh If you encounter issues where tab completion or other features fail to run, some users have reported needing to apply executable permissions to other files (such as.dll files) in the directory [7][8], although this is generally not required for the basic functionality of the pwsh binary itself [4][5]. Always prioritize using your distribution's native package repository (e.g., via apt, dnf, or yum) if possible, as these methods handle permissions automatically [9][10].

Citations:


Set execute permission after extracting PowerShell.

Extract the archive before running pwsh --version, then set execute permission on /usr/local/pwsh/pwsh. Official PowerShell Linux tarball installation includes the chmod +x pwsh step before creating the symlink.

Proposed fix
    && tar -xzf /tmp/powershell.tar.gz -C /usr/local/pwsh \
+   && chmod +x /usr/local/pwsh/pwsh \
    && rm /tmp/powershell.tar.gz \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
&& tar -xzf /tmp/powershell.tar.gz -C /usr/local/pwsh \
&& rm /tmp/powershell.tar.gz \
&& ln -s /usr/local/pwsh/pwsh /usr/local/bin/pwsh \
&& pwsh --version
&& tar -xzf /tmp/powershell.tar.gz -C /usr/local/pwsh \
&& chmod +x /usr/local/pwsh/pwsh \
&& rm /tmp/powershell.tar.gz \
&& ln -s /usr/local/pwsh/pwsh /usr/local/bin/pwsh \
&& pwsh --version
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 127 - 130, Update the PowerShell installation
command chain around pwsh --version to run chmod +x /usr/local/pwsh/pwsh
immediately after extracting the archive and before creating the symlink or
invoking the version check.


# -----------------------------------------------------------------------------
# gcloud CLI (Google Cloud SDK)
# Installed via Google's versioned archive for exact version pinning.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ with Docker and VS Code — no local setup required.
| [Ansible](https://www.ansible.com) | See [Dockerfile](./Dockerfile) | Configuration management and automation |
| [.NET SDK](https://dotnet.microsoft.com) | See [Dockerfile](./Dockerfile) | .NET development |
| [Python](https://www.python.org) | See [Dockerfile](./Dockerfile) | Scripting and development |
| [PowerShell](https://github.com/PowerShell/PowerShell) | See [Dockerfile](./Dockerfile) | Cross-platform shell and scripting |
| [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/) | See [Dockerfile](./Dockerfile) | Azure resource management |
| [gcloud CLI](https://cloud.google.com/sdk/gcloud) | See [Dockerfile](./Dockerfile) | Google Cloud resource management |
| [GitHub CLI](https://cli.github.com) | See [Dockerfile](./Dockerfile) | GitHub workflow management |
Expand Down