mirror of
https://github.com/fluxcd/flux2.git
synced 2026-05-01 15:48:51 +00:00
fix path on flux push
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
parent
5e44b7b1b3
commit
d79e49f80b
3 changed files with 88 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue