Skip to content

Repository

The table below describes the list of actions that can be performed on "repository" using the RCTL CLI Utility.

Resource Create Get Update Delete
Repository YES YES YES YES

Declarative

A declarative approach to lifecycle management of repository is strongly recommended backed by the pipeline manifests (YAML files) that are version controlled in your Git repository.

Important

A repository can be either a Helm or Git repository type. A number of public repositories are provided by default in every project.


Create/Update Repository

You can create/update a repository in the project in your Organization based on a version controlled repository spec that you can store in a Git repository. This enables users to develop automation for reproducible infrastructure.

./rctl apply -f repository.yaml

An illustrative example of the repository version spec YAML file is shown below

apiVersion: integrations.k8smgmt.io/v3
kind: Repository
metadata:
  name: demo-repo
  project: default-project
spec:
  agents:
  - {}
  credentials:
    password: sealed://credentials.password
    username: [email protected]
  endpoint: https://github.com/demouser1/pipeline-test.git
  secret:
    name: file://artifacts/demo-repo/sealed-secret.yaml
  sharing: {}
  type: Git

Share Repository

Users are allowed to share the existing repository with one or more projects

  • Update the config spec with the sharing parameters and run the apply command
./rctl apply -f repository.yml

An illustrative example of a spec is given below that shares a repo with all the projects

apiVersion: integrations.k8smgmt.io/v3
kind: Repository
metadata:
  name: demo-repo
  project: default-project
spec:
  agents:
  - name: demo-agent
  credentials:
    password: secrets
    username: [email protected]
  endpoint: https://github.com/demo-rafay/test-repo
  sharing:
    enabled: true
    projects:
    - name: '*'
  options: {}
  type: Git
  • Run the apply command to share the repository with other projects
./rctl apply -f filepath.yaml --v3

List Repositories

Use the below command to retrieve the list of repositories

./rctl get repository <repository_name> --v3

Use this command to retrieve the list of repositories in the configured Project. An illustrative example is shown below where RCTL retrieves the list of repositories in the project "qa".

./rctl get repository -p qa --v3
+----------------------+-------------------+------+-------------------------------------------------------------+
| NAME                 | PROJECT           | TYPE | ENDPOINT                                                    |
+----------------------+-------------------+------+-------------------------------------------------------------+
| default-stable-helm  | qa                | Helm | https://charts.helm.sh/stable                               |
+----------------------+-------------------+------+-------------------------------------------------------------+
| default-bitnami      | qa                | Helm | https://charts.bitnami.com/bitnami                          |
+----------------------+-------------------+------+-------------------------------------------------------------+
| default-cert-manager | qa                | Git  | https://github.com/jetstack/cert-manager.git                |
+----------------------+-------------------+------+-------------------------------------------------------------+
| test                 | qa                | Git  | https://github.com/gajanan-rafay/test-repo                  |
+----------------------+-------------------+------+-------------------------------------------------------------+

Get Specific Repository Info

Use this command to retrieve a specific repository's details in the configured project.

./rctl get repository <repository-name> --v3

Below is the illustrative example for the repository called "demo-repo"

./rctl get repository demo-repo --v3
+----------------------+-------------------+------+-------------------------------------------------------------+
| NAME                 | PROJECT           | TYPE | ENDPOINT                                                    |
+----------------------+-------------------+------+---------+---------------------------------------------------+
| demo-repo            | prod-test          | Git  | https://github.com/gajanan-rafay/test-repo                  |
+----------------------+-------------------+------+-------------------------------------------------------------+

Or you can use below command to get more information of the repository in json or yaml format

./rctl get repository <repository-name> -o json
./rctl get repository <repository-name> -o yaml


Delete Repository

You can delete a repository in the configured project.

./rctl delete repository <repository-name> --v3

Important

Refer here for the deprecated RCTL commands