Skip to content

Commit 9aa99e1

Browse files
authored
chore: use consistent working directory for all containers (#44)
This updates the openapi-generator commands so that the mounting location and working directory for the openapi-generator container are consistent with our other containers. This removes the need to prefix repository file paths with `/local/` for commands that run inside the openapi-generator container.
2 parents 311f3ea + 43756ed commit 9aa99e1

4 files changed

Lines changed: 19 additions & 19 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ USER_AGENT=${GIT_REPO}/${PACKAGE_VERSION}
1111
OPENAPI_IMAGE_TAG=v7.10.0
1212
OPENAPI_IMAGE=openapitools/openapi-generator-cli:${OPENAPI_IMAGE_TAG}
1313
CRI=docker # nerdctl
14-
OPENAPI_GENERATOR=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/local ${OPENAPI_IMAGE}
14+
OPENAPI_GENERATOR=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/workdir -w /workdir ${OPENAPI_IMAGE}
1515
SPEC_FETCHER=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/workdir --entrypoint sh mikefarah/yq:4.30.8 script/download_spec.sh
1616

1717
SPEC_BASE_DIR=spec/services

Makefile.fabricv4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ codegen:
4848
-p packageVersion=${PACKAGE_VERSION} \
4949
--git-user-id ${GIT_ORG} \
5050
--git-repo-id ${GIT_REPO} \
51-
-c /local/config/openapi-generator.json \
52-
-t /local/${TEMPLATE_DIR} \
53-
-o /local/ \
54-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
51+
-c config/openapi-generator.json \
52+
-t ${TEMPLATE_DIR} \
53+
-o . \
54+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
5555

5656
validate:
5757
${OPENAPI_GENERATOR} validate \
5858
--recommend \
59-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
59+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}

Makefile.metalv1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ patch:
3232
# to use v7.4.0 of openapi-generator to merge the
3333
# spec in order to avoid introducing duplicate models
3434
${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} \
35-
-v $(CURDIR):/local \
35+
-v $(CURDIR):/workdir -w /workdir \
3636
openapitools/openapi-generator-cli:v7.4.0 \
3737
generate \
38-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE} \
38+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE} \
3939
-g openapi-yaml \
4040
-p skipOperationExample=true -p outputFile=${SPEC_ROOT_FILE} \
41-
-o /local/${SPEC_PATCHED_DIR}
41+
-o ${SPEC_PATCHED_DIR}
4242

4343
rm -rf ${SPEC_PATCHED_DIR}/.openapi-generator* \
4444
${SPEC_PATCHED_DIR}/README.md \
@@ -68,14 +68,14 @@ codegen:
6868
--git-user-id ${GIT_ORG} \
6969
--git-repo-id ${GIT_REPO} \
7070
`# TODO: re-enable the config file option so that generated code follows OpenAPI standards; this is only disabled to provide an upgrade path for metal-python` \
71-
`# -c /local/config/openapi-generator.json` \
71+
`# -c config/openapi-generator.json` \
7272
`# TODO: remove this when the config file is re-enabled` \
7373
-p generateSourceCodeOnly=true \
74-
-t /local/${TEMPLATE_DIR} \
75-
-o /local/ \
76-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
74+
-t ${TEMPLATE_DIR} \
75+
-o . \
76+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
7777

7878
validate:
7979
${OPENAPI_GENERATOR} validate \
8080
--recommend \
81-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
81+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}

templates/Makefile.sdk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ codegen:
4747
-p packageVersion=${PACKAGE_VERSION} \
4848
--git-user-id ${GIT_ORG} \
4949
--git-repo-id ${GIT_REPO} \
50-
-c /local/config/openapi-generator.json \
51-
-t /local/${TEMPLATE_DIR} \
52-
-o /local/ \
53-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
50+
-c config/openapi-generator.json \
51+
-t ${TEMPLATE_DIR} \
52+
-o . \
53+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
5454

5555
validate:
5656
${OPENAPI_GENERATOR} validate \
5757
--recommend \
58-
-i /local/${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}
58+
-i ${SPEC_PATCHED_DIR}/${SPEC_ROOT_FILE}

0 commit comments

Comments
 (0)