Skip to content

Commit

Permalink
Support pushing single files in PushReleaseArtifacts()
Browse files Browse the repository at this point in the history
This commit modifies the function Instance.PushReleaseArtifacts() in
the build package to support pushing single files to the release buckets.

Before, PushReleaseArtifacts() would fail if applied to a single file.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
  • Loading branch information
puerco committed Oct 4, 2021
1 parent 13e4102 commit 8a890dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/build/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,18 @@ func (bi *Instance) PushReleaseArtifacts(srcPath, gcsPath string) error {

logrus.Infof("Pushing release artifacts from %s to %s", srcPath, dstPath)

finfo, err := os.Stat(srcPath)
if err != nil {
return errors.Wrap(err, "checking if source path is a directory")
}

// If we are handling a single file copy instead of rsync
if !finfo.IsDir() {
return errors.Wrap(
bi.objStore.CopyToRemote(srcPath, dstPath), "copying file to GCS",
)
}

return errors.Wrap(
bi.objStore.RsyncRecursive(srcPath, dstPath), "rsync artifacts to GCS",
)
Expand Down

0 comments on commit 8a890dd

Please sign in to comment.