Skip to content

Commit b76a219

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 ebaaa21 commit b76a219

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/pr-pipeline.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77

88
jobs:
99
build:
10+
env:
11+
TTY_ARG: "" # Disable interactive build mode in cicd since it does not contain a tty device.
12+
1013
strategy:
1114
matrix:
1215
build_type: ["build", "build-with-python"]

.github/workflows/release-pipeline.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
# simply build the files in the same job they are released.
1010
jobs:
1111
build_and_publish:
12+
env:
13+
TTY_ARG: "" # Disable interactive build mode in cicd since it does not contain a tty device.
14+
1215
runs-on: ubuntu-latest
1316
steps:
1417
- uses: actions/checkout@v4
@@ -27,4 +30,4 @@ jobs:
2730
- name: Publish release
2831
uses: softprops/action-gh-release@v2
2932
with:
30-
files: build/artifacts/gdb-static*.tar.gz
33+
files: build/artifacts/gdb-static*.tar.gz

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ 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+
# This is disabled by the ci automation manually.
16+
TTY_ARG ?= -it
17+
1418
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
1519

1620
.NOTPARALLEL: build pack
@@ -36,7 +40,7 @@ build-docker-image: build/build-docker-image.stamp
3640

3741
build/download-packages.stamp: build/build-docker-image.stamp src/compilation/download_packages.sh
3842
mkdir -p $(BUILD_PACKAGES_DIR)
39-
docker run -it --user $(shell id -u):$(shell id -g) \
43+
docker run $(TTY_ARG) --user $(shell id -u):$(shell id -g) \
4044
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
4145
/app/gdb/src/compilation/download_packages.sh /app/gdb/$(BUILD_PACKAGES_DIR)/
4246
touch build/download-packages.stamp
@@ -59,7 +63,7 @@ $(PYTHON_TARGETS): build-with-python-%:
5963

6064
_build-%: symlink-git-packages download-packages build-docker-image
6165
mkdir -p build
62-
docker run -it --user $(shell id -u):$(shell id -g) \
66+
docker run $(TTY_ARG) --user $(shell id -u):$(shell id -g) \
6367
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
6468
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src $(WITH_PYTHON)
6569

0 commit comments

Comments
 (0)