Skip to content

Commit

Permalink
fix: Pipeline readiness fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Saunders <[email protected]>
  • Loading branch information
pms1969 committed Oct 2, 2023
1 parent 84ebc30 commit 786dc00
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM rust:latest as rust
FROM rust:slim-buster as rust

RUN cargo install just

FROM openapitools/openapi-generator-cli:latest-release as maven
FROM openapitools/openapi-generator-cli:v7.0.0 as maven

RUN apt update && apt -y install jq git
RUN apt update && apt -y install jq git gettext-base libicu-dev
# need to install the following for python
RUN apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev liblzma-dev \
&& cd tmp \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.cicd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM rust:slim-buster as rust

RUN cargo install just

FROM openapitools/openapi-generator-cli:latest-release as maven
FROM openapitools/openapi-generator-cli:v7.0.0 as maven

RUN apt update && apt -y install jq git gettext-base
RUN apt update && apt -y install jq git gettext-base libicu-dev
# need to install the following for python
RUN apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev liblzma-dev \
&& cd tmp \
Expand Down
2 changes: 2 additions & 0 deletions generate/config-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"licenseInfo": "MIT",
"datetimeFormat": "%Y-%m-%dT%H:%M:%S.%fZ",
"isLusidPackage": true,
"gitUserId": "${GIT_USER_ID}",
"gitRepoId": "${GIT_REPO_ID}",
"files": {
"extensions/api_client_builder.mustache": {
"destinationFilename": "${PACKAGE_NAME}/extensions/api_client_builder.py"
Expand Down
2 changes: 1 addition & 1 deletion generate/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ echo "[INFO] generating sdk version: ${PACKAGE_VERSION}"
# generate the SDK
java ${JAVA_OPTS} -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i $sdk_output_folder/swagger.json \
-g python-nextgen \
-g python \
-o $sdk_output_folder \
-t $gen_root/templates \
-c $config_file
Expand Down
26 changes: 22 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,41 @@ generate TARGET_DIR:

cp -R generate/.output/* {{TARGET_DIR}}

# Generate an SDK from a swagger.json and copy the output to the TARGET_DIR
generate-cicd TARGET_DIR:
mkdir -p {{TARGET_DIR}}
mkdir -p ./generate/.output
envsubst < generate/config-template.json > generate/.config.json
cp ./generate/.openapi-generator-ignore ./generate/.output/.openapi-generator-ignore

./generate/generate.sh ./generate ./generate/.output {{swagger_path}} .config.json
rm -f generate/.output/.openapi-generator-ignore

# need to remove the created content before copying over the top of it.
# this prevents deleted content from hanging around indefinitely.
rm -rf {{TARGET_DIR}}/sdk/${PACKAGE_NAME}
rm -rf {{TARGET_DIR}}/sdk/docs

cp -R generate/.output/. {{TARGET_DIR}}
echo "copied output to {{TARGET_DIR}}"
ls {{TARGET_DIR}}

publish-only-local:
docker run \
-v $(pwd)/generate/.output:/usr/src \
finbourne/lusid-sdk-gen-python:latest -- "cd sdk; poetry build"
finbourne/lusid-sdk-gen-python:latest -- bash -ce "cd sdk; poetry build"
mkdir -p ${PYPI_PACKAGE_LOCATION}
cp generate/.output/sdk/dist/* ${PYPI_PACKAGE_LOCATION}

publish-only:
docker run \
-e POETRY_PYPI_TOKEN_PYPI:${PYPI_TOKEN} \
-v $(pwd)/generate/.output:/usr/src \
finbourne/lusid-sdk-gen-python:latest -- "cd sdk; poetry publish"
finbourne/lusid-sdk-gen-python:latest -- bash -ce "cd sdk; poetry publish"

publish-cicd SRC_DIR:
echo "PACKAGE_VERSION to publish: ${PACKAGE_VERSION}"
cd {{SRC_DIR}}/sdk
poetry publish
poetry publish --build --repository ${REPOSITORY_NAME} --directory {{SRC_DIR}}/sdk

publish-to SRC_DIR OUT_DIR:
echo "PACKAGE_VERSION to publish: ${PACKAGE_VERSION}"
Expand Down

0 comments on commit 786dc00

Please sign in to comment.