turbaszek commented on a change in pull request #8497:
URL: https://github.com/apache/airflow/pull/8497#discussion_r412861270
##########
File path: scripts/ci/_utils.sh
##########
@@ -919,86 +933,78 @@ function match_files_regexp() {
export FILE_MATCHES
}
-function build_ci_image_on_ci() {
- if [[ "${CI:=}" != "true" ]]; then
- print_info
- print_info "Cleaning up docker installation!!!!!!"
- print_info
- "${AIRFLOW_SOURCES}/confirm" "Cleaning docker data and rebuilding"
+function get_ci_environment() {
+ export CI_EVENT_TYPE="manual"
+ export CI_TARGET_REPO="apache/airflow"
+ export CI_TARGET_BRANCH="master"
+ export CI_BUILD_ID="default-build-id"
+ export CI_JOB_ID="default-job-id"
+ if [[ ${CI:=} != "true" ]]; then
+ echo
+ echo "This is not a CI environment!. Staying with the defaults"
+ echo
+ else
+ if [[ ${TRAVIS:=} == "true" ]]; then
+ if [[ "${TRAVIS_PULL_REQUEST:=}" == "true" ]]; then
+ export CI_EVENT_TYPE="pull_request"
+ elif [[ "${TRAVIS_EVENT_TYPE:=}" == "cron" ]]; then
+ export CI_EVENT_TYPE="schedule"
+ else
+ export CI_EVENT_TYPE="push"
+ fi
+ export CI_TARGET_BRANCH="${TRAVIS_BRANCH}"
+ export CI_TARGET_REPO="${TRAVIS_REPO_SLUG}"
+ export CI_BUILD_ID="${TRAVIS_BUILD_ID}"
+ export CI_JOB_ID="${TRAVIS_JOB_ID}"
+ elif [[ ${GITHUB_ACTIONS:=} == "true" ]]; then
+ if [[ ${GITHUB_EVENT_NAME:=} == "pull_request" ]]; then
+ export CI_EVENT_TYPE="pull_request"
+ elif [[ ${GITHUB_EVENT_TYPE:=} == "schedule" ]]; then
+ export CI_EVENT_TYPE="schedule"
+ else
+ export CI_EVENT_TYPE="push"
Review comment:
I am not bash master but can't we simplify it?
```suggestion
if [[ ${GITHUB_EVENT_NAME:=} != "" ]]; then
export CI_EVENT_TYPE=${GITHUB_EVENT_NAME}
else
export CI_EVENT_TYPE="push"
```
or
```bash
export CI_EVENT_TYPE=${GITHUB_EVENT_NAME:="push"}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]