Work with repositories

Prev Next

A repository in IAG is a reference to a Git repository that contains your scripts, automations, or other files. IAG pulls the repository when you run a service to ensure your scripts are always up to date.

Public and private repositories

IAG supports both public and private Git repositories:

  • Public repositories: No authentication required. IAG can clone these repositories without credentials.
  • Private repositories: Require authentication using either SSH keys or HTTP basic authentication (username and password/token).

For information about setting up authentication, see:

Create a repository

Use the iagctl create repository command to create a repository reference.

For more information, see the create repository command reference.

Create a public repository

Syntax:

iagctl create repository <repository-name> \
  --url <git-url>

Example:

iagctl create repository my-public-repo \
  --url https://github.com/example/public-automations.git

Create a private repository with SSH authentication

Syntax:

iagctl create repository <repository-name> \
  --url <ssh-git-url> \
  --private-key-name <secret-name>

Parameters:

  • <repository-name>: A unique name for the repository reference
  • --url: The SSH Git URL (starts with git@)
  • --private-key-name: The name of the secret that contains your SSH private key

Example:

iagctl create repository my-private-repo \
  --url git@github.com:example/private-automations.git \
  --private-key-name git-key

For detailed setup instructions, see Use SSH keys to clone git repositories.

Create a private repository with HTTP basic authentication

Syntax:

iagctl create repository <repository-name> \
  --url <https-git-url> \
  --username <git-username> \
  --password-name <secret-name>

Parameters:

  • <repository-name>: A unique name for the repository reference
  • --url: The HTTPS Git URL
  • --username: Your Git username
  • --password-name: The name of the secret that contains your password or token

Example:

iagctl create repository my-private-repo \
  --url https://github.com/example/private-automations.git \
  --username myusername \
  --password-name github-token

For detailed setup instructions, see Set up HTTP basic authentication for repositories.

Reference a specific branch or commit

By default, IAG clones the default branch of your repository. You can specify a different branch, tag, or commit using the --reference parameter.

Syntax:

iagctl create repository <repository-name> \
  --url <git-url> \
  --reference <branch-tag-or-commit>

Examples:
Create a repository that references the develop branch:

iagctl create repository my-dev-repo \
  --url https://github.com/example/automations.git \
  --reference develop

Create a repository that references a specific tag:

iagctl create repository my-stable-repo \
  --url https://github.com/example/automations.git \
  --reference v1.2.0

Add tags and descriptions to repositories

You can add tags and descriptions to help organize and identify repositories.

Example:

iagctl create repository automation-repo \
  --url https://github.com/example/automations.git \
  --description "Production automation scripts" \
  --tags "production,automation,networking"

Repository structure best practices

When you organize scripts in a Git repository for use with IAG, consider these practices:

  • Use clear directory structures: Organize scripts by type, function, or environment (for example, scripts/backup/, scripts/deployment/)
    *** Keep related files together**: Place scripts and their dependencies in the same directory
  • Use consistent naming: Name directories and files descriptively
  • Document your structure: Include a README file that explains the repository organization

Example repository structure:

automation-repo/
├── README.md
├── backup/
│   ├── daily-backup.sh
│   └── weekly-backup.sh
├── deployment/
│   ├── deploy-app.py
│   └── rollback.py
└── monitoring/
    ├── check-status.sh
    └── alert.py

When you create a service, you specify the --working-dir parameter to tell IAG which directory contains your script.

View repositories

List all repositories:

iagctl get repositories

View details of a specific repository:

iagctl describe repository <repository-name>

Delete a repository:

iagctl delete repository <repository-name>
Important

Before you delete a repository, verify that no services reference it. If services use the repository, they will fail when you delete it.