Skip to content

Commit

Permalink
Support publishing version markers to S3 buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
rifelpet committed Jul 6, 2024
1 parent 354fe4e commit 85e8356
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions tests/e2e/kubetest2-kops/deployer/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (d *deployer) PostTest(testErr error) error {
if testErr != nil || d.PublishVersionMarker == "" {
return nil
}
if !strings.HasPrefix(d.PublishVersionMarker, "gs://") {
if !strings.HasPrefix(d.PublishVersionMarker, "gs://") && !strings.HasPrefix(d.PublishVersionMarker, "s3://") {
return fmt.Errorf("unsupported --publish-version-marker protocol: %v", d.PublishVersionMarker)
}
if d.KopsVersionMarker == "" {
Expand All @@ -51,13 +51,26 @@ func (d *deployer) PostTest(testErr error) error {
if err != nil {
return err
}

args := []string{
"gsutil",
"-h", "Cache-Control:private, max-age=0, no-transform",
"cp",
tempSrc.Name(),
d.PublishVersionMarker,
var args []string
switch {
case strings.HasPrefix(d.PublishVersionMarker, "gs://"):
args = []string{
"gsutil",
"-h", "Cache-Control:private, max-age=0, no-transform",
"cp",
tempSrc.Name(),
d.PublishVersionMarker,
}
case strings.HasPrefix(d.PublishVersionMarker, "s3://"):
args = []string{
"aws",
"s3",
"sync",
"--cache-control",
"private, max-age=0, no-transform",
tempSrc.Name(),
d.PublishVersionMarker,
}
}
klog.Info(strings.Join(args, " "))

Expand Down

0 comments on commit 85e8356

Please sign in to comment.