Skip to content

Commit

Permalink
Merge pull request #11 from ehl-jf/improve-remote-backup
Browse files Browse the repository at this point in the history
Improve remote backup example
  • Loading branch information
RemiBou authored Dec 13, 2024
2 parents 2206164 + f798237 commit edcad42
Show file tree
Hide file tree
Showing 9 changed files with 3,919 additions and 75 deletions.
10 changes: 8 additions & 2 deletions samples/artifactory/GENERIC_EVENT/artifact-cleanup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ Executing
To execute the code as a worker generic event:

- Create a new generic worker with the given code (eg: my-worker)
- Example of execution using cURL
- Example of execution using JFrog CLI

```bash
curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/my-worker" --json @- <<EOF
jf worker exec my-worker - <<EOF
{
"repos": [
"libs-release-local"
Expand All @@ -65,3 +65,9 @@ curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/m
}
EOF
```

- Example with the payload located into a file named `payload.json`:

```shell
jf worker exec my-worker @payload.json
```
10 changes: 8 additions & 2 deletions samples/artifactory/GENERIC_EVENT/clean-docker-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,20 @@ When a Docker image is deployed, Artifactory will automatically create
properties reflecting each of its labels. These properties are read by the
worker in order to decide on the cleanup policy for the image.

Cleanup can be triggered via a REST endpoint. For example:
Cleanup can be triggered using the JFrog CLI. For example:

```shell
curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/my-worker" --json @- <<EOF
jf worker exec my-worker - <<EOF
{
"dockerRepos": ["example-docker-local"],
"byDownloadDate": false,
"dryRun": true
}
EOF
```

Execute with the payload located into a file named `payload.json`:

```shell
jf worker exec my-worker @payload.json
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Execution


```shell
curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/my-worker" --json @- <<EOF
jf worker exec my-worker - <<EOF
{
"repos": [ "example-repo-local" ],
"properties": {
Expand All @@ -25,3 +25,9 @@ curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/m
}
EOF
```

Execute with the payload located into a file named `payload.json`:

```shell
jf worker exec my-worker @payload.json
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ To execute the worker:


```shell
curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/my-worker" --json @- <<EOF
jf worker exec my-worker - <<EOF
{
"path": ["example-docker-local/dir1", "example-docker-local/dir2"]
}
EOF
```

Execute with the payload located into a file named `payload.json`:

```shell
jf worker exec my-worker @payload.json
```
18 changes: 15 additions & 3 deletions samples/artifactory/GENERIC_EVENT/remote-backup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ Payload

The worker expects a JSON object of repository pairs. For example, if you'd like to
backup `repo-foo-remote` to `repo-foo-backup-local`, and also backup
`repo-bar-remote` to `repo-bar-backup-local`, your configuration would be:
`repo-bar-remote` to `repo-bar-backup-local`.
You can also specify `maxDepth` the maximum path depth to copy, as well as `maxFiles` the max number of item to copy.
Your configuration would be:

```json
{
"backups": {
"repo-foo-remote-cache": "repo-foo-backup-local",
"repo-bar-remote-cache": "repo-bar-backup-local"
},
"dryRun": false
"dryRun": false,
"maxDepth": 10,
"maxFiles": 1000
}
```

Expand All @@ -34,15 +38,23 @@ Usage

The worker can be executed using as a Generic event.

Execute with the payload from standard input:

```shell
curl -X POST -v -u admin:password "http://localhost:8080/worker/api/v1/execute/my-worker" --json @- <<EOF
jf worker exec my worker - <<EOF
{
"backups": {
"repo-foo-remote-cache": "repo-foo-backup-local",
"repo-bar-remote-cache": "repo-bar-backup-local"
},
"dryRun": true
"maxDepth": 10,
"maxFiles": 1000
}
EOF
```
Execute with the payload located into a file name `payload.json`:

```shell
jf worker exec my-worker @payload.json
```
Loading

0 comments on commit edcad42

Please sign in to comment.