mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-17 14:58:16 +00:00
tools: add image for Go proto bindings
In order to have a reproducible code generation process, we need to pin the versions of the tools used. This is accomplished easiest by generating inside a container. This commit adds a container image definition with fixed dependencies for Golang proto/ttrpc code generation, and changes the agent Makefile to invoke the update-generated-proto.sh script from within that container. Signed-off-by: Markus Rudy <mr@edgeless.systems>
This commit is contained in:
committed by
Steve Horsman
parent
f7a36df290
commit
9e38fd2562
@@ -217,4 +217,11 @@ codecov-html: check_tarpaulin
|
||||
|
||||
##TARGET generate-protocols: generate/update grpc agent protocols
|
||||
generate-protocols:
|
||||
image=$$(docker build -q \
|
||||
--build-arg GO_VERSION=$$(yq '.languages.golang.version' $(CURDIR)/../../versions.yaml) \
|
||||
--build-arg PROTOC_VERSION=$$(yq '.externals.protoc.version' $(CURDIR)/../../versions.yaml | grep -oE "[0-9.]+") \
|
||||
--build-arg PROTOC_GEN_GO_VERSION=$$(yq '.externals.protoc-gen-go.version' $(CURDIR)/../../versions.yaml) \
|
||||
--build-arg TTRPC_VERSION=$$(yq '.externals.ttrpc.version' $(CURDIR)/../../versions.yaml) \
|
||||
$(CURDIR)/../../tools/packaging/static-build/codegen) && \
|
||||
docker run --rm --workdir /kata/src/agent -v $(CURDIR)/../..:/kata --user $(shell id -u) $$image \
|
||||
../libs/protocols/hack/update-generated-proto.sh all
|
||||
|
23
tools/packaging/static-build/codegen/Dockerfile
Normal file
23
tools/packaging/static-build/codegen/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2025 Edgeless Systems gmbH
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
ARG GO_VERSION=
|
||||
|
||||
FROM busybox:1.37.0 AS resources
|
||||
|
||||
WORKDIR /usr/local
|
||||
|
||||
ARG PROTOC_VERSION=
|
||||
RUN wget -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
|
||||
unzip /tmp/protoc.zip
|
||||
|
||||
FROM golang:${GO_VERSION}
|
||||
|
||||
COPY --from=resources /usr/local /usr
|
||||
|
||||
ARG PROTOC_GEN_GO_VERSION=
|
||||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION}
|
||||
ARG TTRPC_VERSION=
|
||||
RUN go install github.com/containerd/ttrpc/cmd/protoc-gen-go-ttrpc@${TTRPC_VERSION}
|
||||
RUN go install github.com/containerd/ttrpc/cmd/protoc-gen-gogottrpc@${TTRPC_VERSION}
|
@@ -374,6 +374,21 @@ externals:
|
||||
package: "ArmVirtPkg/ArmVirtQemu.dsc"
|
||||
package_output_dir: "ArmVirtQemu-AARCH64"
|
||||
|
||||
protoc:
|
||||
description: "Protobuf compiler"
|
||||
url: "https://github.com/protocolbuffers/protobuf/releases"
|
||||
version: "v21.12"
|
||||
|
||||
protoc-gen-go:
|
||||
description: "Protobuf Go compiler"
|
||||
url: "https://github.com/protocolbuffers/protobuf-go/releases"
|
||||
version: "v1.28.1"
|
||||
|
||||
ttrpc:
|
||||
description: "ttRPC libary and code generation utilities"
|
||||
url: "https://github.com/containerd/ttrpc/releases"
|
||||
version: "v1.2.7"
|
||||
|
||||
virtiofsd:
|
||||
description: "vhost-user virtio-fs device backend written in Rust"
|
||||
url: "https://gitlab.com/virtio-fs/virtiofsd"
|
||||
|
Reference in New Issue
Block a user