@@ -3,15 +3,16 @@ package buildtools
3
3
import (
4
4
"errors"
5
5
"fmt"
6
+ "os"
7
+ "strconv"
8
+ "strings"
9
+
6
10
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/python"
7
11
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/setup"
8
12
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
9
13
"github.com/jfrog/jfrog-cli-core/v2/utils/ioutils"
10
14
"github.com/jfrog/jfrog-cli-security/utils/techutils"
11
15
setupdocs "github.com/jfrog/jfrog-cli/docs/buildtools/setup"
12
- "os"
13
- "strconv"
14
- "strings"
15
16
16
17
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/container"
17
18
"github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/dotnet"
@@ -768,7 +769,7 @@ func pullCmd(c *cli.Context, image string) error {
768
769
if show , err := cliutils .ShowGenericCmdHelpIfNeeded (c , c .Args (), "dockerpullhelp" ); show || err != nil {
769
770
return err
770
771
}
771
- _ , rtDetails , _ , skipLogin , filteredDockerArgs , buildConfiguration , err := extractDockerOptionsFromArgs (c .Args ())
772
+ _ , rtDetails , _ , skipLogin , _ , filteredDockerArgs , buildConfiguration , err := extractDockerOptionsFromArgs (c .Args ())
772
773
if err != nil {
773
774
return err
774
775
}
@@ -791,24 +792,24 @@ func pushCmd(c *cli.Context, image string) (err error) {
791
792
if show , err := cliutils .ShowCmdHelpIfNeeded (c , c .Args ()); show || err != nil {
792
793
return err
793
794
}
794
- threads , rtDetails , detailedSummary , skipLogin , filteredDockerArgs , buildConfiguration , err := extractDockerOptionsFromArgs (c .Args ())
795
+ threads , rtDetails , detailedSummary , skipLogin , validateSha , filteredDockerArgs , buildConfiguration , err := extractDockerOptionsFromArgs (c .Args ())
795
796
if err != nil {
796
797
return
797
798
}
798
799
printDeploymentView := log .IsStdErrTerminal ()
799
- PushCommand := container .NewPushCommand (containerutils .DockerClient )
800
- PushCommand .SetThreads (threads ).SetDetailedSummary (detailedSummary || printDeploymentView ).SetCmdParams (filteredDockerArgs ).SetSkipLogin (skipLogin ).SetBuildConfiguration (buildConfiguration ).SetServerDetails (rtDetails ).SetImageTag (image )
801
- supported , err := PushCommand .IsGetRepoSupported ()
800
+ pushCommand := container .NewPushCommand (containerutils .DockerClient )
801
+ pushCommand .SetThreads (threads ).SetDetailedSummary (detailedSummary || printDeploymentView ).SetCmdParams (filteredDockerArgs ).SetSkipLogin (skipLogin ).SetBuildConfiguration (buildConfiguration ).SetServerDetails (rtDetails ). SetValidateSha ( validateSha ).SetImageTag (image )
802
+ supported , err := pushCommand .IsGetRepoSupported ()
802
803
if err != nil {
803
804
return err
804
805
}
805
806
if ! supported {
806
807
return cliutils .NotSupportedNativeDockerCommand ("docker-push" )
807
808
}
808
- err = commands .Exec (PushCommand )
809
- result := PushCommand .Result ()
809
+ err = commands .Exec (pushCommand )
810
+ result := pushCommand .Result ()
810
811
defer cliutils .CleanupResult (result , & err )
811
- err = cliutils .PrintCommandSummary (PushCommand .Result (), detailedSummary , printDeploymentView , false , err )
812
+ err = cliutils .PrintCommandSummary (pushCommand .Result (), detailedSummary , printDeploymentView , false , err )
812
813
return
813
814
}
814
815
@@ -824,7 +825,7 @@ func dockerNativeCmd(c *cli.Context) error {
824
825
if show , err := cliutils .ShowCmdHelpIfNeeded (c , c .Args ()); show || err != nil {
825
826
return err
826
827
}
827
- _ , _ , _ , _ , cleanArgs , _ , err := extractDockerOptionsFromArgs (c .Args ())
828
+ _ , _ , _ , _ , _ , cleanArgs , _ , err := extractDockerOptionsFromArgs (c .Args ())
828
829
if err != nil {
829
830
return err
830
831
}
@@ -833,7 +834,7 @@ func dockerNativeCmd(c *cli.Context) error {
833
834
}
834
835
835
836
// Remove all the none docker CLI flags from args.
836
- func extractDockerOptionsFromArgs (args []string ) (threads int , serverDetails * coreConfig.ServerDetails , detailedSummary , skipLogin bool , cleanArgs []string , buildConfig * build.BuildConfiguration , err error ) {
837
+ func extractDockerOptionsFromArgs (args []string ) (threads int , serverDetails * coreConfig.ServerDetails , detailedSummary , skipLogin bool , validateSha bool , cleanArgs []string , buildConfig * build.BuildConfiguration , err error ) {
837
838
cleanArgs = append ([]string (nil ), args ... )
838
839
var serverId string
839
840
cleanArgs , serverId , err = coreutils .ExtractServerIdFromCommand (cleanArgs )
@@ -856,6 +857,11 @@ func extractDockerOptionsFromArgs(args []string) (threads int, serverDetails *co
856
857
if err != nil {
857
858
return
858
859
}
860
+ // Extract validateSha flag
861
+ cleanArgs , validateSha , err = coreutils .ExtractBoolFlagFromArgs (cleanArgs , "validate-sha" )
862
+ if err != nil {
863
+ return
864
+ }
859
865
cleanArgs , buildConfig , err = build .ExtractBuildDetailsFromArgs (cleanArgs )
860
866
return
861
867
}
@@ -934,17 +940,9 @@ func NpmPublishCmd(c *cli.Context) (err error) {
934
940
if npmCmd .GetXrayScan () {
935
941
commandsUtils .ConditionalUploadScanFunc = scan .ConditionalUploadDefaultScanFunc
936
942
}
937
-
938
- var printDeploymentView , detailedSummary bool
939
-
940
- // Deployment view and Detailed summary is not supported when using npmrc for publishing since transfer details are not available.
941
- if npmCmd .UseNative () {
942
- printDeploymentView , detailedSummary = false , false
943
- } else {
944
- printDeploymentView , detailedSummary = log .IsStdErrTerminal (), npmCmd .IsDetailedSummary ()
945
- if ! detailedSummary {
946
- npmCmd .SetDetailedSummary (printDeploymentView )
947
- }
943
+ printDeploymentView , detailedSummary := log .IsStdErrTerminal (), npmCmd .IsDetailedSummary ()
944
+ if ! detailedSummary {
945
+ npmCmd .SetDetailedSummary (printDeploymentView )
948
946
}
949
947
err = commands .Exec (npmCmd )
950
948
result := npmCmd .Result ()
0 commit comments