mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:57:33 +00:00
improve protoc download script
This commit is contained in:
@@ -14,8 +14,9 @@
|
|||||||
"write-translations": "docusaurus write-translations",
|
"write-translations": "docusaurus write-translations",
|
||||||
"write-heading-ids": "docusaurus write-heading-ids",
|
"write-heading-ids": "docusaurus write-heading-ids",
|
||||||
"ensure-plugins": "if [ ! -f \"protoc-gen-connect-openapi/protoc-gen-connect-openapi\" ]; then sh ./plugin-download.sh; fi",
|
"ensure-plugins": "if [ ! -f \"protoc-gen-connect-openapi/protoc-gen-connect-openapi\" ]; then sh ./plugin-download.sh; fi",
|
||||||
|
"debug-plugins": "echo \"PWD: $(pwd)\" && echo \"Plugin file exists: $(test -f protoc-gen-connect-openapi/protoc-gen-connect-openapi && echo 'yes' || echo 'no')\" && echo \"Plugin executable: $(test -x protoc-gen-connect-openapi/protoc-gen-connect-openapi && echo 'yes' || echo 'no')\" && ls -la protoc-gen-connect-openapi/ || echo 'Plugin directory not found'",
|
||||||
"generate": "pnpm run generate:grpc && pnpm run generate:apidocs && pnpm run generate:configdocs",
|
"generate": "pnpm run generate:grpc && pnpm run generate:apidocs && pnpm run generate:configdocs",
|
||||||
"generate:grpc": "buf generate ../proto",
|
"generate:grpc": "pnpm run ensure-plugins && buf generate ../proto",
|
||||||
"generate:apidocs": "docusaurus gen-api-docs all",
|
"generate:apidocs": "docusaurus gen-api-docs all",
|
||||||
"generate:configdocs": "cp -r ../cmd/defaults.yaml ./docs/self-hosting/manage/configure/ && cp -r ../cmd/setup/steps.yaml ./docs/self-hosting/manage/configure/",
|
"generate:configdocs": "cp -r ../cmd/defaults.yaml ./docs/self-hosting/manage/configure/ && cp -r ../cmd/setup/steps.yaml ./docs/self-hosting/manage/configure/",
|
||||||
"generate:re-gen": "yarn generate:clean-all && pnpm generate",
|
"generate:re-gen": "yarn generate:clean-all && pnpm generate",
|
||||||
|
@@ -1,8 +1,28 @@
|
|||||||
echo $(uname -m)
|
#!/bin/bash
|
||||||
mkdir protoc-gen-connect-openapi
|
set -e
|
||||||
|
|
||||||
|
echo "Downloading protoc-gen-connect-openapi plugin..."
|
||||||
|
echo "Architecture: $(uname -m)"
|
||||||
|
echo "OS: $(uname)"
|
||||||
|
|
||||||
|
# Create directory if it doesn't exist
|
||||||
|
mkdir -p protoc-gen-connect-openapi
|
||||||
cd ./protoc-gen-connect-openapi/
|
cd ./protoc-gen-connect-openapi/
|
||||||
|
|
||||||
|
# Skip download if plugin already exists and is executable
|
||||||
|
if [ -f "protoc-gen-connect-openapi" ] && [ -x "protoc-gen-connect-openapi" ]; then
|
||||||
|
echo "Plugin already exists and is executable"
|
||||||
|
./protoc-gen-connect-openapi --version || echo "Plugin version check failed, but file exists"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up any partial downloads
|
||||||
|
rm -f protoc-gen-connect-openapi.tar.gz protoc-gen-connect-openapi
|
||||||
|
|
||||||
|
# Determine download URL based on OS and architecture
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
curl -L -o protoc-gen-connect-openapi.tar.gz https://github.com/sudorandom/protoc-gen-connect-openapi/releases/download/v0.18.0/protoc-gen-connect-openapi_0.18.0_darwin_all.tar.gz
|
echo "Downloading for Darwin..."
|
||||||
|
URL="https://github.com/sudorandom/protoc-gen-connect-openapi/releases/download/v0.18.0/protoc-gen-connect-openapi_0.18.0_darwin_all.tar.gz"
|
||||||
else
|
else
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
@@ -17,6 +37,34 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
curl -L -o protoc-gen-connect-openapi.tar.gz https://github.com/sudorandom/protoc-gen-connect-openapi/releases/download/v0.18.0/protoc-gen-connect-openapi_0.18.0_linux_${ARCH}.tar.gz
|
echo "Downloading for Linux ${ARCH}..."
|
||||||
|
URL="https://github.com/sudorandom/protoc-gen-connect-openapi/releases/download/v0.18.0/protoc-gen-connect-openapi_0.18.0_linux_${ARCH}.tar.gz"
|
||||||
fi
|
fi
|
||||||
tar -xvf protoc-gen-connect-openapi.tar.gz
|
|
||||||
|
# Download with retries
|
||||||
|
echo "Downloading from: $URL"
|
||||||
|
curl -L -o protoc-gen-connect-openapi.tar.gz "$URL" || {
|
||||||
|
echo "Download failed, trying with different curl options..."
|
||||||
|
curl -L --fail --retry 3 --retry-delay 1 -o protoc-gen-connect-openapi.tar.gz "$URL"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Extracting plugin..."
|
||||||
|
tar -xzf protoc-gen-connect-openapi.tar.gz
|
||||||
|
|
||||||
|
# Verify extraction
|
||||||
|
if [ ! -f "protoc-gen-connect-openapi" ]; then
|
||||||
|
echo "ERROR: Plugin binary not found after extraction"
|
||||||
|
ls -la
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure the plugin is executable
|
||||||
|
chmod +x protoc-gen-connect-openapi
|
||||||
|
|
||||||
|
# Verify plugin works
|
||||||
|
echo "Plugin installed successfully"
|
||||||
|
ls -la protoc-gen-connect-openapi
|
||||||
|
./protoc-gen-connect-openapi --version || echo "Plugin version check failed, but installation completed"
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -f protoc-gen-connect-openapi.tar.gz
|
Reference in New Issue
Block a user