Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap entrypoint script to trigger pre/post hook commands #435

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions airflow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
- Updated Vector to 0.31 ([#429]).
- Updated git-sync to 3.6.8 ([#431]).
- Updated statsd-exporter to 0.24, this was accidentally moved to a very old version previously (0.3.0) ([#431]).
- Added wrapper script to allow the triggering of pre/post hook actions ([#435]).

[#429]: https://github.com/stackabletech/docker-images/pull/429
[#431]: https://github.com/stackabletech/docker-images/pull/431
[#435]: https://github.com/stackabletech/docker-images/pull/435

## [23.7.0]

Expand Down
8 changes: 5 additions & 3 deletions airflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ RUN chown --recursive stackable:stackable ${AIRFLOW_HOME}
# Get the correct `tini` binary for our architecture.
# It is used as an init alternative in the entrypoint
RUN curl --fail -o /usr/bin/tini "https://repo.stackable.tech/repository/packages/tini/tini-${TINI}-$(arch)"
COPY airflow/stackable/utils/entrypoint.sh /entrypoint
RUN chmod a+x /entrypoint && \
COPY airflow/stackable/utils/entrypoint.sh /entrypoint.sh
COPY airflow/stackable/utils/run-airflow.sh /run-airflow.sh
RUN chmod a+x /entrypoint.sh && \
chmod a+x /run-airflow.sh && \
chmod +x /usr/bin/tini

COPY --from=statsd-exporter --chown=stackable:stackable /bin/statsd_exporter /stackable/statsd_exporter
Expand All @@ -101,5 +103,5 @@ COPY --from=gitsync-image --chown=stackable:stackable /git-sync /stackable/git-s
USER stackable
WORKDIR /stackable

ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint"]
ENTRYPOINT ["/usr/bin/tini", "--", "/run-airflow.sh"]
CMD []
14 changes: 14 additions & 0 deletions airflow/stackable/utils/run-airflow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# This wrapper script allows commands that are embedded in environment variables
# to be invoked to carry out actions when the main container is complete.
# N.B. for airflow services (scheduler, webserver, worker) this will not be relevant
# as the service has to be terminated, but for pods spawned and terminated by the
# kubernetes executor this allows us to stop other containers, such as vector.
eval "$_STACKABLE_PRE_HOOK"

/entrypoint.sh "$@"
result=$?

eval "$_STACKABLE_POST_HOOK"

exit $result