Skip to content

Commit 9af0478

Browse files
authored
Merge branch 'dev' into fix/gradlecmd-args-with-spaces
2 parents 3afe13b + 488e89b commit 9af0478

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+678
-382
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
- [ ] All [tests](https://github.com/jfrog/jfrog-cli#tests) passed. If this feature is not already covered by the tests, I added new tests.
2-
- [ ] All [static analysis checks](https://github.com/jfrog/jfrog-cli/actions/workflows/analysis.yml) passed.
3-
- [ ] This pull request is on the dev branch.
4-
- [ ] I used gofmt for formatting the code before submitting the pull request.
5-
-----
1+
- [ ] All [tests](https://github.com/jfrog/jfrog-cli/CONTRIBUTING.md#tests) have passed. If this feature is not already covered by the tests, new tests have been added.
2+
- [ ] The pull request is targeting the `dev` branch.
3+
- [ ] The code has been validated to compile successfully by running `go vet ./...`.
4+
- [ ] The code has been formatted properly using `go fmt ./...`.
5+
6+
---

CONTRIBUTING.md

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
# 📖 Guidelines
2+
3+
- Ensure that your changes are covered by existing tests. If not, please add new tests.
4+
- Create pull requests on the `dev` branch.
5+
- Before submitting the pull request, format the code by running `go fmt ./...`.
6+
- Before submitting the pull request, ensure the code compiles by running `go vet ./...`.
7+
8+
# ⚒️ Building and Testing the Sources
9+
10+
## Building JFrog CLI
11+
12+
To build JFrog CLI, first, make sure Go is installed by running the following command:
13+
14+
```sh
15+
go version
16+
```
17+
18+
Next, clone the project sources and navigate to the root directory:
19+
20+
```sh
21+
git clone https://github.com/jfrog/jfrog-cli.git
22+
cd jfrog-cli
23+
```
24+
25+
To build the sources on Unix-based systems, run:
26+
27+
```sh
28+
./build/build.sh
29+
```
30+
31+
On Windows, run:
32+
33+
```sh
34+
.\build\build.bat
35+
```
36+
37+
After the build process completes, you will find the `jf` or `jf.exe` executable in the current directory.
38+
39+
### Dependencies in other JFrog modules
40+
41+
This project heavily depends on the following modules:
42+
43+
- [github.com/jfrog/jfrog-client-go](https://github.com/jfrog/jfrog-client-go)
44+
- [github.com/jfrog/jfrog-cli-core](github.com/jfrog/jfrog-cli-core)
45+
- [github.com/jfrog/build-info-go](github.com/jfrog/build-info-go)
46+
- [github.com/jfrog/gofrog](github.com/jfrog/gofrog)
47+
48+
#### Local Development
49+
50+
During local development, if you come across code that needs to be modified in one of the mentioned modules, it is advisable to replace the dependency with a local clone of the module.
51+
52+
For instance, let's assume you wish to modify files from `jfrog-cli-core`. Clone the `jfrog-cli-core` repository (preferably your fork) to your local development machine, placing it at `/local/path/in/your/machine/jfrog-cli-core`.
53+
54+
To include this local dependency, modify the `go.mod` file as follows:
55+
56+
```
57+
replace github.com/jfrog/jfrog-cli-core/v2 => /local/path/in/your/machine/jfrog-cli-core
58+
```
59+
60+
Afterward, execute `go mod tidy` to ensure the Go module files are updated. Note that Go will automatically adjust the version in the `go.mod` file.
61+
62+
#### Pull Requests
63+
64+
Once you have completed your coding changes, it is recommended to push the modifications made to the other modules first. Once these changes are pushed, you can update this project to resolve dependencies from your GitHub fork or branch. To achieve this, modify the `go.mod` file to point the dependency to your repository and branch, as shown in the example below:
65+
66+
```
67+
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/galusben/jfrog-cli-core/v2 dev
68+
```
69+
70+
Finally, execute `go mod tidy` to update the Go module files. Please note that Go will automatically update the version in the `go.mod` file.
71+
72+
## Tests
73+
74+
### Usage
75+
76+
To run tests, use the following command:
77+
78+
```
79+
go test -v github.com/jfrog/jfrog-cli [test-types] [flags]
80+
```
81+
82+
The available flags are:
83+
84+
| Flag | Description |
85+
| ------------------- | ----------------------------------------------------------------------------------------------- |
86+
| `-jfrog.url` | [Default: http://localhost:8081] JFrog platform URL |
87+
| `-jfrog.user` | [Default: admin] JFrog platform username |
88+
| `-jfrog.password` | [Default: password] JFrog platform password |
89+
| `-jfrog.adminToken` | [Optional] JFrog platform admin token |
90+
| `-ci.runId` | [Optional] A unique identifier used as a suffix to create repositories and builds in the tests. |
91+
92+
The available test types are:
93+
94+
| Type | Description |
95+
| -------------------- | ------------------ |
96+
| `-test.artifactory` | Artifactory tests |
97+
| `-test.access` | Access tests |
98+
| `-test.npm` | Npm tests |
99+
| `-test.maven` | Maven tests |
100+
| `-test.gradle` | Gradle tests |
101+
| `-test.docker` | Docker tests |
102+
| `-test.dockerScan` | Docker scan tests |
103+
| `-test.podman` | Podman tests |
104+
| `-test.go` | Go tests |
105+
| `-test.pip` | Pip tests |
106+
| `-test.pipenv` | Pipenv tests |
107+
| `-test.poetry` | Poetry tests |
108+
| `-test.nuget` | Nuget tests |
109+
| `-test.plugins` | Plugins tests |
110+
| `-test.distribution` | Distribution tests |
111+
| `-test.transfer` | Transfer tests |
112+
| `-test.xray` | Xray tests |
113+
114+
When running the tests, builds and repositories with timestamps will be created, for example: `cli-rt1-1592990748` and `cli-rt2-1592990748`. The content of these repositories will be deleted once the tests are completed.
115+
116+
#### Artifactory tests
117+
118+
In addition to the [general optional flags](#Usage), you can use the following optional Artifactory flags:
119+
120+
| Flag | Description |
121+
| ---------------------- | --------------------------------------------------------------------------------------------------------------- |
122+
| `-jfrog.sshKeyPath` | [Optional] Path to the SSH key file. Use this flag only if the Artifactory URL format is `ssh://[domain]:port`. |
123+
| `-jfrog.sshPassphrase` | [Optional] Passphrase for the SSH key. |
124+
125+
##### Examples
126+
127+
To run Artifactory tests, execute the following command:
128+
129+
```
130+
go test -v github.com/jfrog/jfrog-cli -test.artifactory [flags]
131+
```
132+
133+
#### Npm tests
134+
135+
##### Requirements
136+
137+
- The _npm_ executables should be included in the system's `PATH` environment variable.
138+
- The tests are compatible with npm 7 and higher.
139+
140+
##### Limitations
141+
142+
- Currently, npm integration only supports HTTP(S) connections to Artifactory using username and password.
143+
144+
##### Examples
145+
146+
To run Npm tests, execute the following command:
147+
148+
```
149+
go test -v github.com/jfrog/jfrog-cli -test.npm [flags]
150+
```
151+
152+
#### Maven tests
153+
154+
##### Requirements
155+
156+
- The _java_ executable should be included in the system's `PATH` environment variable. Alternatively, set the `_JAVA_HOME` environment variable.
157+
158+
##### Limitations
159+
160+
- Currently, Maven integration only supports HTTP(S) connections to Artifactory using username and password.
161+
162+
##### Examples
163+
164+
To run Maven tests, execute the following command:
165+
166+
```
167+
go test -v github.com/jfrog/jfrog-cli -test.maven [flags]
168+
```
169+
170+
#### Gradle tests
171+
172+
##### Requirements
173+
174+
- The _gradle_ and _java_ executables should be included in the system's `PATH` environment variable. Alternatively, set the `JAVA_HOME` environment variable.
175+
176+
##### Limitations
177+
178+
- Currently, Gradle integration only supports HTTP(S) connections to Artifactory using username and password.
179+
180+
##### Examples
181+
182+
To run Gradle tests, execute the following command:
183+
184+
```
185+
go test -v github.com/jfrog/jfrog-cli -test.gradle [flags]
186+
```
187+
188+
#### Docker tests
189+
190+
##### Requirements
191+
192+
- Make sure the `RTLIC` environment variable is configured with a valid license.
193+
- You can start an Artifactory container by running the `startArtifactory.sh` script located in the `testdata/docker/artifactory` directory. Before running the tests, wait for Artifactory to finish booting up in the container.
194+
195+
| Flag | Description |
196+
| ------------------------- | ----------------------------------- |
197+
| `-test.containerRegistry` | Artifactory Docker registry domain. |
198+
199+
##### Examples
200+
201+
To run Docker tests, execute the following command (replace the missing parameters as described below):
202+
203+
```
204+
go test -v github.com/jfrog/jfrog-cli -test.docker [flags]
205+
```
206+
207+
#### Podman tests
208+
209+
| Flag | Description |
210+
| ------------------------- | -------------------------------------- |
211+
| `-test.containerRegistry` | Artifactory container registry domain. |
212+
213+
##### Examples
214+
215+
To run Podman tests, execute the following command (replace the missing parameters as described below):
216+
217+
```
218+
go test -v github.com/jfrog/jfrog-cli -test.podman [flags]
219+
```
220+
221+
#### Go commands tests
222+
223+
#####
224+
225+
Requirements
226+
227+
- The tests are compatible with Artifactory 6.10 and higher.
228+
- To run Go tests, use the following command:
229+
230+
```
231+
go test -v github.com/jfrog/jfrog-cli -test.go [flags]
232+
```
233+
234+
#### NuGet tests
235+
236+
##### Requirements
237+
238+
- Add the NuGet executable to the system's `PATH` environment variable.
239+
- Run the following command:
240+
241+
```
242+
go test -v github.com/jfrog/jfrog-cli -test.nuget [flags]
243+
```
244+
245+
#### Pip tests
246+
247+
##### Requirements
248+
249+
- Add the Python and pip executables to the system's `PATH` environment variable.
250+
- Run the following command:
251+
252+
```
253+
go test -v github.com/jfrog/jfrog-cli -test.pip [flags]
254+
```
255+
256+
#### Plugins tests
257+
258+
To run Plugins tests, execute the following command:
259+
260+
```
261+
go test -v github.com/jfrog/jfrog-cli -test.plugins
262+
```
263+
264+
#### Distribution tests
265+
266+
To run Distribution tests, execute the following command:
267+
268+
```
269+
go test -v github.com/jfrog/jfrog-cli -test.distribution [flags]
270+
```
271+
272+
#### Transfer tests
273+
274+
##### Requirement
275+
276+
The Transfer tests execute `transfer-files` commands between a local Artifactory server and a remote SaaS instance. In addition to the [general optional flags](#Usage), you _must_ use the following flags:
277+
278+
| Flag | Description |
279+
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
280+
| `-jfrog.targetUrl` | JFrog target platform URL. |
281+
| `-jfrog.targetAdminToken` | JFrog target platform admin token. |
282+
| `-jfrog.jfrogHome` | The JFrog home directory of the local Artifactory installation. |
283+
| `-jfrog.installDataTransferPlugin` | Set this flag to `true` if you want the test to automatically install the data-transfer plugin in the source Artifactory server. |
284+
285+
To run Transfer tests, execute the following command:
286+
287+
```
288+
go test -v github.com/jfrog/jfrog-cli -test.transfer [flags]
289+
```
290+
291+
### Xray tests
292+
293+
To run Xray tests, execute the following command:
294+
295+
```
296+
go test -v github.com/jfrog/jfrog-cli -test.xray -test.dockerScan [flags]
297+
```

Jenkinsfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,22 @@ def runRelease(architectures) {
133133
}
134134
}
135135
if (identifier == "v2") {
136-
createTagAndRelease()
136+
createTag()
137137
}
138138
}
139139
} finally {
140140
cleanupRepo21()
141141
}
142142
}
143143

144-
def createTagAndRelease() {
144+
def createTag() {
145145
stage('Create a tag and a GitHub release') {
146146
dir("$jfrogCliRepoDir") {
147147
releaseTag = "v$RELEASE_VERSION"
148148
withCredentials([string(credentialsId: 'ecosystem-github-automation', variable: 'GITHUB_ACCESS_TOKEN')]) {
149149
sh """#!/bin/bash
150150
git tag $releaseTag
151151
git push "https://$GITHUB_ACCESS_TOKEN@github.com/jfrog/jfrog-cli.git" --tags
152-
curl -L \
153-
-X POST \
154-
-H "Accept: application/vnd.github+json" \
155-
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN"\
156-
-H "X-GitHub-Api-Version: 2022-11-28" \
157-
https://api.github.com/repos/jfrog/jfrog-cli/releases \
158-
-d '{"tag_name":"$releaseTag","target_commitish":"$BRANCH","name":"$RELEASE_VERSION","generate_release_notes":true}'
159152
"""
160153
}
161154
}
@@ -418,9 +411,9 @@ def publishNpmPackage(jfrogCliRepoDir) {
418411
}
419412

420413
def publishChocoPackageWithRetries(version, jfrogCliRepoDir, architectures) {
421-
def maxAttempts = 3
414+
def maxAttempts = 10
422415
def currentAttempt = 1
423-
def waitSeconds = 20
416+
def waitSeconds = 18
424417

425418
while (currentAttempt <= maxAttempts) {
426419
try {

0 commit comments

Comments
 (0)