Skip to content

Commit fcff7fe

Browse files
committed
build: run docker in interactive tty mode only when avaliable
cicd does not have a tty device, but when a user is compiling, we would like to offer him a tty interface (so that he could cancel builds, for example).
1 parent ee034f3 commit fcff7fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ ALL_PACK_TARGETS := $(PACK_TARGETS) $(PYTHON_PACK_TARGETS)
1111
SUBMODULE_PACKAGES := $(wildcard src/submodule_packages/*)
1212
BUILD_PACKAGES_DIR := "build/packages"
1313

14+
# We would like to run in interactive mode when avaliable (non-ci usually).
15+
TTY_ARG := $(shell [ -t 1 ] && echo "-it")
16+
1417
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
1518

1619
.NOTPARALLEL: build pack
@@ -36,7 +39,7 @@ build-docker-image: build/build-docker-image.stamp
3639

3740
build/download-packages.stamp: build/build-docker-image.stamp src/compilation/download_packages.sh
3841
mkdir -p $(BUILD_PACKAGES_DIR)
39-
docker run -it --user $(shell id -u):$(shell id -g) \
42+
docker run $(TTY_ARG) --user $(shell id -u):$(shell id -g) \
4043
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
4144
/app/gdb/src/compilation/download_packages.sh /app/gdb/$(BUILD_PACKAGES_DIR)/
4245
touch build/download-packages.stamp
@@ -59,7 +62,7 @@ $(PYTHON_TARGETS): build-with-python-%:
5962

6063
_build-%: symlink-git-packages download-packages build-docker-image
6164
mkdir -p build
62-
docker run -it --user $(shell id -u):$(shell id -g) \
65+
docker run $(TTY_ARG) --user $(shell id -u):$(shell id -g) \
6366
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
6467
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src $(WITH_PYTHON)
6568

0 commit comments

Comments
 (0)