Skip to content

Commit

Permalink
Further make run improvements (#1649)
Browse files Browse the repository at this point in the history
* Stops using the `-it` options, since whilst interactive mode allows
  for instant termination of the container using Ctrl/CMD+C during
  development, it interferes with running the command via `watchexec`.
  Similarly, enabling the TTY leads to tools not behaving the same as
  they will on the actual Heroku build system (eg using colours in auto
  mode), so that has been disabled too, to make this development
  workflow more representative. Doing so also means the GitHub Actions
  workaround for TTY is no longer required.
* Sanitises the env vars to more closely match those allow-listed in
  Cytokine. This prevents vars like `CNB_USER_ID` and `CNB_STACK_ID`
  from leaking through from the new combined Heroku+CNB base images.
* If an inline buildpack is detected in the test fixture, it is now
  run too - matching what the equivalent Hatchet test would be
  configured to do.

GUS-W-16866418.
  • Loading branch information
edmorley authored Sep 30, 2024
1 parent 4a264fc commit 92661b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ jobs:

container-test:
runs-on: ubuntu-24.04
defaults:
run:
# Work around lack of TTY causing errors when using `docker run -it`:
# https://github.com/actions/runner/issues/241
shell: 'script -q -e -c "bash -eo pipefail {0}"'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ format:

run:
@echo "Running buildpack using: STACK=$(STACK) FIXTURE=$(FIXTURE)"
@docker run --rm -it -v $(PWD):/src:ro --tmpfs /app -e "HOME=/app" -e "STACK=$(STACK)" "$(STACK_IMAGE_TAG)" \
bash -eo pipefail -c '\
@docker run --rm -v $(PWD):/src:ro --tmpfs /app -e "HOME=/app" -e "STACK=$(STACK)" "$(STACK_IMAGE_TAG)" \
bash -euo pipefail -c '\
mkdir /tmp/buildpack /tmp/build /tmp/cache /tmp/env; \
cp -r /src/{bin,lib,requirements,vendor} /tmp/buildpack; \
cp -rT /src/$(FIXTURE) /tmp/build; \
cd /tmp/buildpack; \
unset $$(printenv | cut -d '=' -f 1 | grep -vE "^(HOME|LANG|PATH|STACK)$$"); \
echo -e "\n~ Detect:" && ./bin/detect /tmp/build; \
echo -e "\n~ Compile:" && { ./bin/compile /tmp/build /tmp/cache /tmp/env || SKIP_RELEASE=1; }; \
echo -e "\n~ Compile:" && { ./bin/compile /tmp/build /tmp/cache /tmp/env || COMPILE_FAILED=1; }; \
echo -e "\n~ Report:" && ./bin/report /tmp/build /tmp/cache /tmp/env; \
[[ -n "$${SKIP_RELEASE}" ]] || { echo -e "\n~ Release:" && ./bin/release /tmp/build && echo -e "\nBuild successful!"; }; \
[[ "$${COMPILE_FAILED:-}" == "1" ]] && exit 0; \
[[ -f /tmp/build/bin/compile ]] && { echo -e "\n~ Compile (Inline Buildpack):" && (source ./export && /tmp/build/bin/compile /tmp/build /tmp/cache /tmp/env); }; \
echo -e "\n~ Release:" && ./bin/release /tmp/build; \
echo -e "\nBuild successful!"; \
'
@echo

Expand Down

0 comments on commit 92661b8

Please sign in to comment.