Skip to content

Commit 5e830a1

Browse files
Cache openapi-generator JAR outside repo for CI persistence
Move the JAR cache from $SCRIPT_DIR/.cache/ to ~/.cache/openapi-generator/ so it survives fresh checkouts on TeamCity agents. Overridable via OPENAPI_GENERATOR_CACHE_DIR env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 483414b commit 5e830a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

generate-client.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ LOG_FILE="$SCRIPT_DIR/generate-client.log"
9393
exec > >(tee "$LOG_FILE") 2>&1
9494

9595
OPENAPI_GENERATOR_VERSION="7.20.0"
96-
GENERATOR_JAR="$SCRIPT_DIR/.cache/openapi-generator-cli-${OPENAPI_GENERATOR_VERSION}.jar"
96+
GENERATOR_CACHE_DIR="${OPENAPI_GENERATOR_CACHE_DIR:-${HOME}/.cache/openapi-generator}"
97+
GENERATOR_JAR="$GENERATOR_CACHE_DIR/openapi-generator-cli-${OPENAPI_GENERATOR_VERSION}.jar"
9798

9899
if [ ! -f "$GENERATOR_JAR" ]; then
99100
echo "Downloading openapi-generator-cli ${OPENAPI_GENERATOR_VERSION}..."
100-
mkdir -p "$SCRIPT_DIR/.cache"
101+
mkdir -p "$GENERATOR_CACHE_DIR"
101102
curl -fSL -o "$GENERATOR_JAR" \
102103
"https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${OPENAPI_GENERATOR_VERSION}/openapi-generator-cli-${OPENAPI_GENERATOR_VERSION}.jar"
103104
fi

0 commit comments

Comments
 (0)