From ea516711ae73699caaca883367c103554ac9725f Mon Sep 17 00:00:00 2001 From: Dustin Decker Date: Thu, 7 Apr 2022 18:10:23 -0700 Subject: [PATCH] update protos image and fix it for linux/amd64 (#316) --- Makefile | 7 +++++- hack/Dockerfile.protos | 23 +++++++++++++++++++ pkg/pb/credentialspb/credentials.pb.go | 4 ++-- .../credentialspb/credentials.pb.validate.go | 11 +++++++++ pkg/pb/detectorspb/detectors.pb.go | 4 ++-- pkg/pb/detectorspb/detectors.pb.validate.go | 4 ++++ .../source_metadatapb/source_metadata.pb.go | 4 ++-- .../source_metadata.pb.validate.go | 23 +++++++++++++++++++ pkg/pb/sourcespb/sources.pb.go | 4 ++-- pkg/pb/sourcespb/sources.pb.validate.go | 23 +++++++++++++++++++ 10 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 hack/Dockerfile.protos diff --git a/Makefile b/Makefile index 890fa34c..0dc4f6d1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTOS_IMAGE ?= us-docker.pkg.dev/thog-artifacts/public/go-ci-1.17-1 +PROTOS_IMAGE ?= trufflesecurity/protos:1.18-0 .PHONY: check .PHONY: test @@ -47,5 +47,10 @@ protos: protos-windows: docker run -v "$(shell cygpath -w $(shell pwd))":/pwd "${PROTOS_IMAGE}" bash -c "cd /pwd; ./scripts/gen_proto.sh" +release-protos-image: + docker buildx build --push --platform=linux/amd64,linux/arm64 \ + -t trufflesecurity/protos:1.18-0 -f hack/Dockerfile.protos . + snifftest: ./hack/snifftest/snifftest.sh + diff --git a/hack/Dockerfile.protos b/hack/Dockerfile.protos new file mode 100644 index 00000000..610494c1 --- /dev/null +++ b/hack/Dockerfile.protos @@ -0,0 +1,23 @@ +# trufflesecurity/protos:1.18-0 + +FROM golang:1.18-buster + +ARG TARGETARCH +ARG TARGETOS +ENV PROTOC_VER=3.20.0 +ENV GORELEASER_VER=v1.7.0 +ENV SQLBOILER_VER=v4.9.0 +ENV PROTOC_GEN_GO_VER=v1.5.2 + +RUN echo "building $TARGETARCH" +RUN apt-get update; apt-get install -y --no-install-recommends git unzip && rm -rf /var/lib/apt/lists/* +RUN set -e; \ + arch=$(echo $TARGETARCH | sed -e s/amd64/x86_64/ -e s/arm64/aarch_64/); \ + wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-${TARGETOS}-${arch}.zip && unzip protoc-${PROTOC_VER}-${TARGETOS}-${arch}.zip -d /usr/local +RUN go install "github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_GO_VER}" +RUN GO111MODULE=off go get -d "github.com/envoyproxy/protoc-gen-validate" && \ + cd $GOPATH/src/github.com/envoyproxy/protoc-gen-validate && \ + git checkout v0.6.7 && \ + ln -s /usr/local/protoc/include/google google && \ + make build +CMD ["bash"] diff --git a/pkg/pb/credentialspb/credentials.pb.go b/pkg/pb/credentialspb/credentials.pb.go index 4abbb28f..52ec174b 100644 --- a/pkg/pb/credentialspb/credentials.pb.go +++ b/pkg/pb/credentialspb/credentials.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.26.0 +// protoc v3.20.0 // source: credentials.proto package credentialspb diff --git a/pkg/pb/credentialspb/credentials.pb.validate.go b/pkg/pb/credentialspb/credentials.pb.validate.go index 6839000e..221e0e4b 100644 --- a/pkg/pb/credentialspb/credentials.pb.validate.go +++ b/pkg/pb/credentialspb/credentials.pb.validate.go @@ -60,6 +60,7 @@ func (m *Unauthenticated) validate(all bool) error { if len(errors) > 0 { return UnauthenticatedMultiError(errors) } + return nil } @@ -159,6 +160,7 @@ func (m *CloudEnvironment) validate(all bool) error { if len(errors) > 0 { return CloudEnvironmentMultiError(errors) } + return nil } @@ -262,6 +264,7 @@ func (m *BasicAuth) validate(all bool) error { if len(errors) > 0 { return BasicAuthMultiError(errors) } + return nil } @@ -363,6 +366,7 @@ func (m *Header) validate(all bool) error { if len(errors) > 0 { return HeaderMultiError(errors) } + return nil } @@ -467,6 +471,7 @@ func (m *ClientCredentials) validate(all bool) error { if len(errors) > 0 { return ClientCredentialsMultiError(errors) } + return nil } @@ -576,6 +581,7 @@ func (m *ClientCertificate) validate(all bool) error { if len(errors) > 0 { return ClientCertificateMultiError(errors) } + return nil } @@ -682,6 +688,7 @@ func (m *Oauth2) validate(all bool) error { if len(errors) > 0 { return Oauth2MultiError(errors) } + return nil } @@ -784,6 +791,7 @@ func (m *KeySecret) validate(all bool) error { if len(errors) > 0 { return KeySecretMultiError(errors) } + return nil } @@ -887,6 +895,7 @@ func (m *AWS) validate(all bool) error { if len(errors) > 0 { return AWSMultiError(errors) } + return nil } @@ -1015,6 +1024,7 @@ func (m *SES) validate(all bool) error { if len(errors) > 0 { return SESMultiError(errors) } + return nil } @@ -1119,6 +1129,7 @@ func (m *GitHubApp) validate(all bool) error { if len(errors) > 0 { return GitHubAppMultiError(errors) } + return nil } diff --git a/pkg/pb/detectorspb/detectors.pb.go b/pkg/pb/detectorspb/detectors.pb.go index 435a7805..1c3820e0 100644 --- a/pkg/pb/detectorspb/detectors.pb.go +++ b/pkg/pb/detectorspb/detectors.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.26.0 +// protoc v3.20.0 // source: detectors.proto package detectorspb diff --git a/pkg/pb/detectorspb/detectors.pb.validate.go b/pkg/pb/detectorspb/detectors.pb.validate.go index a1ba04c0..a6f31751 100644 --- a/pkg/pb/detectorspb/detectors.pb.validate.go +++ b/pkg/pb/detectorspb/detectors.pb.validate.go @@ -98,6 +98,7 @@ func (m *Result) validate(all bool) error { if len(errors) > 0 { return ResultMultiError(errors) } + return nil } @@ -264,6 +265,7 @@ func (m *StructuredData) validate(all bool) error { if len(errors) > 0 { return StructuredDataMultiError(errors) } + return nil } @@ -369,6 +371,7 @@ func (m *TlsPrivateKey) validate(all bool) error { if len(errors) > 0 { return TlsPrivateKeyMultiError(errors) } + return nil } @@ -472,6 +475,7 @@ func (m *GitHubSSHKey) validate(all bool) error { if len(errors) > 0 { return GitHubSSHKeyMultiError(errors) } + return nil } diff --git a/pkg/pb/source_metadatapb/source_metadata.pb.go b/pkg/pb/source_metadatapb/source_metadata.pb.go index 3f727f10..56769f3c 100644 --- a/pkg/pb/source_metadatapb/source_metadata.pb.go +++ b/pkg/pb/source_metadatapb/source_metadata.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.26.0 +// protoc v3.20.0 // source: source_metadata.proto package source_metadatapb diff --git a/pkg/pb/source_metadatapb/source_metadata.pb.validate.go b/pkg/pb/source_metadatapb/source_metadata.pb.validate.go index 3e87d607..44621546 100644 --- a/pkg/pb/source_metadatapb/source_metadata.pb.validate.go +++ b/pkg/pb/source_metadatapb/source_metadata.pb.validate.go @@ -69,6 +69,7 @@ func (m *Azure) validate(all bool) error { if len(errors) > 0 { return AzureMultiError(errors) } + return nil } @@ -187,6 +188,7 @@ func (m *Bitbucket) validate(all bool) error { if len(errors) > 0 { return BitbucketMultiError(errors) } + return nil } @@ -297,6 +299,7 @@ func (m *Buildkite) validate(all bool) error { if len(errors) > 0 { return BuildkiteMultiError(errors) } + return nil } @@ -409,6 +412,7 @@ func (m *CircleCI) validate(all bool) error { if len(errors) > 0 { return CircleCIMultiError(errors) } + return nil } @@ -519,6 +523,7 @@ func (m *Confluence) validate(all bool) error { if len(errors) > 0 { return ConfluenceMultiError(errors) } + return nil } @@ -629,6 +634,7 @@ func (m *Dockerhub) validate(all bool) error { if len(errors) > 0 { return DockerhubMultiError(errors) } + return nil } @@ -740,6 +746,7 @@ func (m *ECR) validate(all bool) error { if len(errors) > 0 { return ECRMultiError(errors) } + return nil } @@ -844,6 +851,7 @@ func (m *Filesystem) validate(all bool) error { if len(errors) > 0 { return FilesystemMultiError(errors) } + return nil } @@ -953,6 +961,7 @@ func (m *Git) validate(all bool) error { if len(errors) > 0 { return GitMultiError(errors) } + return nil } @@ -1066,6 +1075,7 @@ func (m *Github) validate(all bool) error { if len(errors) > 0 { return GithubMultiError(errors) } + return nil } @@ -1177,6 +1187,7 @@ func (m *Gitlab) validate(all bool) error { if len(errors) > 0 { return GitlabMultiError(errors) } + return nil } @@ -1282,6 +1293,7 @@ func (m *GCS) validate(all bool) error { if len(errors) > 0 { return GCSMultiError(errors) } + return nil } @@ -1391,6 +1403,7 @@ func (m *Jira) validate(all bool) error { if len(errors) > 0 { return JiraMultiError(errors) } + return nil } @@ -1498,6 +1511,7 @@ func (m *NPM) validate(all bool) error { if len(errors) > 0 { return NPMMultiError(errors) } + return nil } @@ -1605,6 +1619,7 @@ func (m *PyPi) validate(all bool) error { if len(errors) > 0 { return PyPiMultiError(errors) } + return nil } @@ -1712,6 +1727,7 @@ func (m *S3) validate(all bool) error { if len(errors) > 0 { return S3MultiError(errors) } + return nil } @@ -1823,6 +1839,7 @@ func (m *Slack) validate(all bool) error { if len(errors) > 0 { return SlackMultiError(errors) } + return nil } @@ -1932,6 +1949,7 @@ func (m *Gerrit) validate(all bool) error { if len(errors) > 0 { return GerritMultiError(errors) } + return nil } @@ -2031,6 +2049,7 @@ func (m *Test) validate(all bool) error { if len(errors) > 0 { return TestMultiError(errors) } + return nil } @@ -2136,6 +2155,7 @@ func (m *Jenkins) validate(all bool) error { if len(errors) > 0 { return JenkinsMultiError(errors) } + return nil } @@ -2247,6 +2267,7 @@ func (m *Teams) validate(all bool) error { if len(errors) > 0 { return TeamsMultiError(errors) } + return nil } @@ -2357,6 +2378,7 @@ func (m *Artifactory) validate(all bool) error { if len(errors) > 0 { return ArtifactoryMultiError(errors) } + return nil } @@ -3141,6 +3163,7 @@ func (m *MetaData) validate(all bool) error { if len(errors) > 0 { return MetaDataMultiError(errors) } + return nil } diff --git a/pkg/pb/sourcespb/sources.pb.go b/pkg/pb/sourcespb/sources.pb.go index 5ce08619..46fd7ba0 100644 --- a/pkg/pb/sourcespb/sources.pb.go +++ b/pkg/pb/sourcespb/sources.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.26.0 +// protoc v3.20.0 // source: sources.proto package sourcespb diff --git a/pkg/pb/sourcespb/sources.pb.validate.go b/pkg/pb/sourcespb/sources.pb.validate.go index 10de3544..c1c628e3 100644 --- a/pkg/pb/sourcespb/sources.pb.validate.go +++ b/pkg/pb/sourcespb/sources.pb.validate.go @@ -124,6 +124,7 @@ func (m *LocalSource) validate(all bool) error { if len(errors) > 0 { return LocalSourceMultiError(errors) } + return nil } @@ -294,6 +295,7 @@ func (m *AzureStorage) validate(all bool) error { if len(errors) > 0 { return AzureStorageMultiError(errors) } + return nil } @@ -473,6 +475,7 @@ func (m *Bitbucket) validate(all bool) error { if len(errors) > 0 { return BitbucketMultiError(errors) } + return nil } @@ -590,6 +593,7 @@ func (m *CircleCI) validate(all bool) error { if len(errors) > 0 { return CircleCIMultiError(errors) } + return nil } @@ -771,6 +775,7 @@ func (m *Confluence) validate(all bool) error { if len(errors) > 0 { return ConfluenceMultiError(errors) } + return nil } @@ -904,6 +909,7 @@ func (m *DockerHub) validate(all bool) error { if len(errors) > 0 { return DockerHubMultiError(errors) } + return nil } @@ -1036,6 +1042,7 @@ func (m *ECR) validate(all bool) error { if len(errors) > 0 { return ECRMultiError(errors) } + return nil } @@ -1134,6 +1141,7 @@ func (m *Filesystem) validate(all bool) error { if len(errors) > 0 { return FilesystemMultiError(errors) } + return nil } @@ -1238,6 +1246,7 @@ func (m *GCS) validate(all bool) error { if len(errors) > 0 { return GCSMultiError(errors) } + return nil } @@ -1401,6 +1410,7 @@ func (m *Git) validate(all bool) error { if len(errors) > 0 { return GitMultiError(errors) } + return nil } @@ -1579,6 +1589,7 @@ func (m *GitLab) validate(all bool) error { if len(errors) > 0 { return GitLabMultiError(errors) } + return nil } @@ -1761,6 +1772,7 @@ func (m *GitHub) validate(all bool) error { if len(errors) > 0 { return GitHubMultiError(errors) } + return nil } @@ -1967,6 +1979,7 @@ func (m *JIRA) validate(all bool) error { if len(errors) > 0 { return JIRAMultiError(errors) } + return nil } @@ -2100,6 +2113,7 @@ func (m *NPMUnauthenticatedPackage) validate(all bool) error { if len(errors) > 0 { return NPMUnauthenticatedPackageMultiError(errors) } + return nil } @@ -2236,6 +2250,7 @@ func (m *PyPIUnauthenticatedPackage) validate(all bool) error { if len(errors) > 0 { return PyPIUnauthenticatedPackageMultiError(errors) } + return nil } @@ -2433,6 +2448,7 @@ func (m *S3) validate(all bool) error { if len(errors) > 0 { return S3MultiError(errors) } + return nil } @@ -2549,6 +2565,7 @@ func (m *Slack) validate(all bool) error { if len(errors) > 0 { return SlackMultiError(errors) } + return nil } @@ -2646,6 +2663,7 @@ func (m *Test) validate(all bool) error { if len(errors) > 0 { return TestMultiError(errors) } + return nil } @@ -2751,6 +2769,7 @@ func (m *Buildkite) validate(all bool) error { if len(errors) > 0 { return BuildkiteMultiError(errors) } + return nil } @@ -2926,6 +2945,7 @@ func (m *Gerrit) validate(all bool) error { if len(errors) > 0 { return GerritMultiError(errors) } + return nil } @@ -3101,6 +3121,7 @@ func (m *Jenkins) validate(all bool) error { if len(errors) > 0 { return JenkinsMultiError(errors) } + return nil } @@ -3245,6 +3266,7 @@ func (m *Teams) validate(all bool) error { if len(errors) > 0 { return TeamsMultiError(errors) } + return nil } @@ -3421,6 +3443,7 @@ func (m *Artifactory) validate(all bool) error { if len(errors) > 0 { return ArtifactoryMultiError(errors) } + return nil }