Skip to content

Commit

Permalink
fix: install tools using go.mod for versioning (#2562)
Browse files Browse the repository at this point in the history
* fix: install tools using go.mod for versioning

* Add helpful instructions for tool updates.

* Add comment

* Add boilerplate

* Update go.mod

* Gofmt feedback
  • Loading branch information
liam-verta authored Jun 14, 2023
1 parent e01e670 commit 5cbc063
Show file tree
Hide file tree
Showing 292 changed files with 44,523 additions and 3,788 deletions.
44 changes: 18 additions & 26 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,30 @@ ENV GOOS=$TARGETOS
ENV CGO_ENABLED=0
ENV GOBIN=/usr/local/bin

# Add .docker config dir
RUN mkdir -p /kaniko/.docker

COPY . .

# dependencies https://github.com/golang/go/issues/48332

# The versions of these tools and their transitive dependencies are controlled via go.mod.
# To update the version of any tool installed here, run
#
# go get <tool>@<commit-sha-or-tag>
# go mod vendor
#
# Then submit a PR with the changes to `go.mod`, `go.sum`, and `vendor`.

# Get GCR credential helper
# Until https://github.com/GoogleCloudPlatform/docker-credential-gcr/issues/128 is addressed, we need to use
# the existing compiled versions distributed in GitHub releases
ARG GCR_HELPER_VERSION="2.1.8"

# Checksums can be obtained from https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.8/checksums.txt
ARG GCR_HELPER_SHA_linux_amd64="0da9a0878d34dc8b38ae76519b7137f3179f573cf9c84fec1b81e973b565e2f9"
ARG GCR_HELPER_SHA_linux_386="2421d3242beb239eb640daf9dbfa4582416049a92ed93a207a0a3102fde4ea11"
ARG GCR_HELPER_SHA_linux_s390x="5d18e62c5952d43993b7ee292f87d812ccd161d4e9d932fbc1567eb5d5013632"
ARG GCR_HELPER_SHA_linux_arm64="9d0e67c18fb3e1e048120d06edb9e54e1c11f88139ec77dbc9830e8a8b31745c"

# There is no linux/ppc64le available for docker-credential-gcr, at least let's install it using go install pointing to the tag's commit
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
GCR_HELPER_COMMIT=$(git ls-remote -t https://github.com/GoogleCloudPlatform/docker-credential-gcr v$GCR_HELPER_VERSION | head -1 | awk '{print $1}') \
&& go install github.com/GoogleCloudPlatform/docker-credential-gcr@${GCR_HELPER_COMMIT}; \
else \
curl -fsSL -o /tmp/gcr-helper.tar.gz https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v${GCR_HELPER_VERSION}/docker-credential-gcr_${TARGETOS}_${TARGETARCH}-${GCR_HELPER_VERSION}.tar.gz \
&& eval "GCR_HELPER_SHA=\${GCR_HELPER_SHA_${TARGETOS}_${TARGETARCH}}" \
&& echo "${GCR_HELPER_SHA} /tmp/gcr-helper.tar.gz" | sha256sum -c - \
&& tar -xzf /tmp/gcr-helper.tar.gz --directory /usr/local/bin/; \
fi
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr

# Get Amazon ECR credential helper
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@adf1bafd791ae7d4ff098108b1e91f36a4da5404 # v0.7.1
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

# Get ACR docker env credential helper
RUN go install github.com/chrismellard/docker-credential-acr-env@82a0ddb2758901b711d9d1614755b77e401598a1

# Add .docker config dir
RUN mkdir -p /kaniko/.docker
RUN go install github.com/chrismellard/docker-credential-acr-env

COPY . .
RUN \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
Expand Down
27 changes: 22 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
module github.com/GoogleContainerTools/kaniko

go 1.17
go 1.19

require (
cloud.google.com/go/storage v1.30.1
github.com/Azure/azure-storage-blob-go v0.14.0
// This docker-credential-gcr dependency version is actually the same as v2.1.8.
// See https://github.com/GoogleCloudPlatform/docker-credential-gcr/issues/128
// To update run: go get github.com/GoogleCloudPlatform/docker-credential-gcr@<commit-sha>
// The version string is a side-effect of Go module version numbering rules. Functionality is otherwise unchanged.
github.com/GoogleCloudPlatform/docker-credential-gcr v1.5.1-0.20230328182921-62afb2723512
github.com/aws/aws-sdk-go-v2 v1.18.0
github.com/aws/aws-sdk-go-v2/config v1.18.25
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67
github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220228164355-396b2034c795
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001-adf1bafd791a
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589
github.com/containerd/cgroups v1.1.0 // indirect
github.com/docker/docker v23.0.5+incompatible
Expand Down Expand Up @@ -104,7 +109,6 @@ require (
github.com/googleapis/gax-go/v2 v2.10.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.2 // indirect
github.com/hashicorp/go-uuid v1.0.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down Expand Up @@ -157,14 +161,27 @@ require (

require (
github.com/Azure/azure-sdk-for-go v61.3.0+incompatible // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.15.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.12.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.18.10 // indirect
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.16.1 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/subcommands v1.2.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/moby/swarmkit/v2 v2.0.0-20230315203717-e28e8ba9bc83 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/skeema/knownhosts v1.1.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/toqueteos/webbrowser v1.2.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 5cbc063

Please sign in to comment.