Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generate and use swagger typescript client [DET-3249 DET-3324 DET-3355] #691

Merged
merged 6 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 71 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ upstream-feature-branch: &upstream-feature-branch
- /release-.*/
- master


commands:
fix-circle-working-directory:
description: "Fix CIRCLE_WORKING_DIRECTORY"
steps:
- run: echo 'CIRCLE_WORKING_DIRECTORY="${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}"' >> $BASH_ENV


set-slack-user-id:
steps:
- run:
Expand All @@ -86,7 +84,6 @@ commands:
echo "Unable to find Slack user ID for \"${AUTHOR_EMAIL}\"."
fi


pull-task-images:
parameters:
tf1:
Expand Down Expand Up @@ -157,6 +154,10 @@ commands:
key: det-react-deps-v1dev3-{{ checksum "webui/react/package-lock.json" }}
paths:
- "webui/react/node_modules"
- attach_workspace:
at: .
- run: make -C webui/api-ts-sdk get-deps-package
- run: make -C webui/api-ts-sdk build-package

install-wheel:
parameters:
Expand Down Expand Up @@ -342,7 +343,6 @@ commands:
det-deploy aws down \
--cluster-id <<parameters.cluster-id>>


setup-aws-cluster:
parameters:
cluster-id:
Expand Down Expand Up @@ -392,7 +392,6 @@ commands:
make -C webui/tests get-deps
- run: docker pull cypress/included:4.8.0


setup-local-cluster:
parameters:
det-version:
Expand Down Expand Up @@ -448,7 +447,6 @@ commands:
steps:
- run: python .circleci/scripts/wait_for_master.py http://<<parameters.host>>:<<parameters.port>>


jobs:
build-docs:
docker:
Expand Down Expand Up @@ -575,6 +573,20 @@ jobs:
- run: make -C <<parameters.path>> build
- run: make -C <<parameters.path>> publish

build-and-package-ts-sdk:
docker:
- image: cimg/openjdk:14.0.1
steps:
- checkout
- attach_workspace:
at: .
- run: make -C webui/api-ts-sdk get-deps-swagger
- run: make -C webui/api-ts-sdk build-swagger
- persist_to_workspace:
root: .
paths:
- webui/api-ts-sdk/src

upload-try-now-template:
docker:
- image: determinedai/cimg-base:stable
Expand Down Expand Up @@ -629,8 +641,6 @@ jobs:
- store_artifacts:
path: webui/tests/results/recordings



lint-elm:
docker:
- image: cimg/node:12.16
Expand Down Expand Up @@ -659,8 +669,6 @@ jobs:
- elm-get-deps
- run: make -C webui/elm test



lint-react:
docker:
- image: cimg/node:12.16
Expand Down Expand Up @@ -699,7 +707,6 @@ jobs:
- store_artifacts:
path: webui/react/build-storybook


lint-go:
docker:
- image: cimg/go:1.13
Expand Down Expand Up @@ -730,6 +737,20 @@ jobs:
- "master/build"
- "agent/build"

build-proto:
docker:
- image: cimg/go:1.13
environment:
GO111MODULE: "on"
steps:
- checkout
- go-get-deps
- run: make -C proto build
- persist_to_workspace:
root: .
paths:
- "proto/build/**/*"

test-unit-go:
docker:
- image: cimg/go:1.13
Expand All @@ -742,9 +763,6 @@ jobs:
- run: make -C master test
- run: make -C agent test




lint-python:
docker:
- image: determinedai/cimg-base:stable
Expand Down Expand Up @@ -869,7 +887,6 @@ jobs:
- store_test_results:
path: /tmp/test-results/


deploy:
parameters:
agent-instance-type:
Expand Down Expand Up @@ -897,7 +914,6 @@ jobs:
failure_message: ':thisisfine: A \`${CIRCLE_JOB}\` job on branch \`${CIRCLE_BRANCH}\` has failed! Author Email: \`${AUTHOR_EMAIL}\`'
mentions: "${SLACK_USER_ID}"


nightly-tests:
docker:
- image: determinedai/cimg-base:stable
Expand Down Expand Up @@ -959,8 +975,6 @@ jobs:
failure_message: ':thisisfine: A \`${CIRCLE_JOB}\` job on branch \`${CIRCLE_BRANCH}\` has failed! Author Email: \`${AUTHOR_EMAIL}\`'
mentions: "${SLACK_USER_ID}"



