Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into anlyzer…
Browse files Browse the repository at this point in the history
…-version

# Conflicts:
#	go.mod
#	go.sum
  • Loading branch information
sverdlov93 committed Sep 14, 2023
2 parents 9d8d6b0 + 667c810 commit aab974a
Show file tree
Hide file tree
Showing 23 changed files with 172 additions and 63 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/frogbot-scan-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- uses: jfrog/frogbot@v2
env:
JFROG_CLI_LOG_LEVEL: "DEBUG"

# [Mandatory]
# JFrog platform URL (This functionality requires version 3.29.0 or above of Xray)
JF_URL: ${{ secrets.FROGBOT_URL }}
Expand Down Expand Up @@ -116,4 +117,5 @@ jobs:
# [Optional]
# Set the minimum severity for vulnerabilities that should be fixed and commented on in pull requests
# The following values are accepted: Low, Medium, High or Critical
# JF_MIN_SEVERITY: ""
# JF_MIN_SEVERITY: ""

1 change: 1 addition & 0 deletions .github/workflows/frogbot-scan-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: jfrog/frogbot@v2
env:
JFROG_CLI_LOG_LEVEL: "DEBUG"

# [Mandatory]
# JFrog platform URL (This functionality requires version 3.29.0 or above of Xray)
JF_URL: ${{ secrets.FROGBOT_URL }}
Expand Down
4 changes: 2 additions & 2 deletions access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestRefreshableAccessTokens(t *testing.T) {
assert.NotEmpty(t, curRefreshToken)

// Make the token always refresh.
auth.InviteRefreshBeforeExpiryMinutes = 365 * 24 * 60
auth.RefreshPlatformTokenBeforeExpiryMinutes = 365 * 24 * 60

// Upload a file and assert tokens were refreshed.
uploadedFiles++
Expand All @@ -90,7 +90,7 @@ func TestRefreshableAccessTokens(t *testing.T) {
}

// Make the token not refresh. Verify Tokens did not refresh.
auth.InviteRefreshBeforeExpiryMinutes = 0
auth.RefreshPlatformTokenBeforeExpiryMinutes = 0
uploadedFiles++
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, "testdata/a/b/b2.in", uploadedFiles)
if !assert.NoError(t, err) {
Expand Down
4 changes: 2 additions & 2 deletions artifactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5268,7 +5268,7 @@ func TestRefreshableArtifactoryTokens(t *testing.T) {
assert.NotEmpty(t, curRefreshToken)

// Make the token always refresh.
auth.RefreshBeforeExpiryMinutes = 60
auth.RefreshArtifactoryTokenBeforeExpiryMinutes = 60

// Upload a file and assert tokens were refreshed.
uploadedFiles++
Expand Down Expand Up @@ -5312,7 +5312,7 @@ func TestRefreshableArtifactoryTokens(t *testing.T) {
}

// Make the token not refresh. Verify Tokens did not refresh.
auth.RefreshBeforeExpiryMinutes = 0
auth.RefreshArtifactoryTokenBeforeExpiryMinutes = 0
uploadedFiles++
err = uploadWithSpecificServerAndVerify(t, artifactoryCommandExecutor, "testdata/a/b/b2.in", uploadedFiles)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions build/getcli/jf.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

CLI_OS="na"
CLI_UNAME="na"
CLI_MAJOR_VER="v2-jf"
VERSION="[RELEASE]"

Expand Down Expand Up @@ -52,7 +51,7 @@ else
;;
*)
echo "Unknown machine type: $MACHINE_TYPE"
exit -1
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jf"
Expand Down
3 changes: 1 addition & 2 deletions build/getcli/jfrog.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

CLI_OS="na"
CLI_UNAME="na"
CLI_MAJOR_VER="v2"
VERSION="[RELEASE]"

Expand Down Expand Up @@ -52,7 +51,7 @@ else
;;
*)
echo "Unknown machine type: $MACHINE_TYPE"
exit -1
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jfrog"
Expand Down
3 changes: 1 addition & 2 deletions build/installcli/jf.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

