diff --git a/Jenkinsfile.public b/Jenkinsfile.public index a670f3e9e..bf874928c 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -151,15 +151,15 @@ pipeline { steps { // verify most of the commands, we cannot check everything since some of them // have a C dependency and we don't have cross-compilation in storj/ci image - sh 'GOOS=linux GOARCH=386 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=linux GOARCH=amd64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=linux GOARCH=arm go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=linux GOARCH=arm64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=windows GOARCH=386 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=windows GOARCH=amd64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=windows GOARCH=arm64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=darwin GOARCH=amd64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' - sh 'GOOS=darwin GOARCH=arm64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng' + sh 'GOOS=linux GOARCH=386 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=linux GOARCH=amd64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=linux GOARCH=arm go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=linux GOARCH=arm64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=windows GOARCH=386 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=windows GOARCH=amd64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=windows GOARCH=arm64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=darwin GOARCH=amd64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' + sh 'GOOS=darwin GOARCH=arm64 go vet ./cmd/uplink ./cmd/satellite ./cmd/uplinkng ./cmd/storagenode-updater ./cmd/storj-sim' } } stage('Tests') { diff --git a/cmd/storagenode-updater/loop_windows.go b/cmd/storagenode-updater/loop_windows.go index c070a7150..2352cf819 100644 --- a/cmd/storagenode-updater/loop_windows.go +++ b/cmd/storagenode-updater/loop_windows.go @@ -41,11 +41,6 @@ func loopFunc(ctx context.Context) error { } func updateSelf(ctx context.Context, binaryLocation string, ver version.Process) error { - suggestedVersion, err := ver.Suggested.SemVer() - if err != nil { - return errs.Wrap(err) - } - currentVersion, err := binaryVersion(binaryLocation) if err != nil { return errs.Wrap(err) @@ -57,18 +52,18 @@ func updateSelf(ctx context.Context, binaryLocation string, ver version.Process) ) // should update - shouldUpdate, reason, err := version.ShouldUpdateVersion(currentVersion, nodeID, ver) + newVersion, reason, err := version.ShouldUpdateVersion(currentVersion, nodeID, ver) if err != nil { return errs.Wrap(err) } - if !shouldUpdate { + if newVersion.IsZero() { zap.L().Info(reason, zap.String("Service", updaterServiceName)) return nil } - newVersionPath := prependExtension(binaryLocation, ver.Suggested.Version) + newVersionPath := prependExtension(binaryLocation, newVersion.Version) - if err = downloadBinary(ctx, parseDownloadURL(ver.Suggested.URL), newVersionPath); err != nil { + if err = downloadBinary(ctx, parseDownloadURL(newVersion.URL), newVersionPath); err != nil { return errs.Wrap(err) } @@ -77,11 +72,13 @@ func updateSelf(ctx context.Context, binaryLocation string, ver version.Process) return errs.Combine(errs.Wrap(err), os.Remove(newVersionPath)) } - if suggestedVersion.Compare(downloadedVersion) != 0 { - err := errs.New("invalid version downloaded: wants %s got %s", - suggestedVersion.String(), - downloadedVersion.String(), - ) + newSemVer, err := newVersion.SemVer() + if err != nil { + return errs.Combine(err, os.Remove(newVersionPath)) + } + + if newSemVer.Compare(downloadedVersion) != 0 { + err := errs.New("invalid version downloaded: wants %s got %s", newVersion.Version, downloadedVersion) return errs.Combine(err, os.Remove(newVersionPath)) } diff --git a/cmd/storagenode-updater/update.go b/cmd/storagenode-updater/update.go index 3f7913a33..bd39af548 100644 --- a/cmd/storagenode-updater/update.go +++ b/cmd/storagenode-updater/update.go @@ -51,10 +51,7 @@ func update(ctx context.Context, serviceName, binaryLocation string, ver version } if newSemVer.Compare(downloadedVersion) != 0 { - err := errs.New("invalid version downloaded: wants %s got %s", - newVersion.Version, - downloadedVersion.String(), - ) + err := errs.New("invalid version downloaded: wants %s got %s", newVersion.Version, downloadedVersion) return errs.Combine(err, os.Remove(newVersionPath)) }