Skip to content

Commit

Permalink
Improve unarchive inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Apr 18, 2023
1 parent c5f7935 commit 609c92e
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 43 deletions.
1 change: 1 addition & 0 deletions artifactory/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2686,6 +2686,7 @@ func createDefaultDownloadSpec(c *cli.Context) (*spec.SpecFiles, error) {
Exclusions(cliutils.GetStringsArrFlagValue(c, "exclusions")).
Flat(c.Bool("flat")).
Explode(c.String("explode")).
BypassArchiveInspection(c.Bool("bypass-archive-inspection")).
IncludeDirs(c.Bool("include-dirs")).
Target(c.Args().Get(1)).
ArchiveEntries(c.String("archive-entries")).
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230316095417-a9f6b73206d7

//replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230403143646-28f93098b1e6
replace github.com/jfrog/jfrog-client-go => github.com/yahavi/jfrog-client-go v0.1.2-0.20230418111824-57375933aae6

//replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230403151438-7b671f1f663a
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/yahavi/jfrog-cli-core/v2 v2.0.0-20230418111939-681ab24ccc3b

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.5-0.20221107113836-a4c9225c690e
replace github.com/jfrog/gofrog => github.com/yahavi/gofrog v1.2.1-0.20230418111314-2313b8e46694
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY=
github.com/docker/docker v23.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho=
github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
Expand Down Expand Up @@ -242,12 +240,6 @@ github.com/jedib0t/go-pretty/v6 v6.4.6/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVf
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jfrog/build-info-go v1.9.1 h1:PxLQ9aBPm2J3WKTkaxU0YmfVCdjHPbIM/WKmrV6686E=
github.com/jfrog/build-info-go v1.9.1/go.mod h1:n0qDS24PIUH/Dag/lwzWPcMXalu+c3mahjkRrDteKnA=
github.com/jfrog/gofrog v1.2.5 h1:jCgJC0iGQ8bU7jCC+YEFJTNINyngApIrhd8BjZAVRIE=
github.com/jfrog/gofrog v1.2.5/go.mod h1:o00tSRff6IapTgaCMuX1Cs9MH08Y1JqnsKgRtx91Gc4=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1 h1:SICnzweOYC8Gap8LEmZbZNaLX2J6pdpZh4Wg/FO6UBo=
github.com/jfrog/jfrog-cli-core/v2 v2.31.1/go.mod h1:5Xm8RFFsnm31jGZflTrIKt7RIJIx6eZIVUA31hlEeSY=
github.com/jfrog/jfrog-client-go v1.28.1 h1:sBPtMg4UGkQ31CDJwFImIWwy6jEP/uarLO4F6y18Jis=
github.com/jfrog/jfrog-client-go v1.28.1/go.mod h1:XJhlPfi6iayIVc2SQ/RbztDQOnbnNatsUSQr7wbJ8Ag=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk=
Expand Down Expand Up @@ -414,6 +406,12 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofm
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/yahavi/gofrog v1.2.1-0.20230418111314-2313b8e46694 h1:rmkV9+Oj4AS0xCtityXHb1DO5jRJYK1IEUN+pdZUzQE=
github.com/yahavi/gofrog v1.2.1-0.20230418111314-2313b8e46694/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/yahavi/jfrog-cli-core/v2 v2.0.0-20230418111939-681ab24ccc3b h1:bRlbNchQiNII1PEfts0wZZsjXyvP0Fka2Nsic5YCbwo=
github.com/yahavi/jfrog-cli-core/v2 v2.0.0-20230418111939-681ab24ccc3b/go.mod h1:zfB7pH2ExvbLr3ILOygaLmq1sJP+YaSi1l7J25TwEpE=
github.com/yahavi/jfrog-client-go v0.1.2-0.20230418111824-57375933aae6 h1:5Ic80+kecHJtX+JdLBzXoBki2nwnETRmpW+kV5s5xzY=
github.com/yahavi/jfrog-client-go v0.1.2-0.20230418111824-57375933aae6/go.mod h1:pInU3O3Bpd6q2x4N+4UR4yUV7RJ9k5GjY9meyEVqwCs=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
2 changes: 1 addition & 1 deletion plugins/commands/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,5 @@ func downloadFromArtifactory(downloadDetails *httpclient.DownloadFileDetails, ht
return
}
log.Info("Downloading: " + downloadDetails.FileName)
return client.DownloadFileWithProgress(downloadDetails, "", httpDetails, false, progressMgr)
return client.DownloadFileWithProgress(downloadDetails, "", httpDetails, false, false, progressMgr)
}
6 changes: 6 additions & 0 deletions schema/filespec-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
"description": "If true, archive file is extracted after the operation. The archived file itself is deleted. The supported archive types are: zip, tar; tar.gz; and tgz.",
"default": "false"
},
"bypass-archive-validation": {
"type": "string",
"enum": ["true", "false"],
"description": "If true, bypass archive validation that usually happens before exploding.",
"default": "false"
},
"flat": {
"type": "string",
"enum": ["true", "false"],
Expand Down
67 changes: 36 additions & 31 deletions utils/cliutils/commandsflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,35 +163,36 @@ const (
module = "module"

// Generic commands flags
exclusions = "exclusions"
recursive = "recursive"
flat = "flat"
build = "build"
excludeArtifacts = "exclude-artifacts"
includeDeps = "include-deps"
regexpFlag = "regexp"
retries = "retries"
retryWaitTime = "retry-wait-time"
dryRun = "dry-run"
explode = "explode"
includeDirs = "include-dirs"
props = "props"
targetProps = "target-props"
excludeProps = "exclude-props"
failNoOp = "fail-no-op"
threads = "threads"
syncDeletes = "sync-deletes"
quiet = "quiet"
bundle = "bundle"
publicGpgKey = "gpg-key"
archiveEntries = "archive-entries"
detailedSummary = "detailed-summary"
archive = "archive"
syncDeletesQuiet = syncDeletes + "-" + quiet
antFlag = "ant"
fromRt = "from-rt"
transitive = "transitive"
Status = "status"
exclusions = "exclusions"
recursive = "recursive"
flat = "flat"
build = "build"
excludeArtifacts = "exclude-artifacts"
includeDeps = "include-deps"
regexpFlag = "regexp"
retries = "retries"
retryWaitTime = "retry-wait-time"
dryRun = "dry-run"
explode = "explode"
bypassArchiveInspection = "bypass-archive-inspection"
includeDirs = "include-dirs"
props = "props"
targetProps = "target-props"
excludeProps = "exclude-props"
failNoOp = "fail-no-op"
threads = "threads"
syncDeletes = "sync-deletes"
quiet = "quiet"
bundle = "bundle"
publicGpgKey = "gpg-key"
archiveEntries = "archive-entries"
detailedSummary = "detailed-summary"
archive = "archive"
syncDeletesQuiet = syncDeletes + "-" + quiet
antFlag = "ant"
fromRt = "from-rt"
transitive = "transitive"
Status = "status"

// Config flags
interactive = "interactive"
Expand Down Expand Up @@ -761,6 +762,10 @@ var flagsMap = map[string]cli.Flag{
Name: explode,
Usage: "[Default: false] Set to true to extract an archive after it is downloaded from Artifactory.` `",
},
bypassArchiveInspection: cli.BoolFlag{
Name: bypassArchiveInspection,
Usage: "[Default: false] Set to true to bypass archive inspections before exploding. Used with the 'explode' option. ` `",
},
validateSymlinks: cli.BoolFlag{
Name: validateSymlinks,
Usage: "[Default: false] Set to true to perform a checksum validation when downloading symbolic links.` `",
Expand Down Expand Up @@ -1543,8 +1548,8 @@ var commandFlags = map[string][]string{
url, user, password, accessToken, sshPassphrase, sshKeyPath, serverId, ClientCertPath,
ClientCertKeyPath, specFlag, specVars, buildName, buildNumber, module, exclusions, sortBy,
sortOrder, limit, offset, downloadRecursive, downloadFlat, build, includeDeps, excludeArtifacts, minSplit, splitCount,
retries, retryWaitTime, dryRun, downloadExplode, validateSymlinks, bundle, publicGpgKey, includeDirs, downloadProps, downloadExcludeProps,
failNoOp, threads, archiveEntries, downloadSyncDeletes, syncDeletesQuiet, InsecureTls, detailedSummary, project,
retries, retryWaitTime, dryRun, downloadExplode, bypassArchiveInspection, validateSymlinks, bundle, publicGpgKey, includeDirs,
downloadProps, downloadExcludeProps, failNoOp, threads, archiveEntries, downloadSyncDeletes, syncDeletesQuiet, InsecureTls, detailedSummary, project,
skipChecksum,
},
Move: {
Expand Down
1 change: 1 addition & 0 deletions utils/cliutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ func OverrideFieldsIfSet(spec *speccore.File, c *cli.Context) {
overrideStringIfSet(&spec.Recursive, c, "recursive")
overrideStringIfSet(&spec.Flat, c, "flat")
overrideStringIfSet(&spec.Explode, c, "explode")
overrideStringIfSet(&spec.BypassArchiveInspection, c, "bypass-archive-inspection")
overrideStringIfSet(&spec.Regexp, c, "regexp")
overrideStringIfSet(&spec.IncludeDirs, c, "include-dirs")
overrideStringIfSet(&spec.ValidateSymlinks, c, "validate-symlinks")
Expand Down

0 comments on commit 609c92e

Please sign in to comment.