Skip to content

Commit

Permalink
Merge branch 'dev' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalbe4 committed Jul 31, 2023
2 parents 2f56ca8 + a18320a commit 1bfa0c1
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/dockerTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
# We are temporarily downgrading to Go 1.20.5 due to a bug in version 1.20.6 that causes Docker tests to fail.
go-version: 1.20.5
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion build/npm/v2-jf/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/npm/v2-jf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jfrog-cli-v2-jf",
"version": "2.44.0",
"version": "2.44.1",
"description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸",
"homepage": "https://github.com/jfrog/jfrog-cli",
"preferGlobal": true,
Expand Down
2 changes: 1 addition & 1 deletion build/npm/v2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/npm/v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jfrog-cli-v2",
"version": "2.44.0",
"version": "2.44.1",
"description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸",
"homepage": "https://github.com/jfrog/jfrog-cli",
"preferGlobal": true,
Expand Down
43 changes: 26 additions & 17 deletions buildinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestBuildAddDependenciesFromHomeDir(t *testing.T) {
fileName := "cliTestFile.txt"
testFileRelPath, testFileAbs := createFileInHomeDir(t, fileName)

test := buildAddDepsBuildInfoTestParams{description: "'rt bad' from home dir", commandArgs: []string{testFileRelPath, "--recursive=false"}, expectedDependencies: []string{fileName}, buildName: tests.RtBuildName1, buildNumber: "1"}
test := buildAddDepsBuildInfoTestParams{description: "'rt bad' from home dir", commandArgs: []string{testFileRelPath, "--recursive=false"}, expectedDependencies: []string{fileName}, buildName: tests.RtBuildName1, buildNumber: "1", expectedModule: tests.RtBuildName1}
collectDepsAndPublishBuild(test, false, t)
validateBuildAddDepsBuildInfo(t, test)

Expand Down Expand Up @@ -436,29 +436,33 @@ func TestBuildAddDependencies(t *testing.T) {
allFiles := []string{"a1.in", "a2.in", "a3.in", "b1.in", "b2.in", "b3.in", "c1.in", "c2.in", "c3.in"}
var badTests = []buildAddDepsBuildInfoTestParams{
// Collect the dependencies from the local file system (the --from-rt option is not used).
{description: "'rt bad' simple cli", commandArgs: []string{"testdata/a/*"}, expectedDependencies: allFiles},
{description: "'rt bad' single file", commandArgs: []string{"testdata/a/a1.in"}, expectedDependencies: []string{"a1.in"}},
{description: "'rt bad' none recursive", commandArgs: []string{"testdata/a/*", "--recursive=false"}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in"}},
{description: "'rt bad' special chars recursive", commandArgs: []string{getSpecialCharFilePath()}, expectedDependencies: []string{"a1.in"}},
{description: "'rt bad' exclude command line wildcards", commandArgs: []string{"testdata/a/*", "--exclusions=*a2*;*a3.in"}, expectedDependencies: []string{"a1.in", "b1.in", "b2.in", "b3.in", "c1.in", "c2.in", "c3.in"}},
{description: "'rt bad' spec", commandArgs: []string{"--spec=" + tests.GetFilePathForArtifactory(tests.BuildAddDepsSpec)}, expectedDependencies: allFiles},
{description: "'rt bad' two specFiles", commandArgs: []string{"--spec=" + tests.GetFilePathForArtifactory(tests.BuildAddDepsDoubleSpec)}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in", "b1.in", "b2.in", "b3.in"}},
{description: "'rt bad' exclude command line regexp", commandArgs: []string{"testdata/a/a(.*)", "--exclusions=(.*)a2.*;.*a3.in", "--regexp=true"}, expectedDependencies: []string{"a1.in"}},
{description: "'rt bad' simple cli", commandArgs: []string{"testdata/a/*"}, expectedDependencies: allFiles, expectedModule: tests.RtBuildName1},
{description: "'rt bad' simple cli", commandArgs: []string{"testdata/a/*", "--module=" + ModuleNameJFrogTest}, expectedDependencies: allFiles, expectedModule: ModuleNameJFrogTest},
{description: "'rt bad' single file", commandArgs: []string{"testdata/a/a1.in"}, expectedDependencies: []string{"a1.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' none recursive", commandArgs: []string{"testdata/a/*", "--recursive=false"}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' none recursive", commandArgs: []string{"testdata/a/*", "--recursive=false", "--module=" + ModuleNameJFrogTest}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in"}, expectedModule: ModuleNameJFrogTest},
{description: "'rt bad' special chars recursive", commandArgs: []string{getSpecialCharFilePath()}, expectedDependencies: []string{"a1.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' exclude command line wildcards", commandArgs: []string{"testdata/a/*", "--exclusions=*a2*;*a3.in"}, expectedDependencies: []string{"a1.in", "b1.in", "b2.in", "b3.in", "c1.in", "c2.in", "c3.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' spec", commandArgs: []string{"--spec=" + tests.GetFilePathForArtifactory(tests.BuildAddDepsSpec)}, expectedDependencies: allFiles, expectedModule: tests.RtBuildName1},
{description: "'rt bad' two specFiles", commandArgs: []string{"--spec=" + tests.GetFilePathForArtifactory(tests.BuildAddDepsDoubleSpec)}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in", "b1.in", "b2.in", "b3.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' exclude command line regexp", commandArgs: []string{"testdata/a/a(.*)", "--exclusions=(.*)a2.*;.*a3.in", "--regexp=true", "--module=" + ModuleNameJFrogTest}, expectedDependencies: []string{"a1.in"}, expectedModule: ModuleNameJFrogTest},

// Collect the dependencies from Artifactory using the --from-rt option.
{description: "'rt bad' simple cli", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--from-rt"}, expectedDependencies: allFiles},
{description: "'rt bad' single file", commandArgs: []string{tests.RtRepo1 + "/testdata/a/a1.in", "--from-rt"}, expectedDependencies: []string{"a1.in"}},
{description: "'rt bad' none recursive", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--recursive=false", "--from-rt"}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in"}},
{description: "'rt bad' exclude command line wildcards", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--exclusions=*a2*;*a3.in", "--from-rt"}, expectedDependencies: []string{"a1.in", "b1.in", "b2.in", "b3.in", "c1.in", "c2.in", "c3.in"}},
{description: "'rt bad' spec", commandArgs: []string{"--spec=" + buildAddDepsRemoteSpec, "--from-rt"}, expectedDependencies: allFiles},
{description: "'rt bad' two specFiles", commandArgs: []string{"--spec=" + buildAddDepsDoubleRemoteSpec, "--from-rt"}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in", "b1.in", "b2.in", "b3.in"}},
{description: "'rt bad' simple cli", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--from-rt"}, expectedDependencies: allFiles, expectedModule: tests.RtBuildName1},
{description: "'rt bad' simple cli", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--from-rt", "--module=" + ModuleNameJFrogTest}, expectedDependencies: allFiles, expectedModule: ModuleNameJFrogTest},
{description: "'rt bad' single file", commandArgs: []string{tests.RtRepo1 + "/testdata/a/a1.in", "--from-rt"}, expectedDependencies: []string{"a1.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' none recursive", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--recursive=false", "--from-rt"}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' exclude command line wildcards", commandArgs: []string{tests.RtRepo1 + "/testdata/a/*", "--exclusions=*a2*;*a3.in", "--from-rt", "--module=" + ModuleNameJFrogTest}, expectedDependencies: []string{"a1.in", "b1.in", "b2.in", "b3.in", "c1.in", "c2.in", "c3.in"}, expectedModule: ModuleNameJFrogTest},
{description: "'rt bad' spec", commandArgs: []string{"--spec=" + buildAddDepsRemoteSpec, "--from-rt"}, expectedDependencies: allFiles, expectedModule: tests.RtBuildName1},
{description: "'rt bad' two specFiles", commandArgs: []string{"--spec=" + buildAddDepsDoubleRemoteSpec, "--from-rt"}, expectedDependencies: []string{"a1.in", "a2.in", "a3.in", "b1.in", "b2.in", "b3.in"}, expectedModule: tests.RtBuildName1},
}

// Tests compatibility to file paths with windows separators.
if coreutils.IsWindows() {
var compatibilityTests = []buildAddDepsBuildInfoTestParams{
{description: "'rt bad' win compatibility by arguments", commandArgs: []string{"testdata\\\\a\\\\a1.in"}, expectedDependencies: []string{"a1.in"}},
{description: "'rt bad' win compatibility by spec", commandArgs: []string{"--spec=" + tests.GetFilePathForArtifactory(tests.WinBuildAddDepsSpec)}, expectedDependencies: allFiles},
{description: "'rt bad' win compatibility by arguments", commandArgs: []string{"testdata\\\\a\\\\a1.in"}, expectedDependencies: []string{"a1.in"}, expectedModule: tests.RtBuildName1},
{description: "'rt bad' win compatibility by arguments", commandArgs: []string{"testdata\\\\a\\\\a1.in", "--module=" + ModuleNameJFrogTest}, expectedDependencies: []string{"a1.in"}, expectedModule: ModuleNameJFrogTest},
{description: "'rt bad' win compatibility by spec", commandArgs: []string{"--spec=" + tests.GetFilePathForArtifactory(tests.WinBuildAddDepsSpec)}, expectedDependencies: allFiles, expectedModule: tests.RtBuildName1},
}
badTests = append(badTests, compatibilityTests...)
}
Expand Down Expand Up @@ -881,6 +885,10 @@ func validateBuildAddDepsBuildInfo(t *testing.T, buildInfoTestParams buildAddDep
"%s test with the command: \nrt bad %s \nexpected to have the following dependencies: \n%s \nbut has: \n%s",
buildInfoTestParams.description, buildInfoTestParams.commandArgs, buildInfoTestParams.expectedDependencies, dependenciesToPrintableArray(buildInfo.Modules[0].Dependencies))

assert.Equalf(t, buildInfoTestParams.expectedModule, buildInfo.Modules[0].Id,
"%s test with the command: \nrt bad %s \nexpected to have the following Module ID: \n%s \nbut has: \n%s",
buildInfoTestParams.description, buildInfoTestParams.commandArgs, buildInfoTestParams.expectedModule, buildInfo.Modules[0].Id)

for _, expectedDependency := range buildInfoTestParams.expectedDependencies {
found := false
for _, actualDependency := range buildInfo.Modules[0].Dependencies {
Expand Down Expand Up @@ -909,4 +917,5 @@ type buildAddDepsBuildInfoTestParams struct {
expectedDependencies []string
buildName string
buildNumber string
expectedModule string
}
1 change: 0 additions & 1 deletion docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ func TestPushFatManifestImage(t *testing.T) {
if !*tests.TestDocker {
t.Skip("Skipping test. To run it, add the '-test.docker=true' option.")
}

buildName := "push-fat-manifest" + tests.DockerBuildName

// Create temp test dir.
Expand Down
9 changes: 9 additions & 0 deletions documentation/CLI-for-JFrog-Artifactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ By default, the command collects the files from the local file system. If you'd
| --recursive | \[Default: true\]<br><br>When false, artifacts inside sub-folders in Artifactory will not be affected. |
| --regexp | \[Optional: false\]<br><br>\[Default: false\] Set to true to use a regular expression instead of wildcards expression to collect files to be added to the build info.This option is not supported when --from-rt is set to true. |
| --dry-run | \[Default: false\]<br><br>Set to true to only get a summery of the dependencies that will be added to the build info. |
| --module | \[Optional\]<br><br>Optional module name in the build-info for adding the dependency. |
| --exclusions | A list of Semicolon-separated exclude patterns. Allows using wildcards or a regular expression according to the value of the 'regexp' option. |
| Command arguments | The command takes three arguments. |
| Build name | The build name to add the dependencies to |
Expand All @@ -916,6 +917,14 @@ Add all files located in the **m-local-repo** Artifactory repository, under the
jf rt bad my-build-name 7 "my-local-repo/dependencies/" --from-rt
```


**Example 3**

Add all files located under the **path/to/build/dependencies/dir** directory as dependencies of a build. The build name is **my-build-name**, the build number is **7** and module is m1. The build-info is only updated locally. To publish the build-info to Artifactory use the **jf rt build-publish** command.
```
jf rt bad my-build-name 7 "path/to/build/dependencies/dir/" --module m1
```

### Publishing Build-Info

This command is used to publish build info to Artifactory. To publish the accumulated build-info for a build to Artifactory, use the **build-publish** command. For example, the following command publishes all the build-info collected for build **my-build-name** with build number 18:
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d
github.com/jfrog/build-info-go v1.9.6
github.com/jfrog/gofrog v1.3.0
github.com/jfrog/jfrog-cli-core/v2 v2.39.3
github.com/jfrog/jfrog-client-go v1.31.2
github.com/jfrog/jfrog-cli-core/v2 v2.39.4
github.com/jfrog/jfrog-client-go v1.31.3
github.com/jszwec/csvutil v1.8.0
github.com/mholt/archiver/v3 v3.5.1
github.com/pkg/errors v0.9.1
Expand Down Expand Up @@ -123,8 +123,8 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 dev
// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230731140544-ef8a0fde1b17

// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.6-0.20230418122323-2bf299dd6d27

//replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230717090738-b2e0c7bcc026
// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230730114019-1d6985b1f8bd
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ github.com/jfrog/build-info-go v1.9.6 h1:lCJ2j5uXAlJsSwDe5J8WD7Co1f/hUlZvMfwfb5A
github.com/jfrog/build-info-go v1.9.6/go.mod h1:GbuFS+viHCKZYx9nWHYu7ab1DgQkFdtVN3BJPUNb2D4=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-cli-core/v2 v2.39.3 h1:GtBwEAchuvI4c8ZwaJ6CKN/KavMlEu5+DwNX9OesYMI=
github.com/jfrog/jfrog-cli-core/v2 v2.39.3/go.mod h1:/HJ9mO3AZsACtQWxkwMj7REWPdXT3yHKjJXjPHlmB34=
github.com/jfrog/jfrog-client-go v1.31.2 h1:foy8owM2lS8jZL7zuBPtcx1RpF1GeIXaXF8hIufyr4I=
github.com/jfrog/jfrog-client-go v1.31.2/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI=
github.com/jfrog/jfrog-cli-core/v2 v2.39.4 h1:8UIReIxbjtFbMuzpMx5RBhIng/RvdoS2RysJANcrUa4=
github.com/jfrog/jfrog-cli-core/v2 v2.39.4/go.mod h1:9Mc8VnWo/VBvzSFigD/kfKzYHOf9vvrINifLrhqMS/0=
github.com/jfrog/jfrog-client-go v1.31.3 h1:Q6xyBdyrwusxuPv+cd1hwS0/tjrJrFAGc1JxrDkryF0=
github.com/jfrog/jfrog-client-go v1.31.3/go.mod h1:qEJxoe68sUtqHJ1YhXv/7pKYP/9p1D5tJrruzJKYeoI=
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
8 changes: 7 additions & 1 deletion pipelines/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func createPipelinesDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, e
if err != nil {
return nil, err
}
if plDetails.DistributionUrl == "" {
if plDetails.PipelinesUrl == "" {
return nil, fmt.Errorf("the --pipelines-url option is mandatory")
}
return plDetails, nil
Expand Down Expand Up @@ -138,7 +138,13 @@ func syncPipelineResources(c *cli.Context) error {
// getSyncPipelineResourcesStatus fetch sync status for a given repository path and branch name
func getSyncPipelineResourcesStatus(c *cli.Context) error {
branch := c.String("branch")
if branch == "" {
return cliutils.PrintHelpAndReturnError("The --branch option is mandatory.", c)
}
repository := c.String("repository")
if repository == "" {
return cliutils.PrintHelpAndReturnError("The --repository option is mandatory.", c)
}
clientlog.Info("Fetching pipeline sync status on repository:", repository, "branch:", branch)

// Fetch service details for authentication
Expand Down
7 changes: 3 additions & 4 deletions poetry_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package main

import (
clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests"
"os"
"path/filepath"
"strconv"
"testing"

clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests"

buildinfo "github.com/jfrog/build-info-go/entities"
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/jfrog/jfrog-cli/inttestutils"
Expand All @@ -17,11 +18,9 @@ import (
)

func TestPoetryInstall(t *testing.T) {
tests.SkipKnownFailingTest(t)

// Init poetry test.
initPoetryTest(t)

tests.SkipKnownFailingTest(t)
// Populate cli config with 'default' server.
oldHomeDir, newHomeDir := prepareHomeDir(t)
defer func() {
Expand Down
3 changes: 3 additions & 0 deletions transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,11 @@ func TestTransferWithRepoSnapshot(t *testing.T) {
// root - testdata - a -> explored, 2 files remaining.
// ----------------- b -> not fully explored, 1 file found.
// ----------------- c -> completed.
// ----------------- deleted-folder -> folder that isn't longer exists in the source Artifactory.
// 'a' is marked as explored but not completed, we expect it to be re-explored and all its files to be uploaded.
// 'b' is marked as unexplored, we expect its directory to be re-explored and then uploaded.
// 'c' is marked completed, so we expect no action there.
// 'deleted-folder' is marked as unexplored however, should not be returned from the AQL and therefore we expect no action there.
func generateTestRepoSnapshotFile(t *testing.T, repoKey, repoSnapshotFilePath string) {
snapshotManager := reposnapshot.CreateRepoSnapshotManager(repoKey, repoSnapshotFilePath)
assert.NotNil(t, snapshotManager)
Expand All @@ -354,6 +356,7 @@ func generateTestRepoSnapshotFile(t *testing.T, repoKey, repoSnapshotFilePath st
childA := addChildWithFiles(t, childTestdata, "a", true, false, 2)
childB := addChildWithFiles(t, childA, "b", false, false, 1)
_ = addChildWithFiles(t, childB, "c", true, true, 0)
_ = addChildWithFiles(t, childB, "deleted-folder", true, false, 4)

assert.NoError(t, snapshotManager.PersistRepoSnapshot())
exists, err := fileutils.IsFileExists(repoSnapshotFilePath, false)
Expand Down
2 changes: 1 addition & 1 deletion utils/cliutils/cli_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "time"

const (
// General CLI constants
CliVersion = "2.44.0"
CliVersion = "2.44.1"
ClientAgent = "jfrog-cli-go"

// CLI base commands constants:
Expand Down
Loading

0 comments on commit 1bfa0c1

Please sign in to comment.