create repository

Create a new repository

Synopsis

Create

This command will create a repository reference in torero's data store. A repository within torero is a reference to a git repository that exists on some external server. Repositories are pulled down when a service is executed so that the reference is always fresh.

If you would like to reference a specific branch/SHA in your git repository, you can use the --reference flag.

Setting Up Private Repositories If the repository that you are trying to reference is not publicly accessible, you will need to give torero access to a private ssh key that has read access to the repository on your git server. It is recommended that you create an ssh key just for torero for security reasons. The steps below demonstrate how a key can be added to gitlab but your specific steps may vary.

  1. Generate a public/private ssh key pair. Be sure to not overwrite any keys that you are currently using elsewhere. E.g.

    >_ ssh-keygen -t rsa -b 2048 \
    -C "<comment>" \
    -f /Users/torerouser/.ssh/torero_git_rsa

  2. Upload your newly generated public key to your git server. This varies by git provider.

  3. Setup secret storage within torero. This will require you to create a separate encryption key that is unrelated to ssh for handling torero secrets. Run torero create secret -h for more information.

  4. Once you have an encryption key file setup from step 3, encrypt your private key into torero's encrypted store. E.g.
    >_ torero create secret git-key \
    --value @/Users/torerouser/.ssh/torero_git_rsa \
    --encryption-file /Users/toerrouser/.torero.d/torero_secret.key
  5. Create your repository and reference your newly created secret with the --private-key-file flag. E.g.
    >_ torero create repository my-private-repo \
    --url [email protected]:example/some-private-repo-with-automations.git \
    --private-key-name git-key
torero create repository <name> --url <string> [flags]

Examples

Create A Repository That Is Publicly Accessible

Creates a repository called my-public-repo. This command assumes that the git repo is publicly accessible and no authentication is required to access it.

>_ torero create repository my-public-repo \
--url [email protected]:example/some-public-repo-with-automations.git

Create A Repository That References A Specific Branch

Creates a repository called my-branch-reference that will pull down the devel branch when executing services.

>_ torero create repository my-branch-reference \
--url [email protected]:example/some-public-repo-with-automations.git \
--reference devel

Create A Repository That Is Private And Requires Authentication

Creates a repository called my-private-repo that references a private-key-name that exists in torero's secret store. This example assumes that a user had previously created a torero secret called git-key.

>_ torero create repository my-private-repo \
--url [email protected]:example/some-private-repo-with-automations.git \
--private-key-name git-key

Options

      --description string        A brief description of the repository
  -h, --help                      help for repository
      --private-key-name string   The secret name for the private key for retrieving the repository.
      --reference string          The reference to checkout within the repository. E.g: branch, SHA
      --tag stringArray           Metadata tag(s) to associate with the service
      --url string                The url of the repository

Options inherited from parent commands

      --config string   Path to the configuration file
      --raw             Displays the result of the command in its raw format
      --verbose         Enable verbose output

SEE ALSO