Skip to content

Commit 0490392

Browse files
committed
added docker install so gen-sdk script can use docker
1 parent a4bd93a commit 0490392

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

hack/python-sdk/gen-sdk.sh

+21-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,28 @@ echo "Removing previously generated files ..."
4242
rm -rf "${SDK_OUTPUT_PATH}"/docs/V1*.md "${SDK_OUTPUT_PATH}"/jobset/models "${SDK_OUTPUT_PATH}"/test/test_*.py
4343

4444
echo "Generating Python SDK for JobSet..."
45+
46+
47+
# Defaults the container engine to docker
48+
CONTAINER_ENGINE=${CONTAINER_ENGINE:-docker}
49+
# Checking if docker / podman is installed
50+
if ! { [ $(command -v docker &> /dev/null) ] && [ $(command -v podman &> /dev/null) ] }; then
51+
# Install docker
52+
echo "Both Podman and Docker is not installed"
53+
echo "Installing Docker now (Version 17.03.0)"
54+
# Defaulting to 17.03.0
55+
wget https://download.docker.com/linux/static/stable/x86_64/docker-17.03.0-ce.tgz
56+
tar xzvf docker-17.03.0-ce.tgz
57+
echo "Starting dockerd"
58+
./docker/dockerd &
59+
elif [ `command -v podman &> /dev/null` ]; then
60+
echo "Found that Podman is installed, using that now"
61+
CONTAINER_ENGINE="podman"
62+
fi
63+
4564
# Install the sdk using docker
46-
docker run --rm \
47-
# Hooking up the whole repo onto the local folder
48-
-v "${repo_root}":/local openapitools/openapi-generator-cli generate \
65+
${CONTAINER_ENGINE} run --rm \
66+
-v docker.io/"${repo_root}":/local openapitools/openapi-generator-cli generate \
4967
-i /local/${SWAGGER_CODEGEN_FILE} \
5068
-g python \
5169
-o /local/"${SDK_OUTPUT_PATH}" \

0 commit comments

Comments
 (0)