parallel-tests:
docker:
- image: determinedai/cimg-base:stable
Expand Down Expand Up @@ -993,38 +1007,62 @@ jobs:
failure_message: ':thisisfine: A \`${CIRCLE_JOB}\` job on branch \`${CIRCLE_BRANCH}\` has failed! Author Email: \`${AUTHOR_EMAIL}\`'
mentions: "${SLACK_USER_ID}"




workflows:
lint:
jobs:
- build-proto
- build-and-package-ts-sdk:
requires:
- build-proto
- lint-python
- lint-go
- lint-elm
- lint-react
- lint-react:
requires:
- build-and-package-ts-sdk

test-cli:
jobs:
- test-cli:
matrix:
parameters:
executor-name: ["python-35", "python-36", "python-37", "python-38", "win/default"]
executor-name:
[
"python-35",
"python-36",
"python-37",
"python-38",
"win/default",
]

test-unit:
jobs:
- test-unit-go
- build-proto
- build-and-package-ts-sdk:
requires:
- build-proto
- test-unit-elm
- test-unit-react
- test-unit-react:
requires:
- build-and-package-ts-sdk
- test-unit-harness
- test-unit-harness-tf2
- test-examples

test-e2e:
jobs:
- build-elm
- build-react
- build-storybook
- build-proto
- build-and-package-ts-sdk:
requires:
- build-proto
- build-react:
requires:
- build-and-package-ts-sdk
- build-storybook:
requires:
- build-and-package-ts-sdk
- build-docs
- build-go
- package-and-push-system-local:
Expand Down Expand Up @@ -1079,6 +1117,7 @@ workflows:

- test-e2e-webui:
requires:
- build-and-package-ts-sdk
- package-and-push-system-local

- deploy:
Expand Down Expand Up @@ -1149,7 +1188,6 @@ workflows:
- request-gpu-tests
- package-and-push-system-dev


nightly:
triggers:
- schedule:
Expand All @@ -1164,10 +1202,16 @@ workflows:

release:
jobs:
- build-proto
- build-and-package-ts-sdk:
requires:
- build-proto
- build-elm:
context: determined-production
filters: *release-and-rc-filters
- build-react:
requires:
- build-and-package-ts-sdk
context: determined-production
filters: *release-and-rc-filters
- build-docs:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ git clone [email protected]:determined-ai/determined.git
- Go (>= 1.13)
- Python (>= 3.6)
- Node (>= 12)
- Yarn (>= 1.22.0)
- Docker (>= 19.03)
- Protoc (>= 3.0)
- Java (>= 7)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Do we need to announce in engineering once this lands that they need to update? Is this just if you want to work on the front-end?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm needed by anyone that needs to build the npm package, publish it, or otherwise use it so for the time being mostly anyone working touching the frontend or wanting to run frontend tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please announce in #engineering once this lands. Thanks!


### Building Determined

Expand Down
1 change: 1 addition & 0 deletions webui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ check:
$(MAKE) -C tests $@

get-deps:
$(MAKE) -C api-ts-sdk $@ build
$(MAKE) -C react $@
$(MAKE) -C elm $@
$(MAKE) -C tests $@
Expand Down
4 changes: 4 additions & 0 deletions webui/api-ts-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
deps/
src/
hamidzr marked this conversation as resolved.
Show resolved Hide resolved
lib/
37 changes: 37 additions & 0 deletions webui/api-ts-sdk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PROJECT_ROOT := "../.."

.PHONY: get-deps-swagger
get-deps-swagger:
mkdir -p deps
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.14/swagger-codegen-cli-2.4.14.jar \
-O deps/swagger-codegen-cli.jar

.PHONY: get-deps-package
get-deps-package:
npm ci --no-audit

.PHONY: build-swagger
build-swagger:
mkdir -p src
java -jar deps/swagger-codegen-cli.jar generate -i \
${PROJECT_ROOT}/proto/build/swagger/determined/api/v1/api.swagger.json \
-l typescript-fetch -o src/

.PHONY: build-package
build-package:
# depends on build-swagger
npm run build

.PHONY: get-deps
get-deps: get-deps-swagger get-deps-package

.PHONY: build
build: build-swagger
$(MAKE) build-package

.PHONY: clean
clean:
rm -r deps/ || true
rm -r node_modules/ || true
rm -r src/ || true
rm -r lib/ || true
Binary file added webui/api-ts-sdk/deps/swagger-codegen-cli.jar
Binary file not shown.
63 changes: 63 additions & 0 deletions webui/api-ts-sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading