Skip to content

Commit

Permalink
Run openapi-generator as "current" user, not root. (apache#13674)
Browse files Browse the repository at this point in the history
This tool will happily run without the user existing in the passwd
files, and by running as this user we don't have a lot of files owned by
root left hanging around.

Additionally, only reset the _spec_ file, not the entire repo
  • Loading branch information
ashb authored Jan 14, 2021
1 parent 2909c38 commit 911c7ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions clients/gen/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function gen_client {
lang=$1
shift
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "${SPEC_PATH}:/spec" \
-v "${OUTPUT_DIR}:/output" \
openapitools/openapi-generator-cli:v${OPENAPI_GENERATOR_CLI_VER} \
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/openapi/client_codegen_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mkdir -p "${GO_CLIENT_PATH}"
# generate client for target patch
mkdir -p "${GO_TARGET_CLIENT_PATH}"

git reset --hard "${previous_mainline_commit}"
git checkout "${previous_mainline_commit}" -- "$SPEC_FILE"
./clients/gen/go.sh "${SPEC_FILE}" "${GO_TARGET_CLIENT_PATH}"

diff -u "${GO_TARGET_CLIENT_PATH}" "${GO_CLIENT_PATH}" || true

0 comments on commit 911c7ae

Please sign in to comment.