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
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ RUN mkdir /tmp/terraform_env/ && \
cp terraform /usr/local/bin/ && \
rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip

# Install Kubectl
ARG KUBECTL_VERSION=1.29.2
RUN mkdir /tmp/kubectl_env/ && \
cd /tmp/kubectl_env/ && \
curl -LO "https://dl.k8s.io/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \
chmod +x kubectl && \
mv ./kubectl /usr/local/bin/kubectl

# Cleanup
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand Down
5 changes: 5 additions & 0 deletions docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
- https://stackoverflow.com/questions/62154016/docker-on-wsl2-very-slow

- exec /usr/local/bin/kubectl: exec format error
See: https://stackoverflow.com/questions/73398714/docker-fails-when-building-on-m1-macs-exec-usr-local-bin-docker-entrypoint-sh

- Check architecure: dpkg --print-architecture
24 changes: 20 additions & 4 deletions scripts/check_version_in_toolkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare -A tools=(
[python3]="3.11.3"
[ansible]="2.16.4"
[terraform]="1.7.4"
[kubectl]="1.29.2"
# Add more tools as needed
)

Expand All @@ -15,11 +16,26 @@ 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"

# Possible version option flags for different tools
local version_flags=(
"--version"
"version"
)

installed_version=""

# Iterate through possible version flags
for flag in "${version_flags[@]}"; do
installed_version=$(docker run --rm "$image_name" "$tool_name" "$flag" 2>&1)
# Check if the version information is in the output
if echo "$installed_version" | grep -q "$expected_version"; then
break
fi
done

# Compare the installed version with the expected version
if [[ "$installed_version" == *"$expected_version"* ]]; then
if echo "$installed_version" | grep -q "$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"
Expand Down