From 8e50a44132a5840640b15081049304f18d83cdaa Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Tue, 13 Feb 2024 10:47:37 -0500 Subject: [PATCH 1/2] github: build lxc and lxd-migrate binaries with trimpath Signed-off-by: Simon Deziel --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 34d7f3fdb46d..e5f12888e0be 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -386,14 +386,14 @@ jobs: CGO_ENABLED: 0 GOARCH: amd64 run: | - go build -o bin/lxc.x86_64 ./lxc + go build -o trimpath -o bin/lxc.x86_64 ./lxc - name: Build static lxc (aarch64) env: CGO_ENABLED: 0 GOARCH: arm64 run: | - go build -o bin/lxc.aarch64 ./lxc + go build -o trimpath -o bin/lxc.aarch64 ./lxc - name: Build static lxd-migrate if: runner.os == 'Linux' @@ -401,8 +401,8 @@ jobs: CGO_ENABLED: 0 run: | set -eux - GOARCH=amd64 go build -o bin/lxd-migrate.x86_64 ./lxd-migrate - GOARCH=arm64 go build -o bin/lxd-migrate.aarch64 ./lxd-migrate + GOARCH=amd64 go build -o trimpath -o bin/lxd-migrate.x86_64 ./lxd-migrate + GOARCH=arm64 go build -o trimpath -o bin/lxd-migrate.aarch64 ./lxd-migrate - name: Unit tests (client) env: From 2b98753c29a0b887a83b83a92e3dbdd04f811167 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Tue, 13 Feb 2024 10:51:55 -0500 Subject: [PATCH 2/2] github: strip lxc and lxd-migrate native binaries Non-native binaries cannot be strip'ed: $ strip -s bin/lxc.* bin/lxd-migrate.* strip: Unable to recognise the format of the input file `bin/lxc.aarch64' strip: Unable to recognise the format of the input file `bin/lxd-migrate.aarch64' Signed-off-by: Simon Deziel --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e5f12888e0be..07a786f29f55 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -404,6 +404,10 @@ jobs: GOARCH=amd64 go build -o trimpath -o bin/lxd-migrate.x86_64 ./lxd-migrate GOARCH=arm64 go build -o trimpath -o bin/lxd-migrate.aarch64 ./lxd-migrate + - name: Strip lxc and lxd-migrate native binaries + if: runner.os != 'macOS' # macOS doesn't have strip + run: strip -s bin/lx*.x86_64 # non-native binaries cannot be strip'ed + - name: Unit tests (client) env: CGO_ENABLED: 0