Skip to content

Commit

Permalink
Run Docker tests with local Artifactory (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva authored Oct 27, 2022
1 parent c1a14e9 commit dc99c77
Show file tree
Hide file tree
Showing 40 changed files with 1,632 additions and 305 deletions.
1 change: 0 additions & 1 deletion .github/workflows/accessTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/artifactoryTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/distributionTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/dockerTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -29,5 +28,19 @@ jobs:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Containerize Artifactory
run: |
cd ./testdata/docker/artifactory/
./start.sh
env:
RTLIC: ${{secrets.RTLIC}}
GOPROXY: direct
- name: Wait for Artifactory to finish loading
uses: nev7n/wait_for_response@v1
with:
url: "http://localhost:8082"
responseCode: 200
timeout: 600000
interval: 500
- name: Run Docker tests
run: go test -v -timeout 0 --test.docker --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --rt.dockerRepoDomain=${{ secrets.CONTAINER_REGISTRY }} --rt.dockerVirtualRepo=${{ secrets.DOCKER_VIRTUAL }} --rt.dockerLocalRepo=${{ secrets.DOCKER_LOCAL }} --rt.dockerRemoteRepo=${{ secrets.DOCKER_REMOTE }} --rt.dockerPromoteLocalRepo=${{ secrets.DOCKER_PROMOTE_LOCAL }}
run: go test -v -timeout 0 --test.docker
1 change: 0 additions & 1 deletion .github/workflows/goTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/gradleTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/mavenTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/npmTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/nugetTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pluginsTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/podmanTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Podman Tests
on:
push:
# Triggers the workflow on labeled PRs only.
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Podman-tests:
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push'
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Go Cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Run podman tests
run: go test -v -timeout 0 --test.podman --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }}
1 change: 0 additions & 1 deletion .github/workflows/pythonTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [ labeled ]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/removeLabel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/scriptTests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Scripts Tests
on: [push, pull_request]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/transferTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/xrayTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
pull_request_target:
types: [labeled]
# Ensures that only the latest commit is running for each PR at a time.
# Ignores this rule for push events.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -55,4 +54,8 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run Xray tests
run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.xray --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --jfrog.user=${{ secrets.PLATFORM_USER }} --ci.runId=${{ runner.os }}-xray
run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.xray --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --jfrog.user=${{ secrets.PLATFORM_USER }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }}
if: ${{ matrix.os != 'ubuntu-latest' }}
- name: Run Docker scan and Xray tests
run: go test -v github.com/jfrog/jfrog-cli --timeout 0 --test.xray --test.dockerScan --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }}
if: ${{ matrix.os == 'ubuntu-latest' }}
54 changes: 39 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,19 @@
</div>
</td>
</tr>
<tr>
<td><img align="center" src="./images/podman.png" alt="docker"> Podman</td>
<td>
<div align="center">
<img text-align="center" src="https://img.shields.io/github/workflow/status/jfrog/jfrog-cli/Podman%20Tests/v2?label=%20&style=for-the-badge" alt="1">
</div>
</td>
<td>
<div align="center">
<img text-align="center" src="https://img.shields.io/github/workflow/status/jfrog/jfrog-cli/Podman%20Tests/dev?label=%20&style=for-the-badge" alt="1">
</div>
</td>
</tr>
<tr>
<td><img align="center" src="./images/nuget.png" alt="nuget"> NuGet</td>
<td>
Expand Down Expand Up @@ -380,6 +393,8 @@ The types are:
| `-test.maven` | Maven tests |
| `-test.gradle` | Gradle tests |
| `-test.docker` | Docker tests |
| `-test.dockerScan` | Docker scan tests |
| `-test.podman` | Podman tests |
| `-test.go` | Go tests |
| `-test.pip` | Pip tests |
| `-test.pipenv` | Pipenv tests |
Expand Down Expand Up @@ -469,31 +484,40 @@ go test -v github.com/jfrog/jfrog-cli -test.gradle [flags]

#### Docker tests

In addition to [general optional flags](#Usage) you _must_ use the following docker flags.

##### Requirements

- On Linux machines, [Podman](https://podman.io/) tests will be running, so make sure it's available in the local path.
- Make sure the environment variable `RTLIC` is configured with a valid license.
- You can start an Artifactory container by running the `startArtifactory.sh` script under the `testdata/docker/artifactory` directory. Before running the tests, wait for Artifactory to finish booting up in the container.

| Flag | Description |
| ---------------------------- | -------------------------------------------------------------- |
| `-rt.dockerRepoDomain` | Artifactory Docker registry domain. |
| `-rt.dockerVirtualRepo` | Artifactory Docker virtual repository name. |
| `-rt.dockerRemoteRepo` | Artifactory Docker remote repository name. |
| `-rt.dockerLocalRepo` | Artifactory Docker local repository name. |
| `-rt.dockerPromoteLocalRepo` | Artifactory Docker local repository name - Used for promotion. |
| Flag | Description |
| ---------------------------- | ------------------------------------------- |
| `-test.containerRegistry` | Artifactory Docker registry domain. |

##### Examples

To run docker tests execute the following command (fill out the missing parameters as described below).

```
go test -v github.com/jfrog/jfrog-cli -test.docker -rt.dockerRepoDomain=DOCKER_DOMAIN -rt.DockerLocalRepo=DOCKER_LOCAL_REPO [flags]
go test -v github.com/jfrog/jfrog-cli -test.docker [flags]
```

#### Podman tests

| Flag | Description |
| ------------------------- | -------------------------------------- |
| `-test.containerRegistry` | Artifactory container registry domain. |

##### Examples

To run podman tests execute the following command (fill out the missing parameters as described below).

```
go test -v github.com/jfrog/jfrog-cli -test.podman [flags]
```

#### Go commands tests

##### Requirement
##### Requirements

- The tests are compatible with Artifactory 6.10 and higher.
- To run go tests run the following command:
Expand All @@ -504,7 +528,7 @@ go test -v github.com/jfrog/jfrog-cli -test.go [flags]

#### NuGet tests

##### Requirement
##### Requirements

- Add NuGet executable to the system search path (PATH environment variable).
- Run the following command:
Expand All @@ -515,7 +539,7 @@ go test -v github.com/jfrog/jfrog-cli -test.nuget [flags]

#### Pip tests

##### Requirement
##### Requirements

- Add Python and pip executables to the system search path (PATH environment variable).
- Run the following command:
Expand Down Expand Up @@ -565,7 +589,7 @@ go test -v github.com/jfrog/jfrog-cli -test.transfer [flags]
To run Xray tests execute the following command:

```
go test -v github.com/jfrog/jfrog-cli -test.xray [flags]
go test -v github.com/jfrog/jfrog-cli -test.xray -test.dockerScan [flags]
```

# Code Contributions
Expand Down
Loading

0 comments on commit dc99c77

Please sign in to comment.