From a16a1b5f0c6ca06f6869ab858585e702bab3b200 Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Thu, 30 Nov 2023 12:26:43 -0600 Subject: [PATCH] Add community/protobuf-c plugin (#934) Fixes #894. --- .github/workflows/arm64.yml | 5 ++--- .github/workflows/ci.yml | 5 ++--- .github/workflows/fetch_versions.yml | 5 ++--- .github/workflows/pr.yml | 5 ++--- go.mod | 10 +++++----- go.sum | 20 +++++++++---------- .../community/protobuf-c/v1.5.0/.dockerignore | 2 ++ .../community/protobuf-c/v1.5.0/Dockerfile | 20 +++++++++++++++++++ .../protobuf-c/v1.5.0/buf.plugin.yaml | 9 +++++++++ .../protobuf-c/v1.5.0/eliza/plugin.sum | 1 + .../protobuf-c/v1.5.0/petapis/plugin.sum | 1 + 11 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 plugins/community/protobuf-c/v1.5.0/.dockerignore create mode 100644 plugins/community/protobuf-c/v1.5.0/Dockerfile create mode 100644 plugins/community/protobuf-c/v1.5.0/buf.plugin.yaml create mode 100644 tests/testdata/buf.build/community/protobuf-c/v1.5.0/eliza/plugin.sum create mode 100644 tests/testdata/buf.build/community/protobuf-c/v1.5.0/petapis/plugin.sum diff --git a/.github/workflows/arm64.yml b/.github/workflows/arm64.yml index 33cb46002..bb97df507 100644 --- a/.github/workflows/arm64.yml +++ b/.github/workflows/arm64.yml @@ -38,9 +38,8 @@ jobs: go-version: '1.21' check-latest: true - name: Install buf cli - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} + run: | + go install github.com/bufbuild/buf/cmd/buf@v1.28.2-0.20231128013053-57a9b07c7833 - name: Set up QEMU uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 - name: Set up Docker Buildx diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 585c54fa4..ccf06c1ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,9 +71,8 @@ jobs: echo "PLUGINS=${val}" >> $GITHUB_ENV fi - name: Install buf cli - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} + run: | + go install github.com/bufbuild/buf/cmd/buf@v1.28.2-0.20231128013053-57a9b07c7833 - name: Set up QEMU uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 - name: Set up Docker Buildx diff --git a/.github/workflows/fetch_versions.yml b/.github/workflows/fetch_versions.yml index 0c34ecffe..2b4226b92 100644 --- a/.github/workflows/fetch_versions.yml +++ b/.github/workflows/fetch_versions.yml @@ -34,9 +34,8 @@ jobs: go-version: '1.21' check-latest: true - name: Install buf cli - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} + run: | + go install github.com/bufbuild/buf/cmd/buf@v1.28.2-0.20231128013053-57a9b07c7833 - name: Set up QEMU uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 - name: Set up Docker Buildx diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5a9059e5a..d689929f1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -65,9 +65,8 @@ jobs: echo "PLUGINS=${val}" >> $GITHUB_ENV fi - name: Install buf cli - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} + run: | + go install github.com/bufbuild/buf/cmd/buf@v1.28.2-0.20231128013053-57a9b07c7833 - name: Set up QEMU uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 - name: Set up Docker Buildx diff --git a/go.mod b/go.mod index f276b5c1d..9e752a28d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( aead.dev/minisign v0.2.1 - github.com/bufbuild/buf v1.28.1 + github.com/bufbuild/buf v1.28.2-0.20231128013053-57a9b07c7833 github.com/google/go-containerregistry v0.16.1 github.com/google/go-github/v53 v53.2.0 github.com/hashicorp/go-retryablehttp v0.7.5 @@ -31,7 +31,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/klauspost/compress v1.17.2 // indirect + github.com/klauspost/compress v1.17.3 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect @@ -41,9 +41,9 @@ require ( github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/vbatts/tar-split v0.11.5 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/crypto v0.15.0 // indirect golang.org/x/net v0.18.0 // indirect diff --git a/go.sum b/go.sum index d60d09d7a..a1ccd7560 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ aead.dev/minisign v0.2.1 h1:Z+7HA9dsY/eGycYj6kpWHpcJpHtjAwGiJFvbiuO9o+M= aead.dev/minisign v0.2.1/go.mod h1:oCOjeA8VQNEbuSCFaaUXKekOusa/mll6WtMoO5JY4M4= github.com/ProtonMail/go-crypto v0.0.0-20230619160724-3fbb1f12458c h1:figwFwYep1Qnl64Y+Rc8tyQWE0xvYAN+5EX+rD40pTU= github.com/ProtonMail/go-crypto v0.0.0-20230619160724-3fbb1f12458c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/bufbuild/buf v1.28.1 h1:JG+PjhaVz4bprGV1u//ZBDSxWwFnjrzjse2pmm4zBlI= -github.com/bufbuild/buf v1.28.1/go.mod h1:X/HDGbWUM2QiR5XvvsBfElUPblETOf96zq5H7FOUiP4= +github.com/bufbuild/buf v1.28.2-0.20231128013053-57a9b07c7833 h1:yhwyf/lXxMR77UNCAz/7IOXyzewKOm7ejhRhoE/E5Lw= +github.com/bufbuild/buf v1.28.2-0.20231128013053-57a9b07c7833/go.mod h1:fQFnl2YYLiG0bMirQTNZfnf5VFKUD674wKGlxR/hGGM= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= @@ -46,8 +46,8 @@ github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxC github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= -github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= -github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.3 h1:qkRjuerhUU1EmXLYGkSH6EZL+vPSxIrYjLNAK4slzwA= +github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -78,12 +78,12 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= diff --git a/plugins/community/protobuf-c/v1.5.0/.dockerignore b/plugins/community/protobuf-c/v1.5.0/.dockerignore new file mode 100644 index 000000000..5d0f124ff --- /dev/null +++ b/plugins/community/protobuf-c/v1.5.0/.dockerignore @@ -0,0 +1,2 @@ +* +!Dockerfile diff --git a/plugins/community/protobuf-c/v1.5.0/Dockerfile b/plugins/community/protobuf-c/v1.5.0/Dockerfile new file mode 100644 index 000000000..9685da264 --- /dev/null +++ b/plugins/community/protobuf-c/v1.5.0/Dockerfile @@ -0,0 +1,20 @@ +# syntax=docker/dockerfile:1.6 + +FROM debian:bookworm-20231120 AS build + +RUN apt-get update \ + && apt-get install -y build-essential curl libprotobuf-dev libprotoc-dev pkg-config protobuf-compiler + +WORKDIR /build +RUN curl -fsSL -o /tmp/protobuf-c.tar.gz https://github.com/protobuf-c/protobuf-c/releases/download/v1.5.0/protobuf-c-1.5.0.tar.gz \ + && tar zxf /tmp/protobuf-c.tar.gz \ + && cd protobuf-c-1.5.0 \ + && ./configure \ + && make LDFLAGS=-all-static -j$(nproc) \ + && make install \ + && strip /usr/local/bin/protoc-gen-c + +FROM gcr.io/distroless/cc-debian12:latest@sha256:a9056d2232d16e3772bec3ef36b93a5ea9ef6ad4b4ed407631e534b85832cf40 +COPY --from=build --link --chmod=0755 --chown=root:root /usr/local/bin/protoc-gen-c . +USER nobody +ENTRYPOINT ["/protoc-gen-c"] diff --git a/plugins/community/protobuf-c/v1.5.0/buf.plugin.yaml b/plugins/community/protobuf-c/v1.5.0/buf.plugin.yaml new file mode 100644 index 000000000..e7569af98 --- /dev/null +++ b/plugins/community/protobuf-c/v1.5.0/buf.plugin.yaml @@ -0,0 +1,9 @@ +version: v1 +name: buf.build/community/protobuf-c +plugin_version: v1.5.0 +source_url: https://github.com/protobuf-c/protobuf-c +description: Base types for C. Generates message and enum types. +output_languages: + - c +spdx_license_id: BSD-2-Clause +license_url: https://github.com/protobuf-c/protobuf-c/blob/v1.5.0/LICENSE diff --git a/tests/testdata/buf.build/community/protobuf-c/v1.5.0/eliza/plugin.sum b/tests/testdata/buf.build/community/protobuf-c/v1.5.0/eliza/plugin.sum new file mode 100644 index 000000000..7da48af18 --- /dev/null +++ b/tests/testdata/buf.build/community/protobuf-c/v1.5.0/eliza/plugin.sum @@ -0,0 +1 @@ +h1:lcP6Bt5ROGZY2Fwf6ny+0K7B3mSn4VodB8S8Xii4kqc= diff --git a/tests/testdata/buf.build/community/protobuf-c/v1.5.0/petapis/plugin.sum b/tests/testdata/buf.build/community/protobuf-c/v1.5.0/petapis/plugin.sum new file mode 100644 index 000000000..1c107d8fb --- /dev/null +++ b/tests/testdata/buf.build/community/protobuf-c/v1.5.0/petapis/plugin.sum @@ -0,0 +1 @@ +h1:2/bhljNpS3UjlXs+8yKHVA/kh8B+RzOt98vGHZFHwHs=