Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kuberlr for openSUSE:Factory checked in at 2022-01-11 00:01:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kuberlr (Old) and /work/SRC/openSUSE:Factory/.kuberlr.new.1892 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kuberlr" Tue Jan 11 00:01:44 2022 rev:3 rq:945261 version:0.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/kuberlr/kuberlr.changes 2020-09-14 12:19:40.576629995 +0200 +++ /work/SRC/openSUSE:Factory/.kuberlr.new.1892/kuberlr.changes 2022-01-11 00:02:13.345257631 +0100 @@ -1,0 +2,41 @@ +Fri Jan 07 15:40:49 UTC 2022 - ka...@b1-systems.de + +- Update to version 0.4.1: + * Tag release 0.4.1 + * Fixing issue of process holding on to file during rename + +------------------------------------------------------------------- +Fri Jan 07 15:36:26 UTC 2022 - ka...@b1-systems.de + +- Update to version 0.4.0: + * Release version 0.4.0 + * Fix error reporting inside of downloader + * Add `get` command + * Update github.com/blang/semver dependency + * Don't parse kubectl commandline with flag.Parse() + +------------------------------------------------------------------- +Fri Jan 07 15:32:02 UTC 2022 - ka...@b1-systems.de + +- Update to version 0.3.2: + * Tag version v0.3.2 + * Act on linter directives + * Copy the temp file to dest only if rename fails + * style improvements - no functional change + * download the hash before the document + * ioutil.TempFile returns an open file object + * Convert the sha mismatch error msg into a custom error + * When downloading versions of kubectl, verify their contents against known SHA256 hashes + * Remove vendored tree + * Allow to override build date with SOURCE_DATE_EPOCH + +------------------------------------------------------------------- +Fri Jan 7 14:44:42 UTC 2022 - Johannes Kastl <ka...@b1-systems.de> + +- BuildRequire go 1.16 or higher +- major overhaul of the package to adhere to common go build commands + - use 'buildmode=pie' + - strip binary + - do not use the Makefile, instead directly run the few commands + +------------------------------------------------------------------- Old: ---- kuberlr-0.3.1.tar.gz New: ---- kuberlr-0.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kuberlr.spec ++++++ --- /var/tmp/diff_new_pack.r0bhGm/_old 2022-01-11 00:02:14.069258266 +0100 +++ /var/tmp/diff_new_pack.r0bhGm/_new 2022-01-11 00:02:14.077258272 +0100 @@ -1,7 +1,7 @@ # # spec file for package kuberlr # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,8 +16,10 @@ # +%define __arch_install_post export NO_BRP_STRIP_DEBUG=true + Name: kuberlr -Version: 0.3.1 +Version: 0.4.1 Release: 0 Summary: A tool that simplifies the management of multiple versions of kubectl License: Apache-2.0 @@ -26,15 +28,14 @@ Source: %{name}-%{version}.tar.gz Source1: vendor.tar.gz BuildRequires: golang-packaging -BuildRequires: golang(API) = 1.13 +BuildRequires: golang(API) = 1.16 Requires(post): %fillup_prereq Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives %if 0%{?suse_version} <= 1500 Conflicts: kubernetes-client %endif Provides: kubernetes-client-provider = %{version} -%{go_nostrip} %description kuberlr (kube-ruler) is a simple wrapper for kubectl. Its main purpose is to @@ -42,17 +43,17 @@ %prep %setup -q -a1 +%setup -q -T -D -a 1 %build -export TAG="v%{version}" -export CLOSEST_TAG="v%{version}" -%make_build build +go build \ + -mod=vendor \ + -buildmode=pie \ + -ldflags="-X=github.com/flavio/kuberlr/pkg/kuberlr.Version=%{version}" \ + -o %{name} ./cmd/%{name} %install -export TAG="v%{version}" -export CLOSEST_TAG="v%{version}" -%make_install -install -D -m 0755 ~/go/bin/%{name} "%{buildroot}/%{_bindir}/%{name}" +install -D -m 0755 %{name} "%{buildroot}/%{_bindir}/%{name}" %if 0%{?suse_version} <= 1500 install -D -m 0644 %{name}.conf.example %{buildroot}/%{_sysconfdir}/%{name}.conf %else ++++++ _service ++++++ --- /var/tmp/diff_new_pack.r0bhGm/_old 2022-01-11 00:02:14.105258297 +0100 +++ /var/tmp/diff_new_pack.r0bhGm/_new 2022-01-11 00:02:14.109258300 +0100 @@ -5,7 +5,7 @@ <param name="exclude">vendor</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">[v]?([^\+]+)(.*)</param> - <param name="revision">v0.3.1</param> + <param name="revision">v0.4.1</param> <param name="changesgenerate">enable</param> </service> <service name="recompress" mode="disabled"> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.r0bhGm/_old 2022-01-11 00:02:14.125258315 +0100 +++ /var/tmp/diff_new_pack.r0bhGm/_new 2022-01-11 00:02:14.129258318 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/flavio/kuberlr</param> - <param name="changesrevision">cf1ff33c5318330e1086645ed8446b26d8ca21bc</param></service></servicedata> + <param name="changesrevision">e09d1c67e1054aa01d7ad1a0d906e09b75f03e1f</param></service></servicedata> (No newline at EOF) ++++++ kuberlr-0.3.1.tar.gz -> kuberlr-0.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/.github/workflows/tests.yml new/kuberlr-0.4.1/.github/workflows/tests.yml --- old/kuberlr-0.3.1/.github/workflows/tests.yml 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/.github/workflows/tests.yml 2021-08-17 18:44:05.000000000 +0200 @@ -24,4 +24,4 @@ run: make lint - name: Execute unit tests - run: go test -mod=vendor ./... + run: go test ./... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/.gitignore new/kuberlr-0.4.1/.gitignore --- old/kuberlr-0.3.1/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/kuberlr-0.4.1/.gitignore 2021-08-17 18:44:05.000000000 +0200 @@ -0,0 +1,30 @@ +# Mac OS X files +.DS_Store + +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +# Main project binary +/kuberlr + +# go releaser artifacts directory +dist/ + +# vim swap files +*.swp + +# Dependency directories (remove the comment below to include it) +# vendor/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/Changelog new/kuberlr-0.4.1/Changelog --- old/kuberlr-0.3.1/Changelog 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/Changelog 2021-08-17 18:44:05.000000000 +0200 @@ -1,3 +1,23 @@ +Tue Aug 17 18:42:51 CEST 2021 Flavio Castelli <fla...@castelli.me> + + * Release v0.4.1 + * Fix error when renaming file from tmp to final destination + (https://github.com/flavio/kuberlr/issues/13) + +Wed Aug 04 10:55:25 CEST 2021 Flavio Castelli <fla...@castelli.me> + + * Release v0.4.0 + * Add `get` sub-command: this allows users to download a specific + version of `kubectl` + * Fix parsing of global options of kubectl + * Fix error reporting of the download helper + +Tue Jun 22 10:59:56 CEST 2021 Flavio Castelli <fla...@castelli.me> + + * Release v0.3.2 + * Make download more resilient: verify the shasum of the downloaded + binary. + Mon Jul 27 17:43:08 CEST 2020 Flavio Castelli <fla...@castelli.me> * Release v0.3.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/Makefile new/kuberlr-0.4.1/Makefile --- old/kuberlr-0.3.1/Makefile 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/Makefile 2021-08-17 18:44:05.000000000 +0200 @@ -2,7 +2,7 @@ GO ?= GO111MODULE=$(GOMOD) go #Don't enable mod=vendor when GOMOD is off or else go build/install will fail -GOMODFLAG ?=-mod=vendor +GOMODFLAG ?= ifeq ($(GOMOD), off) GOMODFLAG= endif @@ -20,7 +20,12 @@ BINPATH := $(abspath ./bin) GOBINPATH := $(shell $(GO) env GOPATH)/bin COMMIT := $(shell git rev-parse HEAD) -BUILD_DATE := $(shell date +%Y%m%d) +DATE_FMT = +%Y%m%d +ifdef SOURCE_DATE_EPOCH + BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" $(DATE_FMT)) +else + BUILD_DATE ?= $(shell date $(DATE_FMT)) +endif # TAG can be provided as an envvar (provided in the .spec file) TAG ?= $(shell git describe --tags --exact-match HEAD 2> /dev/null) # CLOSEST_TAG can be provided as an envvar (provided in the .spec file) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/cmd/kuberlr/get.go new/kuberlr-0.4.1/cmd/kuberlr/get.go --- old/kuberlr-0.3.1/cmd/kuberlr/get.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kuberlr-0.4.1/cmd/kuberlr/get.go 2021-08-17 18:44:05.000000000 +0200 @@ -0,0 +1,40 @@ +package main + +import ( + "fmt" + "path/filepath" + + "github.com/blang/semver/v4" + "github.com/flavio/kuberlr/internal/common" + "github.com/flavio/kuberlr/internal/downloader" + "github.com/spf13/cobra" +) + +// NewGetCmd creates a new `kuberlr get` cobra command +func NewGetCmd() *cobra.Command { + return &cobra.Command{ + Use: "get [version to get]", + Short: "Download the kubectl version specified", + Args: cobra.ExactArgs(1), + SilenceUsage: true, + Example: ` + Download version 1.20.0. Note well: the patch version is automatically inferred: + $ kuberlr get 1.20 + + Versions can be specified with, or without the 'v' prefix: + $ kuberlr get v1.19.1`, + RunE: func(cmd *cobra.Command, args []string) error { + version, err := semver.ParseTolerant(args[0]) + if err != nil { + return fmt.Errorf("Invalid version: %v", err) + } + + destination := filepath.Join( + common.LocalDownloadDir(), + common.BuildKubectlNameForLocalBin(version)) + + d := downloader.Downloder{} + return d.GetKubectlBinary(version, destination) + }, + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/cmd/kuberlr/main.go new/kuberlr-0.4.1/cmd/kuberlr/main.go --- old/kuberlr-0.3.1/cmd/kuberlr/main.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/cmd/kuberlr/main.go 2021-08-17 18:44:05.000000000 +0200 @@ -1,13 +1,14 @@ package main import ( - "github.com/flavio/kuberlr/internal/osexec" - "github.com/spf13/cobra" - "k8s.io/klog" "os" "path/filepath" "strings" + "github.com/flavio/kuberlr/internal/osexec" + "github.com/spf13/cobra" + "k8s.io/klog" + "github.com/flavio/kuberlr/cmd/kuberlr/flags" "github.com/flavio/kuberlr/internal/config" "github.com/flavio/kuberlr/internal/finder" @@ -39,6 +40,7 @@ cmd.AddCommand( NewVersionCmd(), NewBinsCmd(), + NewGetCmd(), ) flags.RegisterVerboseFlag(cmd.PersistentFlags()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/go.mod new/kuberlr-0.4.1/go.mod --- old/kuberlr-0.3.1/go.mod 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/go.mod 2021-08-17 18:44:05.000000000 +0200 @@ -3,7 +3,7 @@ go 1.13 require ( - github.com/blang/semver v3.5.1+incompatible + github.com/blang/semver/v4 v4.0.0 github.com/gogo/protobuf v1.3.1 // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/googleapis/gnostic v0.1.0 // indirect @@ -15,9 +15,9 @@ github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.4.0 golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 // indirect - golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect - golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect k8s.io/client-go v0.17.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/go.sum new/kuberlr-0.4.1/go.sum --- old/kuberlr-0.3.1/go.sum 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/go.sum 2021-08-17 18:44:05.000000000 +0200 @@ -1,15 +1,12 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -22,8 +19,8 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -36,7 +33,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= @@ -55,7 +51,6 @@ github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -108,7 +103,6 @@ github.com/jedib0t/go-pretty/v6 v6.0.4/go.mod h1:MTr6FgcfNdnN5wPVBzJ6mhJeDyiF0yBvS2TMXEV/XSU= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -134,7 +128,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -220,7 +213,6 @@ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -234,8 +226,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= 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= @@ -256,15 +248,18 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w= -golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/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= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI= @@ -276,7 +271,6 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138 h1:H3uGjxCR/6Ds0Mjgyp7LMK81+LvmbvWWEnJhzk1Pi9E= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/common/error.go new/kuberlr-0.4.1/internal/common/error.go --- old/kuberlr-0.3.1/internal/common/error.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/common/error.go 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -package common - -type noVersionFound interface { - NoVersionFound() bool -} - -// NoVersionFoundError error is raised when no kubectl binary -// has yet been downloaded by kuberlr -type NoVersionFoundError struct { - Err error -} - -// Error returns a human description of the error -func (e *NoVersionFoundError) Error() string { - return "No local kubectl binaries available" -} - -// NoVersionFound returns true if the error is a NoVersionFoundError instance -func (e *NoVersionFoundError) NoVersionFound() bool { - return true -} - -// IsNoVersionFound returns true when the given error is of type -// NoVersionFoundError -func IsNoVersionFound(err error) bool { - t, ok := err.(noVersionFound) - return ok && t.NoVersionFound() -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/common/naming.go new/kuberlr-0.4.1/internal/common/naming.go --- old/kuberlr-0.3.1/internal/common/naming.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/common/naming.go 2021-08-17 18:44:05.000000000 +0200 @@ -4,7 +4,7 @@ "fmt" "github.com/flavio/kuberlr/internal/osexec" - "github.com/blang/semver" + "github.com/blang/semver/v4" ) // KubectlLocalNamingScheme holds the scheme used to name the kubectl binaries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/common/no_version_found_error.go new/kuberlr-0.4.1/internal/common/no_version_found_error.go --- old/kuberlr-0.3.1/internal/common/no_version_found_error.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kuberlr-0.4.1/internal/common/no_version_found_error.go 2021-08-17 18:44:05.000000000 +0200 @@ -0,0 +1,28 @@ +package common + +type noVersionFound interface { + NoVersionFound() bool +} + +// NoVersionFoundError error is raised when no kubectl binary +// has yet been downloaded by kuberlr +type NoVersionFoundError struct { + Err error +} + +// Error returns a human description of the error +func (e *NoVersionFoundError) Error() string { + return "No local kubectl binaries available" +} + +// NoVersionFound returns true if the error is a NoVersionFoundError instance +func (e *NoVersionFoundError) NoVersionFound() bool { + return true +} + +// IsNoVersionFound returns true when the given error is of type +// NoVersionFoundError +func IsNoVersionFound(err error) bool { + t, ok := err.(noVersionFound) + return ok && t.NoVersionFound() +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/common/sha_mismatch_error.go new/kuberlr-0.4.1/internal/common/sha_mismatch_error.go --- old/kuberlr-0.3.1/internal/common/sha_mismatch_error.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kuberlr-0.4.1/internal/common/sha_mismatch_error.go 2021-08-17 18:44:05.000000000 +0200 @@ -0,0 +1,32 @@ +package common + +import "fmt" + +type shaMismatch interface { + ShaMismatch() bool +} + +// ShaMismatchError error is raised when the downloaded kubectl's SHA +// doesn't match the recorded SHA +type ShaMismatchError struct { + URL string + ShaExpected string + ShaActual string +} + +// Error returns a human description of the error +func (e *ShaMismatchError) Error() string { + return fmt.Sprintf("SHA mismatch for URL %s: expected '%s', got '%s'", e.URL, e.ShaExpected, e.ShaActual) +} + +// ShaMismatch returns true if the error is a ShaMismatchError instance +func (e *ShaMismatchError) ShaMismatch() bool { + return true +} + +// IsShaMismatch returns true when the given error is of type +// ShaMismatchError +func IsShaMismatch(err error) bool { + t, ok := err.(shaMismatch) + return ok && t.ShaMismatch() +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/common/sha_mismatch_error_test.go new/kuberlr-0.4.1/internal/common/sha_mismatch_error_test.go --- old/kuberlr-0.3.1/internal/common/sha_mismatch_error_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kuberlr-0.4.1/internal/common/sha_mismatch_error_test.go 2021-08-17 18:44:05.000000000 +0200 @@ -0,0 +1,16 @@ +package common_test + +import ( + "github.com/flavio/kuberlr/internal/common" + "testing" +) + +func TestShaError(t *testing.T) { + err := &common.ShaMismatchError{URL: "https://example.com/resource-1.2.3", ShaExpected: "abc", ShaActual: "def"} + if !common.IsShaMismatch(err) { + t.Errorf("Expected error %v to be a ShaMismatchError", err) + } + if err.Error() != "SHA mismatch for URL https://example.com/resource-1.2.3: expected 'abc', got 'def'" { + t.Errorf("Expected error %v to have mismatch details ShaMismatchError", err) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/downloader/download.go new/kuberlr-0.4.1/internal/downloader/download.go --- old/kuberlr-0.3.1/internal/downloader/download.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/downloader/download.go 2021-08-17 18:44:05.000000000 +0200 @@ -1,8 +1,9 @@ package downloader import ( + "crypto/sha256" + "encoding/hex" "fmt" - "github.com/flavio/kuberlr/internal/osexec" "io" "io/ioutil" "net/http" @@ -10,9 +11,13 @@ "os" "path/filepath" "runtime" + "strings" "time" - "github.com/blang/semver" + "github.com/flavio/kuberlr/internal/common" + "github.com/flavio/kuberlr/internal/osexec" + + "github.com/blang/semver/v4" "github.com/schollz/progressbar/v3" ) @@ -20,23 +25,21 @@ // to hold the latest stable version of kubernetes released const KubectlStableURL = "https://storage.googleapis.com/kubernetes-release/release/stable.txt" -// Downloder is an helper class that is used to interact with the +// Downloder is a helper class that is used to interact with the // kubernetes infrastructure holding released binaries and release information type Downloder struct { } -// UpstreamStableVersion returns the latest version of kubernetes that upstream -// considers stable -func (d *Downloder) UpstreamStableVersion() (semver.Version, error) { - res, err := http.Get(KubectlStableURL) +func (d *Downloder) getContentsOfURL(url string) (string, error) { + res, err := http.Get(url) if err != nil { - return semver.Version{}, err + return "", err } if res.StatusCode != http.StatusOK { - return semver.Version{}, + return "", fmt.Errorf( "GET %s returned http status %s", - KubectlStableURL, + url, res.Status, ) } @@ -44,30 +47,59 @@ v, err := ioutil.ReadAll(res.Body) res.Body.Close() if err != nil { - return semver.Version{}, err + return "", err } + return string(v), nil +} - return semver.ParseTolerant(string(v)) +// UpstreamStableVersion returns the latest version of kubernetes that upstream +// considers stable +func (d *Downloder) UpstreamStableVersion() (semver.Version, error) { + v, err := d.getContentsOfURL(KubectlStableURL) + if err != nil { + return semver.Version{}, err + } + return semver.ParseTolerant(v) } // GetKubectlBinary downloads the kubectl binary identified by the given version // to the specified destination func (d *Downloder) GetKubectlBinary(version semver.Version, destination string) error { - downloadURL, err := d.kubectlDownloadURL(version) - if err != nil { - return err - } + var firstErr error + const maxNumTries = 3 + const timeToSleepOnRetryPerIter = 10 // seconds - if _, err := os.Stat(filepath.Dir(destination)); err != nil { - if os.IsNotExist(err) { - err = os.MkdirAll(filepath.Dir(destination), os.ModePerm) - } + for iter := 1; iter <= maxNumTries; iter++ { + downloadURL, err := d.kubectlDownloadURL(version) if err != nil { return err } - } - return d.download(fmt.Sprintf("kubectl%s%s", version, osexec.Ext), downloadURL, destination, 0755) + if _, err := os.Stat(filepath.Dir(destination)); err != nil { + if os.IsNotExist(err) { + err = os.MkdirAll(filepath.Dir(destination), os.ModePerm) + } + if err != nil { + return err + } + } + + err = d.download(fmt.Sprintf("kubectl%s%s", version, osexec.Ext), downloadURL, destination, 0755) + if err == nil { + return nil + } + if iter == 1 { + firstErr = err + } + if common.IsShaMismatch(err) { + // Try downloading an older subversion + fmt.Fprintf(os.Stderr, "Error on download attempt #%d: %s\n", iter, err) + time.Sleep(time.Duration(iter*timeToSleepOnRetryPerIter) * time.Second) + } else { + break + } + } + return firstErr } func (d *Downloder) kubectlDownloadURL(v semver.Version) (string, error) { @@ -89,6 +121,13 @@ } func (d *Downloder) download(desc, urlToGet, destination string, mode os.FileMode) error { + shaURLToGet := urlToGet + ".sha256" + shaExpected, err := d.getContentsOfURL(shaURLToGet) + if err != nil { + return fmt.Errorf("Error while trying to get contents of %s: %v", shaURLToGet, err) + } + shaExpected = strings.TrimRight(shaExpected, "\n") + req, err := http.NewRequest("GET", urlToGet, nil) if err != nil { return fmt.Errorf( @@ -111,14 +150,13 @@ resp.Status, ) } - - f, err := os.OpenFile(destination, os.O_CREATE|os.O_WRONLY, mode) + temporaryDestinationFile, err := ioutil.TempFile(os.TempDir(), "kuberlr-kubectl-") if err != nil { - return fmt.Errorf( - "Error while downloading %s to %s: %v", - urlToGet, destination, err) + return fmt.Errorf("Error trying to create temporary file in %s: %v", os.TempDir(), err) } - defer f.Close() + + tmpname := temporaryDestinationFile.Name() + defer os.Remove(tmpname) // write progress to stderr, writing to stdout would // break bash/zsh/shell completion @@ -135,7 +173,39 @@ fmt.Fprintln(os.Stderr, " done.") }), ) + hasher := sha256.New() - _, err = io.Copy(io.MultiWriter(f, bar), resp.Body) + _, err = io.Copy(io.MultiWriter(temporaryDestinationFile, bar, hasher), resp.Body) + if err != nil { + temporaryDestinationFile.Close() + return fmt.Errorf( + "Error while downloading text of %s into file %s: %v", + urlToGet, tmpname, err) + } + + // Closing the file handler prior to performing a rename so this process (the + // open file handler) does not conflict with the rename. + temporaryDestinationFile.Close() + + shaActual := hex.EncodeToString(hasher.Sum(nil)) + if shaExpected != shaActual { + return &common.ShaMismatchError{URL: urlToGet, ShaExpected: shaExpected, ShaActual: shaActual} + } + + err = os.Rename(tmpname, destination) + if err != nil { + linkErr, ok := err.(*os.LinkError) + if ok { + fmt.Fprintf(os.Stderr, "Cross-device error trying to rename a file: %s -- will do a full copy\n", linkErr) + tempInput, err := ioutil.ReadFile(tmpname) + if err != nil { + return fmt.Errorf("Error reading temporary file %s: %v", + tmpname, err) + } + err = ioutil.WriteFile(destination, tempInput, mode) + } + } else { + err = os.Chmod(destination, mode) + } return err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/filesystem_test.go.disabled new/kuberlr-0.4.1/internal/finder/filesystem_test.go.disabled --- old/kuberlr-0.3.1/internal/finder/filesystem_test.go.disabled 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/filesystem_test.go.disabled 2021-08-17 18:44:05.000000000 +0200 @@ -7,7 +7,7 @@ "strings" "testing" - "github.com/blang/semver" + "github.com/blang/semver/v4" "github.com/flavio/kuberlr/internal/common" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/kubectl.go new/kuberlr-0.4.1/internal/finder/kubectl.go --- old/kuberlr-0.3.1/internal/finder/kubectl.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/kubectl.go 2021-08-17 18:44:05.000000000 +0200 @@ -3,7 +3,7 @@ import ( "sort" - "github.com/blang/semver" + "github.com/blang/semver/v4" ) // KubectlBinary describes a kubectl binary diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/kubectl_finder.go new/kuberlr-0.4.1/internal/finder/kubectl_finder.go --- old/kuberlr-0.3.1/internal/finder/kubectl_finder.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/kubectl_finder.go 2021-08-17 18:44:05.000000000 +0200 @@ -10,7 +10,7 @@ "github.com/flavio/kuberlr/internal/common" - "github.com/blang/semver" + "github.com/blang/semver/v4" ) // KubectlFinder holds data about where to look the kubectl binaries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/kubectl_finder_test.go new/kuberlr-0.4.1/internal/finder/kubectl_finder_test.go --- old/kuberlr-0.3.1/internal/finder/kubectl_finder_test.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/kubectl_finder_test.go 2021-08-17 18:44:05.000000000 +0200 @@ -6,7 +6,7 @@ "os" "testing" - "github.com/blang/semver" + "github.com/blang/semver/v4" "github.com/flavio/kuberlr/internal/common" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/kubectl_test.go new/kuberlr-0.4.1/internal/finder/kubectl_test.go --- old/kuberlr-0.3.1/internal/finder/kubectl_test.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/kubectl_test.go 2021-08-17 18:44:05.000000000 +0200 @@ -3,7 +3,7 @@ import ( "testing" - "github.com/blang/semver" + "github.com/blang/semver/v4" ) func TestSortAsc(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/test_helper.go new/kuberlr-0.4.1/internal/finder/test_helper.go --- old/kuberlr-0.3.1/internal/finder/test_helper.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/test_helper.go 2021-08-17 18:44:05.000000000 +0200 @@ -6,7 +6,7 @@ "github.com/flavio/kuberlr/internal/common" - "github.com/blang/semver" + "github.com/blang/semver/v4" ) type kubectlNamer interface { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/versioner.go new/kuberlr-0.4.1/internal/finder/versioner.go --- old/kuberlr-0.3.1/internal/finder/versioner.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/versioner.go 2021-08-17 18:44:05.000000000 +0200 @@ -7,7 +7,7 @@ "github.com/flavio/kuberlr/internal/kubehelper" "path/filepath" - "github.com/blang/semver" + "github.com/blang/semver/v4" "k8s.io/klog" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/finder/versioner_test.go new/kuberlr-0.4.1/internal/finder/versioner_test.go --- old/kuberlr-0.3.1/internal/finder/versioner_test.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/finder/versioner_test.go 2021-08-17 18:44:05.000000000 +0200 @@ -5,7 +5,7 @@ "strings" "testing" - "github.com/blang/semver" + "github.com/blang/semver/v4" "github.com/flavio/kuberlr/internal/common" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/kubehelper/apiserver.go new/kuberlr-0.4.1/internal/kubehelper/apiserver.go --- old/kuberlr-0.3.1/internal/kubehelper/apiserver.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/kubehelper/apiserver.go 2021-08-17 18:44:05.000000000 +0200 @@ -1,7 +1,7 @@ package kubehelper import ( - "github.com/blang/semver" + "github.com/blang/semver/v4" ) // KubeAPI helps interactions with kubernetes API server diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kuberlr-0.3.1/internal/kubehelper/client.go new/kuberlr-0.4.1/internal/kubehelper/client.go --- old/kuberlr-0.3.1/internal/kubehelper/client.go 2020-07-27 17:44:43.000000000 +0200 +++ new/kuberlr-0.4.1/internal/kubehelper/client.go 2021-08-17 18:44:05.000000000 +0200 @@ -1,7 +1,8 @@ package kubehelper import ( - "flag" + "os" + "strings" "time" "k8s.io/client-go/kubernetes" @@ -11,8 +12,21 @@ func createKubeClient(timeout int64) (*kubernetes.Clientset, error) { var cliKubeconfig string - flag.StringVar(&cliKubeconfig, "kubeconfig", "", "absolute path to the kubeconfig file") - flag.Parse() + for i := 1; i < len(os.Args); i++ { + if i+1 < len(os.Args) && os.Args[i] == "--kubeconfig" { + cliKubeconfig = os.Args[i+1] + // don't break here; in case there are multiple --kubeconfig options, + // the last one takes precedence + continue + } + if strings.HasPrefix(os.Args[i], "--kubeconfig=") { + cliKubeconfig = strings.TrimPrefix(os.Args[i], "--kubeconfig=") + continue + } + if os.Args[i] == "--" { + break + } + } var restConfig *restclient.Config var err error ++++++ vendor.tar.gz ++++++ ++++ 93709 lines of diff (skipped)