Revert "[AIRFLOW-XXXX] Prevent Docker cache-busting on when editing www templates (#7427)"

This reverts commit 3eb30ed12c.
This commit is contained in:
Jarek Potiuk 2020-02-16 10:10:37 +01:00
Родитель 3eb30ed12c
Коммит 627365ab74
3 изменённых файлов: 37 добавлений и 17 удалений

Просмотреть файл

@ -362,7 +362,11 @@ RUN ln -sf /usr/bin/dumb-init /usr/local/bin/dumb-init
# Rather than after setup.py is added.
COPY airflow/www/yarn.lock airflow/www/package.json ${AIRFLOW_SOURCES}/airflow/www/
RUN yarn --cwd airflow/www install --frozen-lockfile --no-cache
WORKDIR ${AIRFLOW_SOURCES}/airflow/www
RUN yarn install --frozen-lockfile
WORKDIR ${AIRFLOW_SOURCES}
# Note! We are copying everything with airflow:airflow user:group even if we use root to run the scripts
# This is fine as root user will be able to use those dirs anyway.
@ -382,13 +386,13 @@ COPY airflow/bin/airflow ${AIRFLOW_SOURCES}/airflow/bin/airflow
# In non-CI optimized build this will install all dependencies before installing sources.
RUN pip install -e ".[${AIRFLOW_EXTRAS}]"
# Copy all the www/ files we need to compile assets. Done as two separate COPY
# commands so as otherwise it copies the _contents_ of static/ in to www/
COPY airflow/www/webpack.config.js ${AIRFLOW_SOURCES}/airflow/www/
COPY airflow/www/static ${AIRFLOW_SOURCES}/airflow/www/static/
WORKDIR ${AIRFLOW_SOURCES}/airflow/www
# Package JS/css for production
RUN yarn --cwd airflow/www run prod
# Copy all www files here so that we can run yarn building for production
COPY airflow/www/ ${AIRFLOW_SOURCES}/airflow/www/
# Package NPM for production
RUN yarn run prod
COPY scripts/docker/entrypoint.sh /entrypoint.sh

Просмотреть файл

@ -24,7 +24,5 @@ FILES_FOR_REBUILD_CHECK=(
".dockerignore"
"airflow/version.py"
"airflow/www/package.json"
"airflow/www/yarn.lock"
"airflow/www/webpack.config.js"
)
"airflow/www/yarn.lock" )
export FILES_FOR_REBUILD_CHECK

Просмотреть файл

@ -363,6 +363,10 @@ fi
start_step "Creating deployment directory"
STAT_BIN=stat
if [[ "${OSTYPE}" == "darwin"* ]]; then
STAT_BIN=gstat
fi
# Build id identifying the build uniquely
BUILD_ID=${BUILD_ID:="local"}
@ -385,14 +389,28 @@ mkdir -pv "${DEPLOY_DIR}"
#
# We fix it by removing write permissions for other/group for all files that are in the Docker context.
#
# Since we can't (easily) tell what dockerignore would restrict, we'll just to
# it to "all" files in the git repo, making sure to exclude the www/static/docs
# symlink which is broken until the docs are built.
STAT_BIN=stat
if [[ "${OSTYPE}" == "darwin"* ]]; then
STAT_BIN=gstat
fi
# This deals with files
git ls-files -z ':!:airflow/www/static/docs' | xargs -0 chmod og-w
# and this deals with directories
git ls-tree -z -r -d --name-only HEAD | xargs -0 chmod og-wx
for FILE in "${FILES_FOR_REBUILD_CHECK[@]}"; do
ACCESS_RIGHTS=$("${STAT_BIN}" -c "%A" "${AIRFLOW_SOURCES}/${FILE}" || echo "--------")
# check if the file is group/other writeable
if [[ "${ACCESS_RIGHTS:5:1}" != "-" || "${ACCESS_RIGHTS:8:1}" != "-" ]]; then
if [[ "${VERBOSE_FIX_FILE:="false"}" == "true" ]]; then
"${STAT_BIN}" --printf "%a %A %F \t%s \t-> " "${AIRFLOW_SOURCES}/${FILE}"
fi
chmod og-w "${AIRFLOW_SOURCES}/${FILE}"
if [[ "${VERBOSE_FIX_FILE:="false"}" == "true" ]]; then
"${STAT_BIN}" --printf "%a %A %F \t%s \t%n\n" "${AIRFLOW_SOURCES}/${FILE}"
fi
fi
done
echo "Group/other write access removed for ${FILES_FOR_REBUILD_CHECK[*]}"
echo
echo
if [[ "${AIRFLOW_CONTAINER_SKIP_CI_IMAGE}" == "true" ]]; then
echo "Skip building the CI full Airflow image"