CLI_OS="na"
CLI_UNAME="na"
CLI_MAJOR_VER="v2-jf"
VERSION="[RELEASE]"
# Order is by destination priority.
Expand Down Expand Up @@ -55,7 +54,7 @@ else
;;
*)
echo "Unknown machine type: $MACHINE_TYPE"
exit -1
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jf"
Expand Down
3 changes: 1 addition & 2 deletions build/installcli/jfrog.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

CLI_OS="na"
CLI_UNAME="na"
CLI_MAJOR_VER="v2"
VERSION="[RELEASE]"
# Order is by destination priority.
Expand Down Expand Up @@ -55,7 +54,7 @@ else
;;
*)
echo "Unknown machine type: $MACHINE_TYPE"
exit -1
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jfrog"
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.46.3",
"version": "2.47.0",
"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.46.3",
"version": "2.47.0",
"description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸",
"homepage": "https://github.com/jfrog/jfrog-cli",
"preferGlobal": true,
Expand Down
3 changes: 1 addition & 2 deletions build/setupcli/jf.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

CLI_OS="na"
CLI_UNAME="na"
CLI_MAJOR_VER="v2-jf"
VERSION="[RELEASE]"
# Order is by destination priority.
Expand Down Expand Up @@ -59,7 +58,7 @@ else
;;
*)
echo "Unknown machine type: $MACHINE_TYPE"
exit -1
exit 1
;;
esac
URL="https://releases.jfrog.io/artifactory/jfrog-cli/${CLI_MAJOR_VER}/${VERSION}/jfrog-cli-${CLI_OS}-${ARCH}/jf"
Expand Down
66 changes: 66 additions & 0 deletions documentation/CLI-for-JFrog-Lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,69 @@ Use signing key pair "myKeyPair" and overwrite in case of conflicts.
```
jf rbp --signing-key=myKeyPair --project=project0 --overwrite=true --sync=true myApp 1.0.0 PROD
```
### Distributing a release bundle
This command distributes a Release Bundle v2 to an edge node.
| | |
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Command-name | release-bundle-distribute |
| Abbreviation | rbd |
| Command options | |
| --create-repo | \[Default: false\]<br><br>Set to true to create the repository on the edge if it does not exist. |
| --dry-run | \[Default: false\]<br><br>Set to true to disable communication with JFrog Distribution. |
| --dist-rules | \[Optional\]<br><br>Path to a file, which includes the Distribution Rules in a JSON format. See [structure](#distribution-rules-structure) bellow. |
| --site | \[Default: *\]<br><br>Wildcard filter for site name. |
| --city | \[Default: *\]<br><br>Wildcard filter for site city name. |
| --country-codes | \[Default: *\]<br><br>Semicolon-separated list of wildcard filters for site country codes. |
| --insecure-tls | \[Default: false\]<br><br>Set to true to skip TLS certificates verification. |
| --mapping-pattern | \[Optional\]<br><br>Specify along with 'mapping-target' to distribute artifacts to a different path on the edge node. You can use wildcards to specify multiple artifacts. |
| --mapping-target | \[Optional\]<br><br>The target path for distributed artifacts on the edge node. If not specified, the artifacts will have the same path and name on the edge node, as on the source Artifactory server. For flexibility in specifying the distribution path, you can include [placeholders](https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-UsingPlaceholders) in the form of {1}, {2} which are replaced by corresponding tokens in the pattern path that are enclosed in parenthesis. |
| Command arguments | |
| release bundle name | Name of the Release Bundle to distribute. |
| release bundle version | Version of the Release Bundle to distribute. |
#### Distribution Rules Structure:
```json
{
"distribution_rules": [
{
"site_name": "DC-1",
"city_name": "New-York",
"country_codes": ["1"]
},
{
"site_name": "DC-2",
"city_name": "Tel-Aviv",
"country_codes": ["972"]
}
]
}
```
The Distribution Rules format also supports wildcards. For example:
```json
{
"distribution_rules": [
{
"site_name": "",
"city_name": "",
"country_codes": ["*"]
}
]
}
```

#### Examples

#### Example 1
Distribute the Release Bundle v2 named myApp with version 1.0.0. Use the distribution rules defined in the specified file.

jf rbd --dist-rules=/path/to/dist-rules.json myApp 1.0.0

#### Example 2

Distribute the Release Bundle v2 named myApp with version 1.0.0 using the default distribution rules.
Map files under the 'source' directory to be placed under the 'target' directory.

jf rbd --dist-rules=/path/to/dist-rules.json --mapping-pattern="(*)/source/(*)" --mapping-target="{1}/target/{2}" myApp 1.0.0
11 changes: 6 additions & 5 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.10
github.com/jfrog/gofrog v1.3.0
github.com/jfrog/jfrog-cli-core/v2 v2.41.7
github.com/jfrog/jfrog-client-go v1.32.1
github.com/jfrog/jfrog-cli-core/v2 v2.43.0
github.com/jfrog/jfrog-client-go v1.32.2
github.com/jszwec/csvutil v1.8.0
github.com/mholt/archiver/v3 v3.5.1
github.com/stretchr/testify v1.8.4
Expand All @@ -21,6 +21,7 @@ require (
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/term v0.12.0
gopkg.in/yaml.v2 v2.4.0

)

require (
Expand Down Expand Up @@ -125,10 +126,10 @@ require (

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230828134416-f0db33dd9344

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230907095444-fd00f19be95d
// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20230904170814-03a7938bae94

// 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.20230906115540-2c3c91d271d6
replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230913164821-c396cb9a4e06

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38
// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230831151231-e5e7bd035ddc
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ github.com/jfrog/build-info-go v1.9.10 h1:uXnDLVxpqxoAMpXcki00QaBB+M2BoGMMpHODPk
github.com/jfrog/build-info-go v1.9.10/go.mod h1:ujJ8XQZMdT2tMkLSMJNyDd1pCY+duwHdjV+9or9FLIg=
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.41.7 h1:t54PfmmTWsrX1L/7WpY0n57AwWfNZSfoTI1RG9huXlE=
github.com/jfrog/jfrog-cli-core/v2 v2.41.7/go.mod h1:HCMfdtCy2B81EF8YiQlsfbG3CsLk/VeqoWGNYoSUz8Q=
github.com/jfrog/jfrog-client-go v1.32.1 h1:RQmuPSLsF5222vZJzwkgHSZMMJF83ExS7SwIvh4P+H8=
github.com/jfrog/jfrog-client-go v1.32.1/go.mod h1:362+oa7uTTYurzBs1L0dmUTlLo7uhpAU/pwM5Zb9clg=
github.com/jfrog/jfrog-cli-core/v2 v2.43.0 h1:euo1CjZcpMdWkFUQ3zffRPfCR1zXhLD6TE/lfexV99o=
github.com/jfrog/jfrog-cli-core/v2 v2.43.0/go.mod h1:NWqT0ZnAvEdjaXGp64POvRV35TJ2R/c0W45UmrXQonk=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230913164821-c396cb9a4e06 h1:QcREjpuUJmLsy7aSXTcMomAIVFgOsdUHGi7lcqVfg8M=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230913164821-c396cb9a4e06/go.mod h1:UewnwkIf/77HzBgwCPzOHZCK6V/Nw5/JwdzN/tRb4aU=
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
3 changes: 1 addition & 2 deletions lifecycle/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: coreCommon.CreateBashCompletionFunc(),
Category: lcCategory,
Hidden: true,
Action: distribute,
},
})
Expand Down Expand Up @@ -170,7 +169,7 @@ func assertSigningKeyProvided(c *cli.Context) error {
}

func createLifecycleDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, error) {
lcDetails, err := cliutils.CreateServerDetailsWithConfigOffer(c, false, cliutils.Platform)
lcDetails, err := cliutils.CreateServerDetailsWithConfigOffer(c, true, cliutils.Platform)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit aab974a

Please sign in to comment.