- 13 Nov 2024
-
DarkLight
-
PDF
Hello, IAG5
- Updated on 13 Nov 2024
-
DarkLight
-
PDF
Every good software project has a "hello world" example. This guide will walk through a typical workflow of creating a service and explain all the steps along the way. We will be using a python service
to perform the example.
⚠ This example is Not for Production but to get a feel on how to use the application.
Create (Link) a Repository Resource
IAG5 requires a git
repository to obtain the script to be used in a service. In this example we will use:
https://github.com/torerodev/example-scripts
It is important that you use a real git
repository for this to work.
To create the repository in IAG5, we will use the iagctl create repository
command.
iagctl create repository example-scripts-repo --description "Simple repository for quick start" --url https://github.com/torerodev/example-scripts.git --reference main
IAG5 should return results that show a repository has been created.
Output:
Successfully created the repository
Name: example-scripts-repo
Description: Simple repository for quick start
Url: https://github.com/torerodev/example-scripts.git
Reference: main
Tags:
Private Key Name:
Verify Created Repository (Optional)
To verify the repository was created:
>_ iagctl get repositories
Return results:
Output:
NAME DESCRIPTION URL REFERENCE TAGS PRIVATE KEY NAME
example-scripts-repo Simple repository for quick start https://github.com/torerodev/example-scripts.git main
To get details for the repository:
iagctl describe repository example-scripts-repo
Return results:
Output:
Name: example-scripts-repo
Description: Simple repository for quick start
Url: https://github.com/torerodev/example-scripts.git
Reference: main
Tags:
Private Key Name:
Create a Service
Once IAG5 knows the repository location that stores the automation scripts, a service can be created. First, create the service and then provide the service the name of the repository and filename (if applicable) for the automation.
Since you will be creating a python script, you will need to write your script and name it hello-iagctl.py
. You can reference Python Service page to understand more about the service.
To create a service:
iagctl create python-script hello-iagctl --repository example-scripts-repo --filename hello-iagctl.py --description "Quick Start Example"
Return results:
Output:
Successfully created the Python script
Name: hello-iagctl
Repo Name: example-scripts-repo
Working Dir:
File Name: hello-iagctl.py
Decorator:
Description: Quick Start Example
Tags:
Run a Service
Now that IAG5 has a registered service to run, any user with proper access rights may now run the service. To pass inputs through the service, you will need to use the --set
command that takes in a key=value
syntax. In this example we are passing the key and value of name
and world
to the python script.
To run a service:
iagctl run python-script hello-iagctl
Return results:
Output:
Start Time: 2024-01-01T12:00:00Z
End Time: 2024-01-01T12:00:01Z
Elapsed Time: 1.372672s
Return Code: 0
Stdout:
Hello, iagctl!
...
Stderr: