Skip to content

Commit e8d6c73

Browse files
committed
Disable DWARF and symbol table to decrease binary/image size
This commit introduces DBG variable which is used to control including DWARF and symbol table for images/binaries Signed-off-by: Sunnatillo <[email protected]>
1 parent 3fe6f96 commit e8d6c73

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ OBSERVABILITY_DIR := hack/observability
7373

7474
export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
7575

76+
# DBG=1 for building binaries which includes DWARF and symbol table for delve
77+
# degubbing. When DBG is unspecified it defaults to "-s -w" which strips debug
78+
# information.
79+
export DBG ?= 0
80+
7681
#
7782
# Ginkgo configuration.
7883
#

hack/version.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ version::ldflags() {
102102
add_ldflag "gitReleaseCommit" "${GIT_RELEASE_COMMIT}"
103103

104104
# The -ldflags parameter takes a single string, so join the output.
105-
echo "${ldflags[*]-}"
105+
# When DBG is set to 1 include DWARF and symbol table for delve degubbing
106+
if [[ "${DBG:-}" == 1 ]]; then
107+
echo "${ldflags[*]-}"
108+
else
109+
echo "${ldflags[*]-}" " -s -w"
110+
fi
106111
}
107112

108113
version::ldflags

scripts/ci-e2e.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ source "${REPO_ROOT}/hack/ensure-kind.sh"
3232
# Make sure the tools binaries are on the path.
3333
export PATH="${REPO_ROOT}/hack/tools/bin:${PATH}"
3434

35+
# Include debugging tools for container images for e2e tests
36+
export DBG=1
37+
3538
# Builds CAPI (and CAPD) images.
3639
capi:buildDockerImages
3740

0 commit comments

Comments
 (0)