Skip to content

Commit 085347f

Browse files
committed
Experiment with better CI
1 parent d804bcc commit 085347f

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.github/workflows/build-containers.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,27 @@ jobs:
5151
strategy:
5252
fail-fast: false
5353
matrix:
54-
container: [core, db, exporter, jobservice, log, nginx, portal, prepare, redis, registryctl, registry, standalone-db-migrator, trivy-adapter]
54+
include:
55+
- container: core
56+
build_binary: harbor_core
57+
- container: db
58+
- container: exporter
59+
- container: jobservice
60+
build_binary: harbor_jobservice
61+
- container: log
62+
- container: nginx
63+
- container: portal
64+
- container: prepare
65+
- container: redis
66+
- container: registryctl
67+
build_binary: harbor_registryctl
68+
- container: registry
69+
has_custom_build_script: true
70+
- container: standalone-db-migrator
71+
build_binary: migrate
72+
- container: trivy-adapter
73+
has_custom_build_script: true
74+
5575
steps:
5676
- uses: actions/checkout@v4
5777

@@ -73,8 +93,16 @@ jobs:
7393
with:
7494
path: src/github.com/goharbor/harbor
7595

76-
- name: Build binaries
77-
if: ${{ matrix.container == 'registry' || matrix.container == 'trivy-adapter' }}
96+
- name: Set up additional flags
97+
if: ${{ matrix.container == 'core' }}
98+
run: echo "ADDITIONAL_GO_FLAGS=-X github.com/goharbor/harbor/src/lib/config.GitCommit=$(git rev-parse HEAD) -X github.com/goharbor/harbor/src/lib/config.ReleaseVersion=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
99+
- name: Build binary
100+
if: ${{ matrix.build_binary != '' }}
101+
run: |
102+
cd src/github.com/goharbor/harbor
103+
docker run --rm -v .:/harbor -w /harbor/src/${{ matrix.container }} golang:1.23.12 /usr/local/go/bin/go build -buildvcs=false -o ${matrix.build_binary} ${ADDITIONAL_GO_FLAGS:-}
104+
- name: Run custom build script
105+
if: ${{ matrix.has_custom_build_script == true }}
78106
run: |
79107
./make/photon/${matrix.container}/builder
80108

0 commit comments

Comments
 (0)