Skip to content

Automatize Flex scripts deployments using the B2B API in Python

License

Notifications You must be signed in to change notification settings

guillaumegay13/flex-remote-executor

Repository files navigation

project-logo

FLEX-REMOTE-EXECUTOR

Elevate Flex workflows with dynamic remote execution!

license last-commit repo-top-language repo-language-count


Table of Contents

Overview

Flex Remote Executor is a comprehensive software project that facilitates seamless remote job execution and workflow management on the Flex platform. Leveraging robust APIs and efficient handling of JSON configurations, it empowers users to create, update, and cancel jobs, manage metadata, and migrate workflows effortlessly. With dynamic action creation and Groovy script generation capabilities, the project ensures efficient backend task execution. Flex Remote Executors value proposition lies in its ability to streamline job operations, enhance workflow migration accuracy, and provide flexible monitoring and tracking features, making it an indispensable tool for Flex users.


Getting Started

System Requirements:

  • Python: version 3.10.x

Installation

  1. Clone the flex-remote-executor repository:
$ git clone https://github.com/guillaumegay13/flex-remote-executor
  1. Change to the project directory:
$ cd flex-remote-executor
  1. Install the dependencies:
$ pip install -r requirements.txt

Usage

Run flex-remote-executor using the command below:

$ python run.py

[OPTIONAL] Create an alias and add it to your .bashrc file:

alias fre='python run.py'

Commands

Create

Creates a new object or environment. Note: you need to create an environment first to use the other commands!

python run.py create --env <ENV> [--set-default] --type <TYPE> --name <NAME> --value <VALUE> [--definitionId <DEFINITION_ID>] [--assetId <ASSET_ID>] [--assetIds <ASSET_IDS>] [--url <URL>] [--username <USERNAME>] [--password <PASSWORD>]

Arguments

--type: object type (e.g., env, action, header, workflow, job)
--set-default: set environment as default (only compatible with --type env)
--env: environment to use
--name: object name
--value: object value
--definitionId: workflow definition ID
--assetId: asset ID to launch the job or workflow on
--assetIds: asset IDs to launch the job or workflow on
--url: environment URL
--username: username
--password: user password

Export

Exports objects to a CSV.

python run.py export --env <ENV> --type <TYPE> --name <NAME> [--filters <FILTERS>] [--include-error] [--include-metadata] [--header <HEADER>] [--uuid <UUID>]

Arguments:

--env: environment to use
--type: object type (e.g., jobs, assets, workflows)
--name: object name (e.g., action name, workflow definition name)
--filters: export filters to apply (e.g., "status=Failed")
--include-error: include error details (only useful for failed jobs)
--include-metadata: include metadata (only useful for assets)
--header: header for columns to export
--uuid: object UUID to export

Retry

Retries failed jobs.

python run.py retry --env <ENV> --type <TYPE> --name <NAME> [--filters <FILTERS>] [--id <ID>] [--script-path <SCRIPT_PATH>] [--keep-imports]

Arguments

--env: environment to use
--type: object type (e.g., jobs, workflows)
--name: object name (e.g., action name, workflow definition name)
--filters: filters to apply (e.g., "status=Failed")
--id: object ID to retry
--script-path: script path to update the job or action
--keep-imports: keep the import section of the job without updating it with classes from the script (only available with the --script-path flag)

Cancel

Cancels failed jobs.

python run.py cancel --env <ENV> --type <TYPE> --name <NAME> [--filters <FILTERS>] [--errors <ERRORS>]

Arguments

--env: environment to use
--type: object type (e.g., jobs, workflows)
--name: object name (e.g., action name, workflow definition name)
--filters: filters to apply (e.g., "status=Failed")
--errors: error message of jobs to cancel (e.g., "Resource item named")

Update

Updates an object.

python run.py update --env <ENV> --type <TYPE> --id <ID> --script-path <SCRIPT_PATH>

Arguments

--env: environment to use
--type: object type (e.g., job, action)
--id: pbject ID
--script-path: script path to update the job or action

Examples

Create a new environment and set it as default:

python run.py create --env dev --set-default --type env --name new_environment --url "http://newenv.local" --username admin --password secret

Export jobs with specific filters:

python run.py export --env production --type jobs --filters "status=Failed" --include-error --header "Job ID,Status,Error"

Retry a failed job with a specific ID:

python run.py retry --env production --type jobs --id 12345 --script-path /path/to/script.groovy

Cancel jobs with a specific error message:

python run.py cancel --env production --type jobs --errors "Resource item named"

Update an action with a new script:

python run.py update --env production --type action --id action123 --script-path /path/to/new/script.groovy

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/guillaumegay13/flex-remote-executor
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

This project is protected under the MIT License.


Acknowledgments

  • List any resources, contributors, inspiration, etc. here.

Return


About

Automatize Flex scripts deployments using the B2B API in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages