Skip to content

Commit 35b5549

Browse files
authored
Merge pull request #430 from derailed/rel_v0.22.1
Rel v0.22.1
2 parents bd9c9f4 + 7738cec commit 35b5549

File tree

7 files changed

+51
-19
lines changed

7 files changed

+51
-19
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME := popeye
22
PACKAGE := github.com/derailed/$(NAME)
3-
VERSION := v0.22.0
3+
VERSION := v0.22.1
44
GIT := $(shell git rev-parse --short HEAD)
55
DATE := $(shell date +%FT%T%Z)
66
IMG_NAME := derailed/popeye

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ Example to save report to S3:
259259
```shell
260260
# AWS S3
261261
# NOTE: You must provide env vars for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
262-
# This will create bucket my-popeye if not present and upload a popeye json report to /fred/popeye.json
263-
popeye --s3-bucket s3://my-popeye/fred/popeye.json --s3-region us-west-2 --out json
262+
# This will create bucket my-popeye if not present and upload a popeye json report to /fred/scan.json
263+
popeye --s3-bucket s3://my-popeye/fred --s3-region us-west-2 --out json --save --output-file scan.json
264264
265265
# Minio Object Store
266266
# NOTE: You must provide env vars for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and a minio server URI
267-
# This will create bucket my-popeye if not present and upload a popeye json report to /fred/popeye.json
268-
popeye --s3-bucket minio://my-popeye/fred/popeye.json --s3-region us-east --s3-endpoint localhost:9000
267+
# This will create bucket my-popeye if not present and upload a popeye json report to /fred/scan.json
268+
popeye --s3-bucket minio://my-popeye/fred --s3-region us-east --s3-endpoint localhost:9000 --out json --save --output-file scan.json
269269
```
270270
271271
---
@@ -675,5 +675,5 @@ to make this project a reality!
675675
676676
---
677677
678-
<img src="https://github.com/derailed/popeye/blob/master/assets/imhotep_logo.png" width="32" height="auto"/> &nbsp;© 2024 Imhotep Software LLC.
678+
<img src="https://github.com/derailed/popeye/blob/master/assets/imhotep_logo.png" width="32" height="auto"/> &nbsp;© 2025 Imhotep Software LLC.
679679
All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

change_logs/release_v0.22.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Also if you dig this tool, please make some noise on social! [@kitesurfer](https
1919

2020
---
2121

22-
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/imhotep_logo.png" width="32" height="auto"/>&nbsp; © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
22+
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/imhotep_logo.png" width="32" height="auto"/>&nbsp; © 2025 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

change_logs/release_v0.22.1.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/popeye_logo.png" align="right" width="200" height="auto"/>
2+
3+
# Release v0.22.1
4+
5+
## Notes
6+
7+
Thank you to all that contributed with flushing out issues and enhancements for Popeye! I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev and see if we're happier with some of the fixes! If you've filed an issue please help me verify and close. Your support, kindness and awesome suggestions to make Popeye better is as ever very much noticed and appreciated!
8+
9+
This project offers a GitHub Sponsor button (over here 👆). As you well know this is not pimped out by big corps with deep pockets. If you feel `Popeye` is saving you cycles diagnosing potential cluster issues please consider sponsoring this project!! It does go a long way in keeping our servers lights on and beers in our fridge.
10+
11+
Also if you dig this tool, please make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
12+
13+
---
14+
15+
## Maintenance Release
16+
17+
---
18+
19+
## Resolved Issues
20+
21+
* [#425](https://github.com/derailed/popeye/issues/425) Upload to s3 failing in v0.22.0
22+
23+
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/imhotep_logo.png" width="32" height="auto"/>&nbsp; © 2025 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/derailed/popeye
33
go 1.23.0
44

55
require (
6+
github.com/aws/aws-sdk-go-v2 v1.34.0
67
github.com/aws/aws-sdk-go-v2/config v1.29.2
78
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.54
89
github.com/aws/aws-sdk-go-v2/service/s3 v1.74.1
@@ -34,7 +35,6 @@ require (
3435
require (
3536
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
3637
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
37-
github.com/aws/aws-sdk-go-v2 v1.34.0 // indirect
3838
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.8 // indirect
3939
github.com/aws/aws-sdk-go-v2/credentials v1.17.55 // indirect
4040
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.25 // indirect

pkg/config/s3.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"io"
1111
"net/url"
1212
"os"
13+
"path/filepath"
1314
"strings"
1415

1516
"github.com/aws/aws-sdk-go-v2/config"
@@ -58,15 +59,15 @@ func (s *S3Info) Upload(ctx context.Context, asset string, contentType string, r
5859

5960
switch kind {
6061
case s3Bucket:
61-
return s.awsUpload(ctx, bucket, key, rwc)
62+
return s.awsUpload(ctx, bucket, key, asset, rwc)
6263
case minioBucket:
63-
return s.minioUpload(ctx, bucket, key, rwc)
64+
return s.minioUpload(ctx, bucket, key, asset, rwc)
6465
default:
6566
return fmt.Errorf("unsupported S3 storage: %s", kind)
6667
}
6768
}
6869

69-
func (s *S3Info) minioUpload(ctx context.Context, bucket, key string, rwc io.ReadWriteCloser) error {
70+
func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc io.ReadWriteCloser) error {
7071
minioClient, err := minio.New(*s.Endpoint, &minio.Options{
7172
Creds: credentials.NewStaticV4(
7273
os.Getenv("AWS_ACCESS_KEY_ID"),
@@ -91,7 +92,7 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key string, rwc io.Rea
9192
contentType := "application/octet-stream"
9293
info, err := minioClient.PutObject(ctx,
9394
bucket,
94-
key,
95+
filepath.Join(key, asset),
9596
rwc,
9697
-1,
9798
minio.PutObjectOptions{ContentType: contentType},
@@ -104,7 +105,7 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key string, rwc io.Rea
104105
return nil
105106
}
106107

107-
func (s *S3Info) awsUpload(ctx context.Context, bucket, key string, rwc io.ReadWriteCloser) error {
108+
func (s *S3Info) awsUpload(ctx context.Context, bucket, key, asset string, rwc io.ReadWriteCloser) error {
108109
cfg, err := config.LoadDefaultConfig(ctx,
109110
config.WithRegion(*s.Region),
110111
config.WithLogConfigurationWarnings(true),
@@ -115,13 +116,13 @@ func (s *S3Info) awsUpload(ctx context.Context, bucket, key string, rwc io.ReadW
115116
}
116117

117118
clt := s3.NewFromConfig(cfg)
118-
_, err = clt.CreateBucket(ctx, &s3.CreateBucketInput{
119+
opts := s3.CreateBucketInput{
119120
Bucket: &bucket,
120121
CreateBucketConfiguration: &types.CreateBucketConfiguration{
121122
LocationConstraint: types.BucketLocationConstraint(*s.Region),
122123
},
123-
})
124-
if err != nil {
124+
}
125+
if _, err = clt.CreateBucket(ctx, &opts); err != nil {
125126
var (
126127
exists *types.BucketAlreadyExists
127128
owned *types.BucketAlreadyOwnedByYou
@@ -138,15 +139,16 @@ func (s *S3Info) awsUpload(ctx context.Context, bucket, key string, rwc io.ReadW
138139
}
139140

140141
uploader := manager.NewUploader(clt)
142+
path := filepath.Join(key, asset)
141143
_, err = uploader.Upload(ctx, &s3.PutObjectInput{
142144
Bucket: &bucket,
143-
Key: &key,
145+
Key: &path,
144146
Body: rwc,
145147
})
146148
if err != nil {
147-
log.Err(err).Msgf("failed to upload to bucket: %s//%s", bucket, key)
149+
log.Err(err).Msgf("failed to upload to bucket: %s//%s", bucket, path)
148150
} else {
149-
log.Info().Msgf("Success: uploaded to bucket: %s//%s", bucket, key)
151+
log.Info().Msgf("Success: uploaded to bucket: %s//%s", bucket, path)
150152
}
151153

152154
return err

pkg/config/s3_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ func TestParseBucket(t *testing.T) {
6060
key: "with/leading/slashes",
6161
},
6262

63+
"blee": {
64+
uri: "my-bucket/popeye/my-cluster/2025/01/27/",
65+
bucket: "my-bucket",
66+
kind: s3Bucket,
67+
key: "popeye/my-cluster/2025/01/27",
68+
},
69+
6370
"minio": {
6471
uri: "minio://fred/blee/",
6572
bucket: "fred",

0 commit comments

Comments
 (0)