Hello, IAG5
  • 30 Oct 2024
  • Dark
    Light
  • PDF

Hello, IAG5

  • Dark
    Light
  • PDF

Article summary

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.

IAG5 requires a git repository to obtain the script to be used in a service. In this example we will use:

https://github.com/iagctldev/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/iagctldev/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/iagctl/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/iagctl/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/iagctl/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:


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.