From 8642445b3ebe3f30bcc3f81b1bb8a16e4078ab79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20ESTEGUET?= <106679334+ehl-jf@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:48:30 +0200 Subject: [PATCH] Add worker-cli documentation (#139) --- .../cli-for-jfrog-platform-services/README.md | 11 ++++++++ .../platform-workers-add-secret.md | 22 ++++++++++++++++ .../platform-workers-deploy.md | 22 ++++++++++++++++ .../platform-workers-dry-run.md | 24 ++++++++++++++++++ .../platform-workers-execute.md | 25 +++++++++++++++++++ .../platform-workers-init.md | 24 ++++++++++++++++++ .../platform-workers-list-event.md | 21 ++++++++++++++++ .../platform-workers-list.md | 23 +++++++++++++++++ .../platform-workers-undeploy.md | 23 +++++++++++++++++ 9 files changed, 195 insertions(+) create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/README.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-add-secret.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-deploy.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-dry-run.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-execute.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-init.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list-event.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list.md create mode 100644 jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-undeploy.md diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/README.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/README.md new file mode 100644 index 0000000..2e3ff24 --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/README.md @@ -0,0 +1,11 @@ +# CLI for JFrog Platform Services + +This page describes how to use JFrog CLI with JFrog Platform Services. + +Read more about JFrog CLI [here](https://jfrog-external.fluidtopics.net/r/help/JFrog-CLI/JFrog-CLI). + +**Managing Workers** + +JFrog CLI allows you to fully manage your platform workers. + + diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-add-secret.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-add-secret.md new file mode 100644 index 0000000..d135ebd --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-add-secret.md @@ -0,0 +1,22 @@ +# Add worker secret + +## Overview + +This command is used to edit a worker manifest to add secret that can be used for deployment or/and execution. + +| | | +|------------------------|---------------------------------------------------------| +| Command name | worker add-secret | +| Abbreviation | worker as | +| **Command options:** | | +| `--edit` | \[Default: false] Whether to update an existing secret. | +| **Command arguments:** | | +| secret-name | The secret name | + +## Example + +Add a secret name `my-secret` to a worker initialized in the current directory. + +``` +jfrog worker add-secret my-secret +``` \ No newline at end of file diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-deploy.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-deploy.md new file mode 100644 index 0000000..6e27854 --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-deploy.md @@ -0,0 +1,22 @@ +# Deploy a worker + +## Overview + +This command is used to update the worker definition (code, description , filter, secret ...) on your Artifactory instance. + +| | | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker deploy | +| Abbreviation | worker d | +| **Command options:** | | +| `--server-id` | \[Optional] Server ID configured using the config command. | +| `--timeout-ms` | \[Default: 5000] The request timeout in milliseconds. | +| `--no-secrets` | \[Default: false] Do not use registered secrets. | + +## Example + +Deploy a worker to server with id `my-server`. + +``` +jfrog worker server deploy --server-id my-server +``` \ No newline at end of file diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-dry-run.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-dry-run.md new file mode 100644 index 0000000..d90c50a --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-dry-run.md @@ -0,0 +1,24 @@ +# Test a worker + +## Overview + +Dry run a worker. The worker needs to be initialized before running this command. + +| | | +|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker dry-run | +| Abbreviation | worker dr | +| **Command options:** | | +| `--server-id` | \[Optional] Server ID configured using the config command. | +| `--timeout-ms` | \[Default: 5000] The request timeout in milliseconds. | +| `--no-secrets` | \[Default: false] Do not use registered secrets. | +| **Command arguments:** | | +| json-payload | The json payload expected by the worker. Use `-` to read the payload from standard input. Use `@` to read from a file located at . | + +## Example + +Dry run a worker initialized in the current directory, with a payload located in a file named `payload.json` from the same directory. + +``` +jfrog worker dry-run @payload.json +``` \ No newline at end of file diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-execute.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-execute.md new file mode 100644 index 0000000..ee89eca --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-execute.md @@ -0,0 +1,25 @@ +# Execute an HTTP-triggered worker + +## Overview + +Execute an HTTP-triggered worker. + +| | | +|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker execute | +| Abbreviation | worker exec, worker e | +| **Command options:** | | +| `--server-id` | \[Optional] Server ID configured using the config command. | +| `--timeout-ms` | \[Default: 5000] The request timeout in milliseconds. | +| **Command arguments:** | | +| worker-key | The worker key. If not provided it will be read from the `manifest.json` in the current directory. | +| json-payload | The json payload expected by the worker. Use `-` to read the payload from standard input. Use `@` to read from a file located at . | + +## Example + +Execute an HTTP-triggered worker initialized in the current directory, with a payload located in a file named `payload.json` from the same directory. + +``` +jf worker execute @payload.json +``` + diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-init.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-init.md new file mode 100644 index 0000000..7bbe173 --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-init.md @@ -0,0 +1,24 @@ +# Initialize a Worker + +## Overview + +This command is used to initialize a new platform worker. + +| | | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker init | +| Abbreviation | worker i | +| **Command options:** | | +| `--force` | \[Default: false] Whether to overwrite existing files. | +| `--no-test` | \[Default: false] Whether to skip tests generation. | +| **Command arguments:** | | +| action | The action that will trigger the worker (BEFORE_DOWNLOAD, AFTER_DOWNLOAD, BEFORE_UPLOAD, AFTER_CREATE, AFTER_BUILD_INFO_SAVE, AFTER_MOVE, GENERIC_EVENT, BEFORE_CREATE_TOKEN, ...). | +| worker-name | The name of the worker | + +## Example + +Initialize a new BEFORE_DOWNLOAD worker named `my-worker`. + +``` +jfrog worker init BEFORE_DOWNLOAD my-worker +``` \ No newline at end of file diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list-event.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list-event.md new file mode 100644 index 0000000..2f27f5e --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list-event.md @@ -0,0 +1,21 @@ +# List events + +## Overview + +This command list all the available events on your Artifactory. + +| | | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker list-event | +| Abbreviation | worker le | +| **Command options:** | | +| `--server-id` | \[Optional] Server ID configured using the config command. | +| `--timeout-ms` | \[Default: 5000] The request timeout in milliseconds. | + +## Example + +List event supported by a server identified by `my-server`. + +``` +jfrog worker list-event --server-id my-server +``` \ No newline at end of file diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list.md new file mode 100644 index 0000000..65edb16 --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-list.md @@ -0,0 +1,23 @@ +# List registered workers + +## Overview + +List workers saved on your Artifactory instance. The default output is a CSV format with columns `name`,`action`,`description`,`enabled`. + +| | | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker list | +| Abbreviation | worker ls | +| **Command options:** | | +| `--server-id` | \[Optional] Server ID configured using the config command. | +| `--json` | \[Default: false] Whether to use JSON instead of CSV as output. | +| `--timeout-ms` | \[Default: 5000] The request timeout in milliseconds. | + + +# Example + +List all workers registered in a platform named `my-platform` with detailed data. + +``` +jfrog worker list --server-id my-platform --json +``` \ No newline at end of file diff --git a/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-undeploy.md b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-undeploy.md new file mode 100644 index 0000000..57e37f8 --- /dev/null +++ b/jfrog-applications/jfrog-cli/cli-for-jfrog-platform-services/platform-workers-undeploy.md @@ -0,0 +1,23 @@ +# Undeploy a worker + +## Overview + +This command is used to remove a registered worker from you Artifactory instance. + +| | | +|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Command name | worker undeploy | +| Abbreviation | worker rm | +| **Command options:** | | +| `--server-id` | \[Optional] Server ID configured using the config command. | +| `--timeout-ms` | \[Default: 5000] The request timeout in milliseconds. | +| **Command arguments:** | | +| worker-key | \[Optional] The worker key. If not provided it will be read from the `manifest.json` in the current directory. | + +## Example + +Undeploy a worker name `my-worker` from an Artifactory instance identified by `my-server`. + +``` +jfrog worker undeploy --server-id my-server my-worker +``` \ No newline at end of file