Deploy a Demo Worker Script
The easiest way to deploy an automation is to provide a Python worker script via a Git repository, preferably on GitHub.
Worker scripts will be cloned from the repo when running the worker as a job. To accomplish this a repo url, credentials and a ssh key need to be specified when creating a worker entity in the //bench Cloud Automation Framework.
As an additional prerequisite for this demo you will need to have a (free) account on GitHub
Create a Worker Script
Fork the worker script demo from the tycho//works git repository
[email protected]/tycho-works/twb-workerscript-demo.git:
-
Sign-in to GitHub
-
Enter
repo:tycho-works/twb-workerscript-demoin the searchbar to find the demo repository. -
Click on the
Forkbutton on the right side.You will find the following files in your newly created repo:
schemas.json # input/output schemas specification
worker_script.py # python script handling the automationInspect and modify the files if you like. You will need nothing more that a git repo for creating an automation worker.
-
Click on the green
<> Codebutton in the middle and select theSSHtab.You can copy the path of your repo fork here. It should look like
[email protected]:<your-github-name>/twb-workerscript-demo.
Create a Worker Entity
To deploy the worker script in the Automation Framework follow these steps:
-
Sign-in to //bench Automation Framework.
-
Click on the "WORKERS" section on the left menu.
-
Click on the purple "+" icon in the lower right to open the worker creation dialog.
-
Fill out the following fields:
- "Name" of your script, e.g.
Script Demo - "Description" of your script (optional)
- "Address" as
europe.pkg.dev/twb-worker-pygitwhich is the address of a pre-defined tycho//works worker docker image executing a python script from a Git repo. - "Tag" which should be
1.0.1for the fixed version (preferred) ormainfor the latest version of this pre-defined worker. - "Script worker" checked to be able to enter further details.
- "Name" of your script, e.g.
-
Click on the "CREATE" button to create a new worker entity which can execute a python script.
-
To attach your Python script of your Git repo click on the three dots icon menu in the row of created worker. Click on the "Edit" menu item.
-
Now, additional fields appear to be filled out because this worker is a "Script worker":
- "GIT repository" which is the git repo path of your python script
as
[email protected]:<your-github-name>/twb-workerscript-demo - "Branch name" as
mainreferring to the branch to be checked out when executing the script. - "SSH public key" which is pre-filled out to be used for accessing your GitHub script repository.
- "SSH private key" which is pre-filled out as the complementary part of the public key.
- "SSH phrase" is currently empty.
- "GIT repository" which is the git repo path of your python script
as
-
Click on the "SAVE" button to update these details.
-
Now you need to enable GitHub to let the Automation Framework access (clone) the worker script repo by SSH:
-
Click on GitHub add a new public key.
-
Add a "Title" for your SSH Key like
bench worker script demo -
Leave "Key type" selected on "Authentication Key"
-
Copy-and-Paste the "SSH public key" from step 7. into the "Key" field. (You may either click on "Edit" or "Details" to open up the worker details to copy the SSH public key)
-
Click on the green
Add SSH keybutton.
-
-
Done!
Configure the Demo Task
xx
Run the Demo Job
yy