Skip to content

Commit 92661b8

Browse files
authored
Further make run improvements (#1649)
* 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.
1 parent 4a264fc commit 92661b8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ jobs:
6565

6666
container-test:
6767
runs-on: ubuntu-24.04
68-
defaults:
69-
run:
70-
# Work around lack of TTY causing errors when using `docker run -it`:
71-
# https://github.com/actions/runner/issues/241
72-
shell: 'script -q -e -c "bash -eo pipefail {0}"'
7368
steps:
7469
- name: Checkout
7570
uses: actions/checkout@v4

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ format:
2323

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

0 commit comments

Comments
 (0)