Skip to content

Commit 10c3db1

Browse files
committed
Experiment
1 parent d9c5a5e commit 10c3db1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/build-containers.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,18 @@ jobs:
8888
- name: Set up additional flags
8989
if: ${{ matrix.container == 'core' }}
9090
# TODO: Proper versioning
91-
run: echo "ADDITIONAL_GO_FLAGS=-ldflags=\"-X github.com/goharbor/harbor/src/lib/config.GitCommit=$(git rev-parse HEAD) -X github.com/goharbor/harbor/src/lib/config.ReleaseVersion=dev\"" >> $GITHUB_ENV
91+
run: echo "ADDITIONAL_GO_LDFLAGS=-X github.com/goharbor/harbor/src/lib/config.GitCommit=$(git rev-parse HEAD) -X github.com/goharbor/harbor/src/lib/config.ReleaseVersion=dev" >> $GITHUB_ENV
9292

9393
- name: Build binary
9494
if: ${{ matrix.build_binary != '' }}
9595
run: |
96-
docker run --rm -v .:/harbor -w /harbor/src/${{ matrix.src_name || matrix.container}} golang:1.24.6 /usr/local/go/bin/go build -buildvcs=false -o /harbor/make/photon/${{ matrix.container }}/${{matrix.build_binary}} ${ADDITIONAL_GO_FLAGS:-}
96+
# If ADDITIONAL_GO_LDFLAGS is set, use it; otherwise, use the default
97+
if [ -n "${ADDITIONAL_GO_LDFLAGS}" ]; then
98+
docker run --rm -v .:/harbor -w /harbor/src/${{ matrix.src_name || matrix.container}} golang:1.24.6 /usr/local/go/bin/go build -buildvcs=false -o /harbor/make/photon/${{ matrix.container }}/${{matrix.build_binary}} -ldflags "${ADDITIONAL_GO_LDFLAGS}"
99+
else
100+
docker run --rm -v .:/harbor -w /harbor/src/${{ matrix.src_name || matrix.container}} golang:1.24.6 /usr/local/go/bin/go build -buildvcs=false -o /harbor/make/photon/${{ matrix.container }}/${{matrix.build_binary}}
101+
fi
102+
97103
- name: Run custom build script
98104
if: ${{ matrix.run_build_script }}
99105
run: |

0 commit comments

Comments
 (0)