Skip to content

Commit e4bfcb4

Browse files
authored
chore: cleanup docker targets in bake make ci (#1796)
* ci(test-proxy): fix docker build command Previously it was testing the latest tag which is already pushed to ghcr, not the one built locally. * chore(docker): cleanup bake/make/ci targets Also add documentation for some of the random options/choices we made.
1 parent 8dc3e26 commit e4bfcb4

File tree

6 files changed

+36
-32
lines changed

6 files changed

+36
-32
lines changed

.github/workflows/docker-publish-release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ jobs:
6868
password: ${{ secrets.GITHUB_TOKEN }}
6969
if: ${{ success() }}
7070

71+
# We only push on `v*` tags or if the force input is true.
72+
# We still run the build on every push to master just to ensure the images build correctly.
7173
- name: Set release PUSH_FLAG
7274
run: echo "PUSH_FLAG=--push" >> $GITHUB_ENV
7375
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.force == 'true'
7476

7577
- name: Build (and potentially push) docker image release
78+
# The PUSH_FLAG is ingested by the Makefile and passed to docker buildx bake command.
7679
run: PUSH_FLAG=$PUSH_FLAG make docker-release-build

.github/workflows/docker-publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050

5151
# Build And Push Images
5252
- name: Build Docker images
53-
run: docker buildx bake ci-release
53+
run: docker buildx bake all
5454
- name: Push Docker images
5555
if: github.ref == 'refs/heads/master'
56-
run: docker buildx bake ci-release --push
56+
run: BUILD_TAG=master make docker-build-push
5757

5858
- name: Send GitHub Action trigger data to Slack workflow
5959
if: ${{ failure() }}

.github/workflows/test-proxy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ jobs:
189189
runs-on: ubuntu-latest
190190
steps:
191191
- uses: actions/checkout@v4
192-
- run: make docker-build
192+
- run: BUILD_TAG=dev make docker-build
193193
working-directory: api/proxy
194194
# We also test that the docker container starts up correctly.
195195
- name: Run container as background process
@@ -200,7 +200,7 @@ jobs:
200200
-e EIGENDA_PROXY_ADDR=0.0.0.0 \
201201
-e EIGENDA_PROXY_PORT=6666 \
202202
-e EIGENDA_PROXY_MEMSTORE_ENABLED=true \
203-
ghcr.io/layr-labs/eigenda-proxy:latest
203+
ghcr.io/layr-labs/eigenda-proxy:dev
204204
working-directory: api/proxy
205205
- name: Wait for rpc to come up
206206
shell: bash

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,21 @@ integration-tests-dataapi:
121121
make dataapi-build
122122
go test -v ./disperser/dataapi
123123

124+
# builds all services and loads them into dockerd (such that they are available via `docker images`).
125+
# The images will be tagged with :dev, which is the default BUILD_TAG in docker-bake.hcl.
126+
# This can be changed by running for example `BUILD_TAG=master make docker-build`.
127+
docker-build:
128+
docker buildx bake all --load
129+
130+
# builds all services and pushes them to the configured registry (ghcr by default).
131+
docker-build-push:
132+
docker buildx bake all --push
133+
134+
# Should only ever be used by the docker-publish-release CI workflow.
135+
# We keep the node-group and proxy targets separate since we might want to release them separately in the future.
124136
docker-release-build:
125137
BUILD_TAG=${SEMVER} SEMVER=${SEMVER} GITDATE=${GITDATE} GIT_SHA=${GITSHA} GIT_SHORT_SHA=${GITCOMMIT} \
126-
docker buildx bake node-group-release ${PUSH_FLAG} --provenance=false --sbom=false
138+
docker buildx bake node-group-release ${PUSH_FLAG}
127139
BUILD_TAG=${SEMVER} SEMVER=${SEMVER} GITDATE=${GITDATE} GIT_SHA=${GITSHA} GIT_SHORT_SHA=${GITCOMMIT} \
128140
docker buildx bake proxy-release ${PUSH_FLAG}
129141

api/proxy/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ clean:
1515

1616
docker-build:
1717
# we only use this to build the docker image locally, so we give it the dev tag as a reminder
18-
cd ../.. && BUILD_TAG=dev docker buildx bake proxy --load
18+
cd ../.. && docker buildx bake proxy --load
1919

2020
run-memstore-server: build
2121
./bin/eigenda-proxy --memstore.enabled --metrics.enabled --storage.backends-to-enable v2

docker-bake.hcl

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ variable "REPO" {
77
default = "layr-labs/eigenda"
88
}
99

10+
# We use the `dev` tag for local development builds.
11+
# CI builds will overwrite this with the `master` or `v*` tag.
1012
variable "BUILD_TAG" {
11-
default = "latest"
13+
default = "dev"
1214
}
1315

1416
variable "SEMVER" {
@@ -47,37 +49,18 @@ group "all" {
4749
"traffic-generator-v2",
4850
"controller",
4951
"relay",
50-
"blobapi"
52+
"blobapi",
53+
"proxy",
5154
]
5255
}
5356

5457
group "node-group" {
5558
targets = ["node", "nodeplugin"]
5659
}
5760

58-
# Github public releases
59-
group "node-group-release" {
60-
targets = ["node-release", "nodeplugin-release"]
61-
}
62-
63-
# Github CI builds
64-
group "ci-release" {
65-
targets = [
66-
"node-group",
67-
"batcher",
68-
"disperser",
69-
"encoder",
70-
"retriever",
71-
"churner",
72-
"dataapi",
73-
"controller",
74-
"relay",
75-
"blobapi",
76-
"proxy",
77-
]
78-
}
79-
80-
# Internal devops builds
61+
# Internal devops builds. These targets are used by the eigenda-devops CI pipeline.
62+
# TODO: refactor the ECR repo to make the `${REGISTRY}/${REPO}` tags such that we can
63+
# get rid of all of these internal targets.
8164
group "internal-release" {
8265
targets = [
8366
"node-internal",
@@ -294,7 +277,7 @@ target "proxy" {
294277
target = "proxy"
295278
# We push to layr-labs/ directly instead of layr-labs/eigenda/ for historical reasons,
296279
# since proxy was previously in its own repo: https://github.com/Layr-Labs/eigenda-proxy
297-
tags = ["${REGISTRY}/layr-labs/proxy:${BUILD_TAG}"]
280+
tags = ["${REGISTRY}/layr-labs/eigenda-proxy:${BUILD_TAG}"]
298281
}
299282

300283
target "proxy-internal" {
@@ -340,13 +323,19 @@ target "_release" {
340323
platforms = ["linux/amd64", "linux/arm64"]
341324
}
342325

326+
group "node-group-release" {
327+
targets = ["node-release", "nodeplugin-release"]
328+
}
329+
343330
target "node-release" {
344331
inherits = ["node", "_release"]
332+
# We overwrite the tag with a opr- prefix for public releases.
345333
tags = ["${REGISTRY}/${REPO}/opr-node:${BUILD_TAG}"]
346334
}
347335

348336
target "nodeplugin-release" {
349337
inherits = ["nodeplugin", "_release"]
338+
# We overwrite the tag with a opr- prefix for public releases.
350339
tags = ["${REGISTRY}/${REPO}/opr-nodeplugin:${BUILD_TAG}"]
351340
}
352341

0 commit comments

Comments
 (0)