Skip to content
Merged
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
37 changes: 37 additions & 0 deletions scripts/check_version_in_toolkit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

image_name=$1

# Define the tools and their expected versions
declare -A tools=(
[python3]="3.11.3"
[ansible]="2.16.4"
[terraform]="1.7.4"
# Add more tools as needed
)

# Function to check tool versions
check_tool_version() {
local tool_name=$1
local expected_version=$2
echo "[$tool_name] Checking version..."
# Get the installed version
installed_version=$(docker run --rm $image_name $tool_name --version)
echo "$installed_version"
# Compare the installed version with the expected version
if [[ "$installed_version" == *"$expected_version"* ]]; then
echo "[OK] $tool_name version is correct: $installed_version"
else
echo "[Error] Incorrect $tool_name version. Expected $expected_version but found $installed_version"
exit 1
fi
}

# Loop through the tools and check their versions
for tool in "${!tools[@]}"; do
check_tool_version "$tool" "${tools[$tool]}"
echo ""
done

# If all checks pass, print success message
echo "All tools in $image_name are correctly installed and have the expected versions."