From 5333511e3937a399c2c70aa5afa04465eb0a1b90 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Thu, 17 Jun 2021 10:13:03 +0200 Subject: [PATCH] Compress release archive sources We now compress the sources before copying them into the GCB archive directory. This allows us faster retrieval of those sources. Signed-off-by: Sascha Grunert --- pkg/release/archive.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/release/archive.go b/pkg/release/archive.go index 5802a379a64..fc437100b75 100644 --- a/pkg/release/archive.go +++ b/pkg/release/archive.go @@ -28,6 +28,7 @@ import ( "k8s.io/release/pkg/gcp" "k8s.io/release/pkg/object" "sigs.k8s.io/release-utils/command" + "sigs.k8s.io/release-utils/tar" "sigs.k8s.io/release-utils/util" ) @@ -288,10 +289,14 @@ func (a *defaultArchiverImpl) CopyReleaseToBucket(releaseBuildDir, archiveBucket return errors.Wrap(err, "normalizing destination path") } - logrus.Infof("Copy %s to %s...", releaseBuildDir, remoteDest) + tarball := releaseBuildDir + ".tar.gz" + logrus.Infof("Compressing %s to %s", releaseBuildDir, tarball) + if err := tar.Compress(tarball, releaseBuildDir); err != nil { + return errors.Wrap(err, "create source tarball") + } - // logrun $GSUTIL -mq cp $dash_args $WORKDIR/* $archive_bucket/$build_dir || true - if err := gcs.RsyncRecursive(releaseBuildDir, remoteDest); err != nil { + logrus.Infof("Copy %s to %s", tarball, remoteDest) + if err := gcs.CopyToRemote(tarball, remoteDest); err != nil { return errors.Wrap(err, "copying release directory to bucket") } return nil