forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* scripts: tidy and fix shebangs Signed-off-by: Isabella do Amaral <[email protected]> * Makefile: restore staged file check on server rebuild Signed-off-by: Isabella do Amaral <[email protected]> --------- Signed-off-by: Isabella do Amaral <[email protected]>
- Loading branch information
Showing
5 changed files
with
71 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
echo "Generating the OpenAPI server" | ||
|
||
ROOT_FOLDER="${ROOT_FOLDER:-..}" | ||
PROJECT_ROOT=$(realpath "$(dirname "$0")"/..) | ||
|
||
openapi-generator-cli generate \ | ||
-i $ROOT_FOLDER/api/openapi/model-registry.yaml -g go-server -o $ROOT_FOLDER/internal/server/openapi --package-name openapi --global-property models,apis \ | ||
--ignore-file-override $ROOT_FOLDER/.openapi-generator-ignore --additional-properties=outputAsLibrary=true,enumClassPrefix=true,router=chi,sourceFolder=,onlyInterfaces=true,isGoSubmodule=true,enumClassPrefix=true,useOneOfDiscriminatorLookup=true \ | ||
--template-dir $ROOT_FOLDER/templates/go-server | ||
-i "$PROJECT_ROOT"/api/openapi/model-registry.yaml -g go-server -o "$PROJECT_ROOT"/internal/server/openapi --package-name openapi --global-property models,apis \ | ||
--ignore-file-override "$PROJECT_ROOT"/.openapi-generator-ignore --additional-properties=outputAsLibrary=true,enumClassPrefix=true,router=chi,sourceFolder=,onlyInterfaces=true,isGoSubmodule=true,enumClassPrefix=true,useOneOfDiscriminatorLookup=true \ | ||
--template-dir "$PROJECT_ROOT"/templates/go-server | ||
|
||
if [[ $(uname) == "Darwin" ]]; then | ||
# introduce -i parameter for Mac OSX sed compatibility | ||
sed -i '' 's/, orderByParam/, model.OrderByField(orderByParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go | ||
sed -i '' 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go | ||
# introduce -i parameter for Mac OSX sed compatibility | ||
sed -i '' 's/, orderByParam/, model.OrderByField(orderByParam)/g' "$PROJECT_ROOT"/internal/server/openapi/api_model_registry_service.go | ||
sed -i '' 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' "$PROJECT_ROOT"/internal/server/openapi/api_model_registry_service.go | ||
else | ||
sed -i 's/, orderByParam/, model.OrderByField(orderByParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go | ||
sed -i 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go | ||
sed -i 's/, orderByParam/, model.OrderByField(orderByParam)/g' "$PROJECT_ROOT"/internal/server/openapi/api_model_registry_service.go | ||
sed -i 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' "$PROJECT_ROOT"/internal/server/openapi/api_model_registry_service.go | ||
fi | ||
|
||
echo "Assembling type_assert Go file" | ||
./scripts/gen_type_asserts.sh | ||
|
||
gofmt -w $ROOT_FOLDER/internal/server/openapi | ||
gofmt -w "$PROJECT_ROOT"/internal/server/openapi | ||
|
||
echo "OpenAPI server generation completed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#! /bin/bash | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
SCRIPT_PARENT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd ) | ||
|
||
VERSION="24.3" | ||
OSTYPE=$(uname -s) | ||
OS="linux" | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# Mac OSX | ||
OS="osx" | ||
if [[ ${OSTYPE,,} =~ darwin ]]; then | ||
OS="osx" | ||
fi | ||
|
||
ARCH="x86_64" | ||
if [[ "$(uname -m)" == "arm"* ]]; then | ||
ARCH="aarch_64" | ||
if [[ $(uname -m) =~ arm ]]; then | ||
ARCH="aarch_64" | ||
fi | ||
|
||
mkdir -p ${SCRIPT_PARENT_DIR}/bin | ||
PROJECT_ROOT=$(realpath "$(dirname "$0")"/..) | ||
|
||
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-${OS}-${ARCH}.zip -O ${SCRIPT_PARENT_DIR}/protoc.zip && \ | ||
unzip -qo ${SCRIPT_PARENT_DIR}/protoc.zip -d ${SCRIPT_PARENT_DIR} && \ | ||
bin/protoc --version && \ | ||
rm ${SCRIPT_PARENT_DIR}/protoc.zip | ||
VERSION="24.3" | ||
URL=https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-${OS}-${ARCH}.zip | ||
wget -qx "$URL" -O "$PROJECT_ROOT"/protoc.zip && | ||
unzip -qo "$PROJECT_ROOT"/protoc.zip -d "$PROJECT_ROOT" && | ||
"$PROJECT_ROOT"/bin/protoc --version && | ||
rm "$PROJECT_ROOT"/protoc.zip |