diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f392566 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: 'release' + +on: + push: + tags: + - 'v*' + +permissions: + contents: 'write' + packages: 'write' + +jobs: + release: + runs-on: 'ubuntu-latest' + steps: + - uses: 'docker/setup-qemu-action@v2' + + - uses: 'actions/checkout@v3' + with: + fetch-depth: 0 + + - uses: 'actions/setup-go@v3' + with: + go-version: '1.19' + + - uses: 'docker/login-action@v2' + with: + registry: 'asia-docker.pkg.dev' + username: '_json_key' + password: '${{ secrets.GOOGLE_CREDENTIALS }}' + + - uses: 'docker/login-action@v2' + with: + registry: 'europe-docker.pkg.dev' + username: '_json_key' + password: '${{ secrets.GOOGLE_CREDENTIALS }}' + + - uses: 'docker/login-action@v2' + with: + registry: 'us-docker.pkg.dev' + username: '_json_key' + password: '${{ secrets.GOOGLE_CREDENTIALS }}' + + - id: 'import_gpg' + uses: 'crazy-max/ghaction-import-gpg@v5' + with: + gpg_private_key: '${{ secrets.GPG_PRIVATE_KEY }}' + passphrase: '${{ secrets.GPG_PASSPHRASE }}' + + - uses: 'goreleaser/goreleaser-action@v3' + with: + version: 'latest' + args: 'release --rm-dist' + env: + GPG_FINGERPRINT: '${{ steps.import_gpg.outputs.fingerprint }}' + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index deef5d4..94eeda0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,14 +3,16 @@ name: 'test' on: push: branches: - - 'main' - tags: - - '*' + - 'main' pull_request: branches: - - 'main' + - 'main' workflow_dispatch: +concurrency: + group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}' + cancel-in-progress: true + jobs: test: runs-on: 'ubuntu-latest' @@ -20,15 +22,8 @@ jobs: - uses: 'actions/setup-go@v3' with: - go-version: '1.18' + go-version: '1.19' - - uses: 'actions/cache@v3' - with: - path: |- - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: |- - ${{ runner.os }}-go- + - run: 'go mod download' - run: 'make test' diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..6e67aa1 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,253 @@ +before: + hooks: + - 'go mod tidy' + +builds: + # cli + - + id: 'cli' + env: + - 'CGO_ENABLED=0' + - 'GO111MODULE=on' + - 'GOPROXY=https://proxy.golang.org,direct' + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - '-a' + - '-trimpath' + ldflags: + - '-s' + - '-w' + - '-X={{ .ModulePath }}/internal/version.Name=gcr-cleaner-cli' + - '-X={{ .ModulePath }}/internal/version.Version={{ .Version }}' + - '-X={{ .ModulePath }}/internal/version.Commit={{ .FullCommit }}' + - '-extldflags=-static' + main: './cmd/gcr-cleaner-cli/...' + goos: + - 'darwin' + - 'linux' + - 'windows' + goarch: + - 'amd64' + - 'arm64' + + # server + - + id: 'server' + env: + - 'CGO_ENABLED=0' + - 'GO111MODULE=on' + - 'GOPROXY=https://proxy.golang.org,direct' + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - '-a' + - '-trimpath' + ldflags: + - '-s' + - '-w' + - '-X={{ .ModulePath }}/internal/version.Name=gcr-cleaner' + - '-X={{ .ModulePath }}/internal/version.Version={{ .Version }}' + - '-X={{ .ModulePath }}/internal/version.Commit={{ .FullCommit }}' + - '-extldflags=-static' + main: './cmd/gcr-cleaner-server/...' + goos: + - 'darwin' + - 'linux' + - 'windows' + goarch: + - 'amd64' + - 'arm64' + +dockers: + # cli + - + use: 'buildx' + goos: 'linux' + goarch: 'amd64' + dockerfile: 'docker/cli.dockerfile' + ids: + - 'cli' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-amd64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-amd64' + build_flag_templates: + - '--platform=linux/amd64' + - '--pull' + - '--label=org.opencontainers.image.created={{ .CommitTimestamp }}' + - '--label=org.opencontainers.image.description=gcr-cleaner deletes untagged images in Docker container registries.' + - '--label=org.opencontainers.image.licenses=Apache-2.0' + - '--label=org.opencontainers.image.name=gcr-cleaner' + - '--label=org.opencontainers.image.revision={{ .FullCommit }}' + - '--label=org.opencontainers.image.source={{ .GitURL }}' + - '--label=org.opencontainers.image.title=gcr-cleaner' + - '--label=org.opencontainers.image.version={{ .Version }}' + - + use: 'buildx' + goos: 'linux' + goarch: 'arm64' + dockerfile: 'docker/cli.dockerfile' + ids: + - 'cli' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-arm64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-arm64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-arm64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-arm64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-arm64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-arm64' + build_flag_templates: + - '--platform=linux/arm64' + - '--pull' + - '--label=org.opencontainers.image.created={{ .CommitTimestamp }}' + - '--label=org.opencontainers.image.description=gcr-cleaner deletes untagged images in Docker container registries.' + - '--label=org.opencontainers.image.licenses=Apache-2.0' + - '--label=org.opencontainers.image.name=gcr-cleaner' + - '--label=org.opencontainers.image.revision={{ .FullCommit }}' + - '--label=org.opencontainers.image.source={{ .GitURL }}' + - '--label=org.opencontainers.image.title=gcr-cleaner' + - '--label=org.opencontainers.image.version={{ .Version }}' + + # server + - + use: 'buildx' + goos: 'linux' + goarch: 'amd64' + dockerfile: 'docker/server.dockerfile' + ids: + - 'server' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-amd64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-amd64' + build_flag_templates: + - '--platform=linux/amd64' + - '--pull' + - '--label=org.opencontainers.image.created={{ .CommitTimestamp }}' + - '--label=org.opencontainers.image.description=gcr-cleaner deletes untagged images in Docker container registries.' + - '--label=org.opencontainers.image.licenses=Apache-2.0' + - '--label=org.opencontainers.image.name=gcr-cleaner' + - '--label=org.opencontainers.image.revision={{ .FullCommit }}' + - '--label=org.opencontainers.image.source={{ .GitURL }}' + - '--label=org.opencontainers.image.title=gcr-cleaner' + - '--label=org.opencontainers.image.version={{ .Version }}' + - + use: 'buildx' + goos: 'linux' + goarch: 'arm64' + dockerfile: 'docker/server.dockerfile' + ids: + - 'server' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-arm64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-arm64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-arm64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-arm64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-arm64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-arm64' + build_flag_templates: + - '--platform=linux/arm64' + - '--pull' + - '--label=org.opencontainers.image.created={{ .CommitTimestamp }}' + - '--label=org.opencontainers.image.description=gcr-cleaner deletes untagged images in Docker container registries.' + - '--label=org.opencontainers.image.licenses=Apache-2.0' + - '--label=org.opencontainers.image.name=gcr-cleaner' + - '--label=org.opencontainers.image.revision={{ .FullCommit }}' + - '--label=org.opencontainers.image.source={{ .GitURL }}' + - '--label=org.opencontainers.image.title=gcr-cleaner' + - '--label=org.opencontainers.image.version={{ .Version }}' + +docker_manifests: + # cli + - + name_template: 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-amd64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-arm64' + - + name_template: 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-amd64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-arm64' + - + name_template: 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}' + image_templates: + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-arm64' + - + name_template: 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest' + image_templates: + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-arm64' + - + name_template: 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}' + image_templates: + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:{{ .Version }}-arm64' + - + name_template: 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest' + image_templates: + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:latest-arm64' + + # server + - + name_template: 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-amd64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-arm64' + - + name_template: 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest' + image_templates: + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-amd64' + - 'asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-arm64' + - + name_template: 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}' + image_templates: + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-arm64' + - + name_template: 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest' + image_templates: + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-amd64' + - 'europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-arm64' + - + name_template: 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}' + image_templates: + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:{{ .Version }}-arm64' + - + name_template: 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest' + image_templates: + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-amd64' + - 'us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner:latest-arm64' + +archives: + - format: 'tar.gz' + name_template: 'gcr-cleaner_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + format_overrides: + - goos: 'windows' + format: 'zip' + +checksum: + name_template: 'gcr-cleaner_{{ .Version }}_SHA512SUMS' + algorithm: 'sha512' + +signs: + - artifacts: 'checksum' + args: + - '--batch' + - '--local-user' + - '{{ .Env.GPG_FINGERPRINT }}' + - '--output' + - '${signature}' + - '--detach-sign' + - '${artifact}' + +release: + draft: false diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1dbb84b..0000000 --- a/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2019 The GCR Cleaner 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. - -FROM golang:1.18 AS builder - -ARG SERVICE - -ENV GO111MODULE=on \ - GOPROXY=https://proxy.golang.org,direct \ - CGO_ENABLED=0 \ - GOOS=linux \ - GOARCH=amd64 - -WORKDIR /src -COPY . . - -RUN go build \ - -a \ - -trimpath \ - -ldflags "-s -w -extldflags=-static" \ - -o /bin/gcrcleaner \ - ./cmd/${SERVICE} - -RUN strip -s /bin/gcrcleaner - - - -FROM scratch -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=builder /bin/gcrcleaner /bin/gcrcleaner - -ENV PORT 8080 - -ENTRYPOINT ["/bin/gcrcleaner"] diff --git a/Makefile b/Makefile index 9e24b0c..85057e8 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,7 @@ -# Copyright 2019 The GCR Cleaner 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. - -docker-push: - @gcloud builds submit \ - --project "gcr-cleaner" \ - --config ./cloudbuild/cloudbuild.yaml \ - . -.PHONY: docker-push - test: @go test \ -count=1 \ -race \ -shuffle=on \ - -timeout=10m \ ./... .PHONY: test diff --git a/README.md b/README.md index 56535ae..2c082a5 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,22 @@ Pre-built container images are available at the following locations. We do not offer versioned container images. ```text -gcr.io/gcr-cleaner/gcr-cleaner asia-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner ``` -## Payload & parameters +## Server Payload & parameters + +**⚠️ This section is for the _server_ payload. If you are using the CLI tool, +run `gcr-cleaner -h` to see the list of flags and their descriptions.** The payload is expected to be JSON with the following fields: - `repos` - List of the full names of the repositories to clean (e.g. - `["gcr.io/project/repo"]`. This field is required. + `["us-docker.pkg.dev/project/my/repo", "gcr.io/my/repo"]`. This field is + required. - `grace` - Relative duration in which to ignore references. This value is specified as a time duration value like "5s" or "3h". If set, refs newer than diff --git a/cloudbuild/cloudbuild.yaml b/cloudbuild/cloudbuild.yaml deleted file mode 100644 index cbd4c09..0000000 --- a/cloudbuild/cloudbuild.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2020 The GCR Cleaner 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. - -steps: -- id: 'build-cli' - name: 'docker:20' - args: [ - 'build', - '--build-arg', 'SERVICE=gcr-cleaner-cli', - '--tag', 'gcr.io/${PROJECT_ID}/gcr-cleaner-cli', - '--tag', 'asia-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner-cli', - '--tag', 'europe-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner-cli', - '--tag', 'us-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner-cli', - '.' - ] - waitFor: ['-'] - -- id: 'build-server' - name: 'docker:20' - args: [ - 'build', - '--build-arg', 'SERVICE=gcr-cleaner-server', - '--tag', 'gcr.io/${PROJECT_ID}/gcr-cleaner', - '--tag', 'asia-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner', - '--tag', 'europe-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner', - '--tag', 'us-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner', - '.' - ] - waitFor: ['-'] - -- id: 'push-cli' - name: 'docker:20' - entrypoint: '/bin/sh' - args: - - '-euo' - - 'pipefail' - - '-c' - - |- - docker push gcr.io/${PROJECT_ID}/gcr-cleaner-cli - docker push asia-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner-cli - docker push europe-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner-cli - docker push us-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner-cli - waitFor: ['build-cli'] - -- id: 'push-server' - name: 'docker:20' - entrypoint: '/bin/sh' - args: - - '-euo' - - 'pipefail' - - '-c' - - |- - docker push gcr.io/${PROJECT_ID}/gcr-cleaner - docker push asia-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner - docker push europe-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner - docker push us-docker.pkg.dev/${PROJECT_ID}/gcr-cleaner/gcr-cleaner - waitFor: ['build-server'] diff --git a/cmd/gcr-cleaner-cli/main.go b/cmd/gcr-cleaner-cli/main.go index 75dce37..3e2501b 100644 --- a/cmd/gcr-cleaner-cli/main.go +++ b/cmd/gcr-cleaner-cli/main.go @@ -28,6 +28,7 @@ import ( "time" "github.com/GoogleCloudPlatform/gcr-cleaner/internal/bearerkeychain" + "github.com/GoogleCloudPlatform/gcr-cleaner/internal/version" "github.com/GoogleCloudPlatform/gcr-cleaner/pkg/gcrcleaner" gcrauthn "github.com/google/go-containerregistry/pkg/authn" gcrgoogle "github.com/google/go-containerregistry/pkg/v1/google" @@ -52,6 +53,7 @@ var ( tagFilterAll = flag.String("tag-filter-all", "", "Delete images where all tags match this regular expression") keepPtr = flag.Int("keep", 0, "Minimum to keep") dryRunPtr = flag.Bool("dry-run", false, "Do a noop on delete api call") + versionPtr = flag.Bool("version", false, "Print version information and exit") ) func main() { @@ -88,6 +90,11 @@ func main() { flag.Parse() + if *versionPtr { + fmt.Fprintf(stderr, "%s\n", version.HumanVersion) + os.Exit(0) + } + if err := realMain(ctx, logger); err != nil { cancel() diff --git a/docker/cli.dockerfile b/docker/cli.dockerfile new file mode 100644 index 0000000..e5e33d2 --- /dev/null +++ b/docker/cli.dockerfile @@ -0,0 +1,11 @@ +FROM --platform=$BUILDPLATFORM alpine AS builder + +RUN apk --no-cache --update add ca-certificates && \ + update-ca-certificates + + +FROM scratch +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY gcr-cleaner-cli /bin/gcr-cleaner-cli + +ENTRYPOINT ["/bin/gcr-cleaner-cli"] diff --git a/docker/server.dockerfile b/docker/server.dockerfile new file mode 100644 index 0000000..55852ad --- /dev/null +++ b/docker/server.dockerfile @@ -0,0 +1,13 @@ +FROM --platform=$BUILDPLATFORM alpine AS builder + +RUN apk --no-cache --update add ca-certificates && \ + update-ca-certificates + + +FROM scratch +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY gcr-cleaner /bin/gcr-cleaner + +ENV PORT 8080 + +ENTRYPOINT ["/bin/gcr-cleaner"] diff --git a/docs/deploy-cloud-run.md b/docs/deploy-cloud-run.md index 3c43754..98d3be2 100644 --- a/docs/deploy-cloud-run.md +++ b/docs/deploy-cloud-run.md @@ -84,7 +84,6 @@ also a community-supported [Terraform module for gcr-cleaner][tf-module]. ```sh # Replace this with the full name of the repository for which you # want to cleanup old references, for example: - export REPO="gcr.io/${PROJECT_ID}/my-image" export REPO="us-docker-pkg.dev/${PROJECT_ID}/my-repo/my-image" ``` diff --git a/go.mod b/go.mod index 95e046d..798aaa6 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,14 @@ module github.com/GoogleCloudPlatform/gcr-cleaner -go 1.18 +go 1.19 require ( - github.com/google/go-containerregistry v0.10.0 - golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f + github.com/google/go-containerregistry v0.11.0 + golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde ) require ( - cloud.google.com/go/compute v1.7.0 // indirect + cloud.google.com/go/compute v1.9.0 // indirect github.com/docker/cli v20.10.17+incompatible // indirect github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v20.10.17+incompatible // indirect @@ -19,9 +19,9 @@ require ( github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/sirupsen/logrus v1.9.0 // indirect - golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect - golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92 // indirect - golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect + golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect + golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 // indirect + golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/go.sum b/go.sum index c372010..21a6024 100644 --- a/go.sum +++ b/go.sum @@ -26,29 +26,18 @@ cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSU cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= -cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= -cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.9.0 h1:ED/FP4xv8GJw63v556/ASNc1CeeLUO2Bs8nzaHchkHg= +cloud.google.com/go/compute v1.9.0/go.mod h1:lWv1h/zUWTm/LozzfTJhBSkd6ShQq8la8VeeuOEGxfY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= -cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -60,7 +49,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Antonboom/errname v0.1.5/go.mod h1:DugbBstvPFQbv/5uLcRRzfrNqKE9tVdVCqWCLp6Cifo= @@ -119,14 +107,9 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/containerd/stargz-snapshotter/estargz v0.11.4 h1:LjrYUZpyOhiSaU7hHrdR82/RBoxfGWSaC0VeSSMXqnk= +github.com/containerd/stargz-snapshotter/estargz v0.12.0 h1:idtwRTLjk2erqiYhPWy2L844By8NRFYEwYHcXhoIWPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -166,8 +149,6 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.3/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+M1LBpeZE= @@ -278,11 +259,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-containerregistry v0.10.0 h1:qd/fv2nQajGZJenaNcdaghlwSPjQ0NphN9hzArr2WWg= -github.com/google/go-containerregistry v0.10.0/go.mod h1:C7uwbB1QUAtvnknyd3ethxJRd4gtEjU/9WLXzckfI1Y= +github.com/google/go-containerregistry v0.11.0 h1:Xt8x1adcREjFcmDoDK8OdOsjxu90PHkGuwNP8GiHMLM= +github.com/google/go-containerregistry v0.11.0/go.mod h1:BBaYtsHPHA42uEgAvd/NejvAfPSlz281sJWqupjSxfk= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -310,15 +289,9 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= @@ -414,7 +387,7 @@ github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.4 h1:1kn4/7MepF/CHmYub99/nNX8az0IJjfSOU/jbnTVfqQ= +github.com/klauspost/compress v1.15.8 h1:JahtItbkWjf2jzm/T+qgMxkP9EMHsqEUA6vCMGmXvhA= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -802,14 +775,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0= -golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220812174116-3211cb980234 h1:RDqmgfe7SvlMWoqC3xwQ2blLO3fcWcxMa3eBLRdRW7E= +golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -826,13 +793,8 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92 h1:oVlhw3Oe+1reYsE2Nqu19PDJfLzwdU3QUUrG86rLK68= -golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 h1:dtndE8FcEta75/4kHF3AbpuWzV6f1LjnLrM4pe2SZrw= +golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -845,8 +807,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -920,28 +882,15 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 h1:Sx/u41w+OwrInGdEckYmEuU5gHoGSL4QbDz3S9s6j4U= +golang.org/x/sys v0.0.0-20220818161305-2296e01440c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1061,9 +1010,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1092,19 +1038,7 @@ google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtuk google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1159,7 +1093,6 @@ google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= @@ -1173,31 +1106,6 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1227,12 +1135,6 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1247,8 +1149,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..1e3314f --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,15 @@ +package version + +var ( + // Name is the name of the binary. + Name = "gcr-cleaner" + + // Version is the main package version. + Version = "source" + + // Commit is the git sha. + Commit = "HEAD" + + // HumanVersion is the compiled version. + HumanVersion = Name + " v" + Version + " (" + Commit + ")" +) diff --git a/pkg/gcrcleaner/cleaner.go b/pkg/gcrcleaner/cleaner.go index 8af730e..dc4df29 100644 --- a/pkg/gcrcleaner/cleaner.go +++ b/pkg/gcrcleaner/cleaner.go @@ -23,6 +23,7 @@ import ( "sync" "time" + "github.com/GoogleCloudPlatform/gcr-cleaner/internal/version" gcrauthn "github.com/google/go-containerregistry/pkg/authn" gcrname "github.com/google/go-containerregistry/pkg/name" gcrgoogle "github.com/google/go-containerregistry/pkg/v1/google" @@ -39,6 +40,10 @@ import ( // [2]: https://buildpacks.io/docs/features/reproducibility/ var dockerExistence = time.Date(2013, time.March, 20, 0, 0, 0, 0, time.UTC) +// userAgent is the HTTP user agent. +var userAgent = fmt.Sprintf("%s/%s (+https://github.com/GoogleCloudPlatform/gcr-cleaner)", + version.Name, version.Version) + // Cleaner is a gcr cleaner. type Cleaner struct { keychain gcrauthn.Keychain @@ -71,6 +76,7 @@ func (c *Cleaner) Clean(ctx context.Context, repo string, since time.Time, keep tags, err := gcrgoogle.List(gcrrepo, gcrgoogle.WithContext(ctx), + gcrgoogle.WithUserAgent(userAgent), gcrgoogle.WithAuthFromKeychain(c.keychain)) if err != nil { return nil, fmt.Errorf("failed to list tags for repo %s: %w", repo, err) @@ -221,6 +227,7 @@ type manifest struct { // deleteOne deletes a single repo ref using the supplied auth. func (c *Cleaner) deleteOne(ctx context.Context, ref gcrname.Reference) error { if err := gcrremote.Delete(ref, + gcrremote.WithUserAgent(userAgent), gcrremote.WithAuthFromKeychain(c.keychain), gcrremote.WithContext(ctx)); err != nil { return fmt.Errorf("failed to delete %s: %w", ref, err) @@ -328,6 +335,7 @@ func (c *Cleaner) ListChildRepositories(ctx context.Context, roots []string) ([] // List all repos in the registry. allRepos, err := gcrremote.Catalog(ctx, *registry, + gcrremote.WithUserAgent(userAgent), gcrremote.WithAuthFromKeychain(c.keychain), gcrremote.WithContext(ctx)) if err != nil { diff --git a/pkg/gcrcleaner/server.go b/pkg/gcrcleaner/server.go index 9b691ff..1b674e9 100644 --- a/pkg/gcrcleaner/server.go +++ b/pkg/gcrcleaner/server.go @@ -25,6 +25,8 @@ import ( "sort" "strings" "time" + + "github.com/GoogleCloudPlatform/gcr-cleaner/internal/version" ) const ( @@ -130,6 +132,8 @@ func (s *Server) HTTPHandler() http.HandlerFunc { // clean reads the given body as JSON and starts a cleaner instance. func (s *Server) clean(ctx context.Context, r io.ReadCloser) (map[string][]string, int, error) { + s.logger.Debug("starting clean request", "version", version.HumanVersion) + var p Payload if err := json.NewDecoder(r).Decode(&p); err != nil { return nil, 500, fmt.Errorf("failed to decode payload as JSON: %w", err)