This repository has been archived by the owner on Feb 19, 2021. It is now read-only.
forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_pylint_main.sh
executable file
·74 lines (67 loc) · 2.64 KB
/
ci_pylint_main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
export PYTHON_MAJOR_MINOR_VERSION=${PYTHON_MAJOR_MINOR_VERSION:-3.6}
# shellcheck source=scripts/ci/libraries/_script_init.sh
. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh"
function run_pylint_main() {
FILES=("$@")
if [[ "${#FILES[@]}" == "0" ]]; then
docker run "${EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--env PYTHONDONTWRITEBYTECODE \
--env VERBOSE \
--env VERBOSE_COMMANDS \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--env HOST_OS="$(uname -s)" \
--env HOST_HOME="${HOME}" \
--env HOST_AIRFLOW_SOURCES="${AIRFLOW_SOURCES}" \
--rm \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_pylint_main.sh" \
| tee -a "${OUTPUT_LOG}"
else
docker run "${EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--env PYTHONDONTWRITEBYTECODE \
--env VERBOSE \
--env VERBOSE_COMMANDS \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--env HOST_OS="$(uname -s)" \
--env HOST_HOME="${HOME}" \
--env HOST_AIRFLOW_SOURCES="${AIRFLOW_SOURCES}" \
--rm \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_pylint_main.sh" "${FILES[@]}" \
| tee -a "${OUTPUT_LOG}"
fi
}
get_environment_for_builds_on_ci
prepare_ci_build
# rebuild_ci_image_if_needed
if [[ "${#@}" != "0" ]]; then
filter_out_files_from_pylint_todo_list "$@"
if [[ "${#FILTERED_FILES[@]}" == "0" ]]; then
echo "Filtered out all files. Skipping pylint."
else
run_pylint_main "${FILTERED_FILES[@]}"
fi
else
run_pylint_main
fi