1
0
mirror of synced 2026-02-13 13:06:56 +00:00

fix path on flux push

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
Somtochi Onyekwere
2022-12-17 06:58:08 +01:00
parent 5e44b7b1b3
commit d79e49f80b
3 changed files with 88 additions and 17 deletions

View File

@@ -129,8 +129,18 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
return err
}
if _, err := os.Stat(pushArtifactArgs.path); err != nil {
return fmt.Errorf("invalid path '%s', must point to an existing directory or file", buildArtifactArgs.path)
path := pushArtifactArgs.path
if pushArtifactArgs.path == "-" {
path, err = saveReaderToFile(os.Stdin)
if err != nil {
return err
}
defer os.Remove(path)
}
if _, err := os.Stat(path); err != nil {
return fmt.Errorf("invalid path '%s', must point to an existing directory or file: %w", path, err)
}
meta := oci.Metadata{
@@ -164,16 +174,6 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
logger.Actionf("pushing artifact to %s", url)
path := pushArtifactArgs.path
if buildArtifactArgs.path == "-" {
path, err = saveStdinToFile()
if err != nil {
return err
}
defer os.Remove(path)
}
digest, err := ociClient.Push(ctx, url, path, meta, pushArtifactArgs.ignorePaths)
if err != nil {
return fmt.Errorf("pushing artifact failed: %w", err)