Skip to content
Open
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 pde2e-image/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FROM base AS linux
ENV OS=linux

FROM linux AS rhel
COPY /lib/unix/scripts/ ${ASSETS_FOLDER}/scripts/
COPY /lib/rhel/ ${ASSETS_FOLDER}/
COPY /lib/unix/ ${ASSETS_FOLDER}/unix/
COPY /common/unix/ ${ASSETS_FOLDER}/unix/common/
Expand Down
22 changes: 22 additions & 0 deletions pde2e-image/lib/rhel/scripts/install_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

echo "Installing Docker Engine on RHEL..."

echo "Installing dnf-plugins-core..."
sudo dnf -y install dnf-plugins-core

echo "Adding Docker CE repository..."
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

echo "Installing Docker Engine packages..."
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

echo "Starting and enabling Docker service..."
sudo systemctl enable --now docker

echo "Adding current user to docker group..."
sudo usermod -aG docker "$(whoami)"

docker --version
echo "Docker Engine installation complete."
16 changes: 16 additions & 0 deletions pde2e-image/lib/unix/scripts/install_podman_compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

echo "Installing podman-compose..."

if sudo dnf install -y podman-compose 2>/dev/null; then
echo "podman-compose installed via dnf."
else
echo "dnf installation failed, falling back to pip..."
sudo dnf install -y python3-pip
pip3 install --user podman-compose
export PATH="$HOME/.local/bin:$PATH"
Comment on lines +11 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

PATH export doesn't persist after script exits.

Line 12 exports PATH to include $HOME/.local/bin, but this only affects the current script session. When the script exits, the parent shell's PATH remains unchanged, making podman-compose unavailable despite successful installation via pip.

The version check at line 15 succeeds within the script's environment, masking this issue.

🔧 Proposed fix to persist PATH changes

Add persistence logic after the pip installation:

     echo "dnf installation failed, falling back to pip..."
     sudo dnf install -y python3-pip
     pip3 install --user podman-compose
-    export PATH="$HOME/.local/bin:$PATH"
+    
+    # Persist PATH for future sessions
+    if ! grep -q '$HOME/.local/bin' "$HOME/.bashrc" 2>/dev/null; then
+        echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
+        echo "Added $HOME/.local/bin to PATH in ~/.bashrc"
+    fi
+    
+    # Update PATH for current and subsequent commands in this script
+    export PATH="$HOME/.local/bin:$PATH"
 fi

Alternatively, document that users must manually add $HOME/.local/bin to their PATH after installation.

📝 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
pip3 install --user podman-compose
export PATH="$HOME/.local/bin:$PATH"
echo "dnf installation failed, falling back to pip..."
sudo dnf install -y python3-pip
pip3 install --user podman-compose
# Persist PATH for future sessions
if ! grep -q '$HOME/.local/bin' "$HOME/.bashrc" 2>/dev/null; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
echo "Added $HOME/.local/bin to PATH in ~/.bashrc"
fi
# Update PATH for current and subsequent commands in this script
export PATH="$HOME/.local/bin:$PATH"
fi
🤖 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 `@pde2e-image/lib/unix/scripts/install_podman_compose.sh` around lines 11 - 12,
The PATH export on line 12 only affects the current script session and does not
persist after the script exits, making podman-compose unavailable in the parent
shell. To fix this, add logic after the pip3 install command to permanently
update the user's shell configuration files (such as .bashrc, .bash_profile, or
.zshrc) to include $HOME/.local/bin in their PATH. Alternatively, if persistence
is not feasible, document in comments or provide clear user guidance that manual
PATH configuration is required after installation.

fi

podman-compose --version
echo "podman-compose installation complete."