Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #69

Merged
merged 4 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildutil
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

cd $(dirname "$0")

VERSION="v2.6.0"
VERSION="v3.4.0"

get_arch() {
ARCH=$(uname -m)
Expand Down
4 changes: 2 additions & 2 deletions cmd/buildutil/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func ParseS3URL(raw string) (*S3URL, error) {

return &S3URL{
Bucket: u.Host,
Key: path.Clean("/" + u.Path),
Key: strings.TrimPrefix(path.Clean(u.Path), "/"),
svenwltr marked this conversation as resolved.
Show resolved Hide resolved
}, nil
}

Expand All @@ -397,7 +397,7 @@ func (u S3URL) Subpath(p ...string) S3URL {
}

func (u S3URL) String() string {
return fmt.Sprintf("s3://%s%s", u.Bucket, u.Key)
return fmt.Sprintf("s3://%s/%s", u.Bucket, u.Key)
svenwltr marked this conversation as resolved.
Show resolved Hide resolved
}

func (u S3URL) MarshalJSON() ([]byte, error) {
Expand Down
36 changes: 20 additions & 16 deletions cmd/buildutil/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import (
"path/filepath"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/goreleaser/nfpm"
_ "github.com/goreleaser/nfpm/deb" // blank import to register the format
_ "github.com/goreleaser/nfpm/rpm" // blank import to register the format
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/goreleaser/nfpm/v2"
_ "github.com/goreleaser/nfpm/v2/deb" // blank import to register the format
"github.com/goreleaser/nfpm/v2/files"
_ "github.com/goreleaser/nfpm/v2/rpm" // blank import to register the format
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -276,10 +278,15 @@ func (r *Runner) RunArtifacts(ctx context.Context, cmd *cobra.Command, args []st
case "deb":
version, release := r.Info.Version.StringRelease()

bindir := "/usr/share/bin"
files := map[string]string{}
bindir := "/usr/bin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because literally nothing goes in this directory, it wasn't even existing on my machine. Self-compiled stuff is in /usr/local/bin, packages go in /usr/bin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I was sure I had this in my $PATH, but it is not there.

contents := files.Contents{}

for name, src := range binaries {
files[src] = path.Join(bindir, name)
content := files.Content{
Source: src,
Destination: path.Join(bindir, name),
}
contents = append(contents, &content)
}

info := &nfpm.Info{
Expand All @@ -289,9 +296,8 @@ func (r *Runner) RunArtifacts(ctx context.Context, cmd *cobra.Command, args []st
Version: version,
Release: release,
Maintainer: "reBuy Platform Team <dl-scb-tech-platform@rebuy.com>",
Bindir: bindir,
Overridables: nfpm.Overridables{
Files: files,
Contents: contents,
},
}

Expand Down Expand Up @@ -324,12 +330,10 @@ func (r *Runner) RunArtifacts(ctx context.Context, cmd *cobra.Command, args []st
func (r *Runner) RunUpload(ctx context.Context, cmd *cobra.Command, args []string) {
defer r.Inst.Durations.Steps.Stopwatch("upload")()

sess, err := session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
})
cfg, err := config.LoadDefaultConfig(ctx, config.WithDefaultRegion("eu-west-1"))
cmdutil.Must(err)

uploader := s3manager.NewUploader(sess)
uploader := manager.NewUploader(s3.NewFromConfig(cfg))
for _, artifact := range r.Info.Artifacts {
if artifact.S3Location == nil {
continue
Expand All @@ -348,7 +352,7 @@ func (r *Runner) RunUpload(ctx context.Context, cmd *cobra.Command, args []strin
tags.Set("System", artifact.System.Name())
tags.Set("ReleaseKind", r.Info.Version.Kind)

_, err = uploader.Upload(&s3manager.UploadInput{
_, err = uploader.Upload(ctx, &s3.PutObjectInput{
Bucket: &artifact.S3Location.Bucket,
Key: &artifact.S3Location.Key,
Tagging: aws.String(tags.Encode()),
Expand Down
13 changes: 8 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@ go 1.16

require (
github.com/alicebob/miniredis/v2 v2.14.3
github.com/aws/aws-sdk-go v1.37.19
github.com/aws/aws-sdk-go-v2 v1.2.1
github.com/aws/aws-sdk-go-v2/config v1.1.2
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.0.3
github.com/aws/aws-sdk-go-v2/service/s3 v1.2.1
github.com/gemnasium/logrus-graylog-hook/v3 v3.0.2
github.com/go-redis/redis/v8 v8.6.0
github.com/go-redis/redis/v8 v8.7.1
github.com/gobuffalo/packr/v2 v2.8.1
github.com/google/go-github/v32 v32.1.0
github.com/google/uuid v1.2.0
github.com/goreleaser/nfpm v1.10.3
github.com/goreleaser/nfpm/v2 v2.3.1
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.2.1
github.com/julienschmidt/httprouter v1.3.0
github.com/mitchellh/mapstructure v1.4.1
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/sirupsen/logrus v1.8.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0
github.com/tidwall/pretty v1.1.0
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools v0.1.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
Loading