You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by as...@apache.org on 2021/01/14 15:16:27 UTC

[airflow] branch master updated: Run openapi-generator as "current" user, not root. (#13674)

This is an automated email from the ASF dual-hosted git repository.

ash pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 911c7ae  Run openapi-generator as "current" user, not root. (#13674)
911c7ae is described below

commit 911c7aed81f924155d7ef4490e097e20cb68cd5a
Author: Ash Berlin-Taylor <as...@firemirror.com>
AuthorDate: Thu Jan 14 15:16:12 2021 +0000

    Run openapi-generator as "current" user, not root. (#13674)
    
    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
---
 clients/gen/common.sh                     | 1 +
 scripts/ci/openapi/client_codegen_diff.sh | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/clients/gen/common.sh b/clients/gen/common.sh
index 2e61229..dbd87cf 100755
--- a/clients/gen/common.sh
+++ b/clients/gen/common.sh
@@ -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} \
diff --git a/scripts/ci/openapi/client_codegen_diff.sh b/scripts/ci/openapi/client_codegen_diff.sh
index 27881aa..8e62ab3 100755
--- a/scripts/ci/openapi/client_codegen_diff.sh
+++ b/scripts/ci/openapi/client_codegen_diff.sh
@@ -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