From 6ed6c9b70e837db3e94d91eb09c45fcba4bb6b15 Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Sun, 17 Apr 2022 22:20:49 +0000 Subject: [PATCH] :seedling: Publish images with ko - Publish images with ko https://github.com/ossf/scorecard/issues/744 Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> --- .github/workflows/publishimage.yml | 58 ++++++++++++++++++++++++++++++ Makefile | 3 +- go.sum | 3 +- 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publishimage.yml diff --git a/.github/workflows/publishimage.yml b/.github/workflows/publishimage.yml new file mode 100644 index 00000000000..458170ed472 --- /dev/null +++ b/.github/workflows/publishimage.yml @@ -0,0 +1,58 @@ +# Copyright 2021 Security Scorecard Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: publishimage + +permissions: + contents: read + id-token: write + packages: write + +on: + push: + branches: + - main +env: + GO_VERSION: 1.17.7 + +jobs: + unit-test: + name: publishimage + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@bdb12b622a910dfdc99a31fdfe6f45a16bc287a4 # v1 + with: + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + + - name: Clone the code + uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # v2.3.4 + with: + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v2.2.0 + with: + go-version: ${{ env.GO_VERSION }} + - name: install ko + uses: imjasonh/setup-ko@2c3450ca27f6e6f2b02e72a40f2163c281a1f675 # v0.4 + - name: publishimage + uses: nick-invision/retry@7f8f3d9f0f62fe5925341be21c2e8314fd4f7c7c + with: + max_attempts: 3 + retry_on: error + timeout_minutes: 30 + command: | + go env -w GOFLAGS=-mod=mod + make install + make scorecard-ko diff --git a/Makefile b/Makefile index cba83c4877e..230cd723804 100644 --- a/Makefile +++ b/Makefile @@ -200,9 +200,8 @@ ko-build-everything: $(ko-targets) scorecard-ko: $(call create_kocache_path) - KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/scorecard LDFLAGS="$(LDFLAGS)" \ + KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) LDFLAGS="$(LDFLAGS)" \ KO_CACHE=$(KOCACHE_PATH) ko build -B \ - --push=false \ --sbom=none \ --platform=$(PLATFORM)\ --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4 diff --git a/go.sum b/go.sum index 2fa4cda48ef..ff879e1e5c8 100644 --- a/go.sum +++ b/go.sum @@ -1087,8 +1087,7 @@ github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpe github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= -github.com/maxbrunsfeld/counterfeiter/v6 v6.4.1 h1:hZD/8vBuw7x1WqRXD/WGjVjipbbo/HcDBgySYYbrUSk= -github.com/maxbrunsfeld/counterfeiter/v6 v6.4.1/go.mod h1:DK1Cjkc0E49ShgRVs5jy5ASrM15svSnem3K/hiSGD8o= +github.com/maxbrunsfeld/counterfeiter/v6 v6.5.0/go.mod h1:fJ0UAZc1fx3xZhU4eSHQDJ1ApFmTVhp5VTpV9tm2ogg= github.com/mcuadros/go-jsonschema-generator v0.0.0-20200330054847-ba7a369d4303 h1:mc6Th1b2xkPDUHTIUynE0LMJUgPEJdIDUjBLvj8yprs= github.com/mcuadros/go-jsonschema-generator v0.0.0-20200330054847-ba7a369d4303/go.mod h1:O6IeMrJ2EU+kDaxu7Dchbd0fbmrsTcjg8SGYFVJCr5A= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=