Skip to content

Commit 14f86e1

Browse files
mkolesniktpantelis
authored andcommitted
Add DEBUG var to control debug printing
It's not always necessary to have debug prints, most of the time it's useful when developing Shipyard/script features or when running the CI. The `DEBUG` env var can be use to request debug printing. Currently the default is `true` to maintain the current behavior, but after adoption this can be set to `false` (or unset). Signed-off-by: Mike Kolesnik <[email protected]>
1 parent 7cef2ee commit 14f86e1

File tree

9 files changed

+20
-2
lines changed

9 files changed

+20
-2
lines changed

.github/workflows/clean-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: Clean Target Verification
44
on:
55
pull_request:
66

7+
env:
8+
DEBUG: true
79
jobs:
810
clean-clusters:
911
name: Cluster Clean-up

.github/workflows/multiarch.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: Multi-arch Builds
44
on:
55
pull_request:
66

7+
env:
8+
DEBUG: true
79
jobs:
810
check-multiarch:
911
name: Check the multi-arch builds

.github/workflows/scripts.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: Shared Scripts
44
on:
55
pull_request:
66

7+
env:
8+
DEBUG: true
79
jobs:
810
clusters:
911
name: Clusters

Makefile.dapper

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ RUN_IN_DAPPER = ./.dapper $(DAPPER_ARGS) $(SELINUX_CONTEXT) --
3939

4040
endif
4141

42+
ifeq (true,$(DEBUG))
43+
MAKE_DEBUG_FLAG = --debug=b
44+
endif
45+
4246
# Only run command line goals in dapper (except things that have to run outside of dapper).
4347
# Otherwise, make applies this rule to various files and tries to build them in dapper (which doesn't work, obviously).
4448
$(filter-out .dapper prune-images shell targets $(NON_DAPPER_GOALS),$(MAKECMDGOALS)): .dapper $(BASE_DAPPER)
4549
-docker network create -d bridge kind
46-
+$(RUN_IN_DAPPER) make --debug=b $@
50+
+$(RUN_IN_DAPPER) make $(MAKE_DEBUG_FLAG) $@
4751

4852
# The original dockerfiles will live in Shipyard and be downloaded by consuming projects.
4953
$(BASE_DAPPER) $(LINTING_DAPPER):

Makefile.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ PRELOAD_IMAGES ?= submariner-gateway submariner-operator submariner-route-agent
55

66
### Tunable variables for affecting make commands ###
77
# Affecting multiple commands
8+
DEBUG ?= true
89
TIMEOUT ?= 5m
9-
export GLOBALNET PLUGIN SETTINGS TIMEOUT
10+
export DEBUG GLOBALNET PLUGIN SETTINGS TIMEOUT
1011

1112
# Specific to `clusters`
1213
K8S_VERSION ?= 1.23

gh-actions/e2e/action.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ inputs:
3636
runs:
3737
using: "composite"
3838
steps:
39+
- shell: bash
40+
run: echo "DEBUG=true" >> $GITHUB_ENV
3941
- shell: bash
4042
run: |
4143
echo "::group::Reclaiming free space"

gh-actions/release-images/action.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ inputs:
1111
runs:
1212
using: "composite"
1313
steps:
14+
- shell: bash
15+
run: echo "DEBUG=true" >> $GITHUB_ENV
1416
- name: Set up QEMU (to support building on non-native architectures)
1517
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
1618
- name: Set up buildx

gh-actions/upgrade-e2e/action.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: 'Runs an upgrade procedure, followed by end to end tests with multi
44
runs:
55
using: "composite"
66
steps:
7+
- shell: bash
8+
run: echo "DEBUG=true" >> $GITHUB_ENV
79
- shell: bash
810
run: |
911
echo "::group::Reclaiming free space"

scripts/shared/lib/debug_functions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ function trap_commands() {
1919

2020
### Main ###
2121

22+
[[ "${DEBUG}" == 'true' ]] || return 0
2223
set -T
2324
trap_commands

0 commit comments

Comments
 (0)