Skip to content

Commit

Permalink
[AIRFLOW-6662] Switch to --init docker flag for signal propagation (#…
Browse files Browse the repository at this point in the history
…7278)

We are now using native --init flag of docker run and init: parameter
of docker compose to pass signals and reap child processes
  • Loading branch information
potiuk authored Jan 29, 2020
1 parent 057f3ae commit d1bf343
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,6 @@ ENV PATH="${HOME}:${PATH}"

EXPOSE 8080

ENTRYPOINT ["/usr/local/bin/dumb-init", "--", "/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]

CMD ["--help"]
55 changes: 35 additions & 20 deletions scripts/ci/_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -640,27 +640,30 @@ function run_flake8() {

if [[ "${#FILES[@]}" == "0" ]]; then
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_flake8.sh" \
--rm \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_flake8.sh" \
| tee -a "${OUTPUT_LOG}"
else
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--rm \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_flake8.sh" \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_flake8.sh" "${FILES[@]}" \
"${FILES[@]}" \
| tee -a "${OUTPUT_LOG}"
fi
}
Expand All @@ -679,57 +682,63 @@ function run_bats_tests() {

function run_docs() {
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" -t \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--entrypoint \
"/opt/airflow/docs/build.sh" \
--rm \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/docs/build.sh" \
| tee -a "${OUTPUT_LOG}"
}

function run_check_license() {
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" -t \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_check_licence.sh" \
--rm \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_check_licence.sh" \
| tee -a "${OUTPUT_LOG}"
}

function run_mypy() {
FILES=("$@")
if [[ "${#FILES[@]}" == "0" ]]; then
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--rm \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_mypy.sh" \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_mypy.sh" "airflow" "tests" "docs" \
"airflow" "tests" "docs" \
| tee -a "${OUTPUT_LOG}"
else
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_mypy.sh" \
--rm \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_mypy.sh" "${FILES[@]}" \
"${FILES[@]}" \
| tee -a "${OUTPUT_LOG}"
fi
}
Expand All @@ -738,27 +747,30 @@ function run_pylint_main() {
FILES=("$@")
if [[ "${#FILES[@]}" == "0" ]]; then
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--rm \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_pylint_main.sh" \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_pylint_main.sh" \
| tee -a "${OUTPUT_LOG}"
else
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--rm \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_pylint_main.sh" \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_pylint_main.sh" "${FILES[@]}" \
"${FILES[@]}" \
| tee -a "${OUTPUT_LOG}"
fi
}
Expand All @@ -768,27 +780,30 @@ function run_pylint_tests() {
FILES=("$@")
if [[ "${#FILES[@]}" == "0" ]]; then
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--rm \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_pylint_tests.sh" \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_pylint_tests.sh" \
| tee -a "${OUTPUT_LOG}"
else
docker run "${AIRFLOW_CONTAINER_EXTRA_DOCKER_FLAGS[@]}" \
--entrypoint "/usr/local/bin/dumb-init" \
--init \
--env PYTHONDONTWRITEBYTECODE \
--env AIRFLOW_CI_VERBOSE="${VERBOSE}" \
--env AIRFLOW_CI_SILENT \
--env HOST_USER_ID="$(id -ur)" \
--env HOST_GROUP_ID="$(id -gr)" \
--rm \
--entrypoint \
"/opt/airflow/scripts/ci/in_container/run_pylint_tests.sh" \
"${AIRFLOW_CI_IMAGE}" \
"--" "/opt/airflow/scripts/ci/in_container/run_pylint_tests.sh" "${FILES[@]}" \
"${FILES[@]}" \
| tee -a "${OUTPUT_LOG}"
fi
}
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/backend-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
depends_on:
- mysql
mysql:
init: true
image: mysql:5.6
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=true
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/backend-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
depends_on:
- postgres
postgres:
init: true
image: postgres:9.6
environment:
- POSTGRES_USER=postgres
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/integration-cassandra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "2.2"
services:
cassandra:
init: true
image: cassandra:3.0
volumes:
- /dev/urandom:/dev/random # Required to get non-blocking entropy source
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/integration-kerberos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "2.2"
services:
kerberos:
init: true
image: godatadriven/krb5-kdc-server
hostname: kerberos
domainname: example.com
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/integration-mongo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "2.2"
services:
mongo:
init: true
image: mongo:3
volumes:
- /dev/urandom:/dev/random # Required to get non-blocking entropy source
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/integration-openldap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "2.2"
services:
openldap:
init: true
image: osixia/openldap:1.2.0
command: --copy-service
environment:
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/integration-rabbitmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "2.2"
services:
rabbitmq:
init: true
image: rabbitmq:3.7
volumes:
- /dev/urandom:/dev/random # Required to get non-blocking entropy source
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/docker-compose/integration-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "2.2"
services:
redis:
init: true
image: redis:5.0.1
volumes:
- /dev/urandom:/dev/random # Required to get non-blocking entropy source
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ def write_version(filename: str = os.path.join(*["airflow", "git_version"])):
'click==6.7',
'contextdecorator;python_version<"3.4"',
'coverage',
'dumb-init>=1.2.2',
'flake8>=3.6.0',
'flake8-colors',
'flaky',
Expand Down

0 comments on commit d1bf343

Please sign in to comment.