From 8894075c6af8acf1e0fa2a9e1238d3d14b50847b Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Tue, 25 Jun 2024 07:17:50 +1000 Subject: [PATCH] op-supervisor: Add op-supervisor build to CI (#10985) --- .circleci/config.yml | 39 +++++++++++++++++++ Makefile | 2 +- docker-bake.hcl | 17 ++++++++ op-supervisor/.gitignore | 1 + op-supervisor/Makefile | 24 ++++++++++++ ops/docker/op-stack-go/Dockerfile | 9 +++++ .../op-stack-go/Dockerfile.dockerignore | 1 + 7 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 op-supervisor/.gitignore create mode 100644 op-supervisor/Makefile diff --git a/.circleci/config.yml b/.circleci/config.yml index dea57afdaa6c..c5f83d410bcb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1631,6 +1631,10 @@ workflows: name: op-service-tests module: op-service requires: ["go-mod-download"] + - go-test: + name: op-supervisor-tests + module: op-supervisor + requires: ["go-mod-download"] - go-e2e-test: name: op-e2e-HTTP-tests<< matrix.variant >> matrix: @@ -1686,6 +1690,7 @@ workflows: - op-program-tests - op-program-compat - op-service-tests + - op-supervisor-tests - op-service-rethdb-tests - op-e2e-HTTP-tests - op-e2e-fault-proof-tests @@ -1735,6 +1740,11 @@ workflows: docker_name: da-server docker_tags: <>,<> save_image_tag: <> # for devnet later + - docker-build: + name: op-supervisor-docker-build + docker_name: op-supervisor + docker_tags: <>,<> + # op-supervisor is not (yet) part of the devnet, we don't save it - cannon-prestate: requires: - go-mod-download @@ -1950,6 +1960,26 @@ workflows: - oplabs-gcr-release requires: - hold + - docker-build: + name: op-supervisor-docker-release + filters: + tags: + only: /^op-supervisor\/v.*/ + branches: + ignore: /.*/ + docker_name: op-supervisor + docker_tags: <> + requires: ['hold'] + platforms: "linux/amd64,linux/arm64" + publish: true + release: true + context: + - oplabs-gcr-release + - check-cross-platform: + name: op-supervisor-cross-platform + op_component: op-supervisor + requires: + - op-supervisor-docker-release - docker-build: name: chain-mon-docker-release filters: @@ -2136,6 +2166,15 @@ workflows: context: - oplabs-gcr - slack + - docker-build: + name: op-supervisor-docker-publish + docker_name: op-supervisor + docker_tags: <>,<> + platforms: "linux/amd64,linux/arm64" + publish: true + context: + - oplabs-gcr + - slack - docker-build: name: chain-mon-docker-publish docker_name: chain-mon diff --git a/Makefile b/Makefile index 174909d18faf..673066822abc 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ golang-docker: --progress plain \ --load \ -f docker-bake.hcl \ - op-node op-batcher op-proposer op-challenger op-dispute-mon + op-node op-batcher op-proposer op-challenger op-dispute-mon op-supervisor .PHONY: golang-docker docker-builder-clean: diff --git a/docker-bake.hcl b/docker-bake.hcl index 846e855e3776..3fe9fabaf172 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -61,6 +61,10 @@ variable "OP_PROGRAM_VERSION" { default = "${GIT_VERSION}" } +variable "OP_SUPERVISOR_VERSION" { + default = "${GIT_VERSION}" +} + variable "CANNON_VERSION" { default = "${GIT_VERSION}" } @@ -186,6 +190,19 @@ target "op-program" { tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-program:${tag}"] } +target "op-supervisor" { + dockerfile = "ops/docker/op-stack-go/Dockerfile" + context = "." + args = { + GIT_COMMIT = "${GIT_COMMIT}" + GIT_DATE = "${GIT_DATE}" + OP_SUPERVISOR_VERSION = "${OP_SUPERVISOR_VERSION}" + } + target = "op-supervisor-target" + platforms = split(",", PLATFORMS) + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-supervisor:${tag}"] +} + target "cannon" { dockerfile = "ops/docker/op-stack-go/Dockerfile" context = "." diff --git a/op-supervisor/.gitignore b/op-supervisor/.gitignore new file mode 100644 index 000000000000..ba077a4031ad --- /dev/null +++ b/op-supervisor/.gitignore @@ -0,0 +1 @@ +bin diff --git a/op-supervisor/Makefile b/op-supervisor/Makefile new file mode 100644 index 000000000000..1f58b6f02384 --- /dev/null +++ b/op-supervisor/Makefile @@ -0,0 +1,24 @@ +GITCOMMIT ?= $(shell git rev-parse HEAD) +GITDATE ?= $(shell git show -s --format='%ct') +VERSION ?= v0.0.0 + +LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) +LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) +LDFLAGSSTRING +=-X main.Version=$(VERSION) +LDFLAGSSTRING +=-X main.Meta=$(VERSION_META) +LDFLAGS := -ldflags "$(LDFLAGSSTRING)" + + +op-supervisor: + env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-supervisor ./cmd + +clean: + rm bin/op-supervisor + +test: + go test -v ./... + +.PHONY: \ + op-supervisor \ + clean \ + test diff --git a/ops/docker/op-stack-go/Dockerfile b/ops/docker/op-stack-go/Dockerfile index e026f3c663f1..848d5ecc720c 100644 --- a/ops/docker/op-stack-go/Dockerfile +++ b/ops/docker/op-stack-go/Dockerfile @@ -108,6 +108,11 @@ FROM --platform=$BUILDPLATFORM builder as da-server-builder RUN --mount=type=cache,target=/root/.cache/go-build cd op-plasma && make da-server \ GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE +FROM --platform=$BUILDPLATFORM builder as op-supervisor-builder +ARG OP_SUPERVISOR_VERSION=v0.0.0 +RUN --mount=type=cache,target=/root/.cache/go-build cd op-supervisor && make op-supervisor \ + GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_SUPERVISOR_VERSION" + FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE as cannon-target COPY --from=cannon-builder /app/cannon/bin/cannon /usr/local/bin/ CMD ["cannon"] @@ -157,3 +162,7 @@ CMD ["op-conductor"] FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE as da-server-target COPY --from=da-server-builder /app/op-plasma/bin/da-server /usr/local/bin/ CMD ["da-server"] + +FROM --platform=$TARGETPLATFORM $TARGET_BASE_IMAGE as op-supervisor-target +COPY --from=op-supervisor-builder /app/op-supervisor/bin/op-supervisor /usr/local/bin/ +ENTRYPOINT ["op-supervisor"] diff --git a/ops/docker/op-stack-go/Dockerfile.dockerignore b/ops/docker/op-stack-go/Dockerfile.dockerignore index 9512fe9fbc7c..e012262ad78a 100644 --- a/ops/docker/op-stack-go/Dockerfile.dockerignore +++ b/ops/docker/op-stack-go/Dockerfile.dockerignore @@ -17,6 +17,7 @@ !/op-program !/op-proposer !/op-service +!/op-supervisor !/op-wheel !/op-plasma !/go.mod