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 Using SSH Key If the repository that you are trying to reference is not publicly accessible and you would like to use an SSH Git URL, 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
  1. Upload your newly generated public key to your git server. This varies by git provider.

  2. 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.

  3. 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
  4. Create your repository and reference your newly created secret with the --private-key-name flag. E.g.
    >_ torero create repository my-private-repo \
    --url git@github.com:example/some-private-repo-with-automations.git \
    --private-key-name git-key

Setting Up Private Repositories Using Username/Password If the repository is not publicy available and you would like to use a http/s Git URL, you will need to give torero access to a username/password where the password is typically a Git token. You can do so by passing both in the torero create repository command.

  1. Once you have an encryption key file setup, encrypt your private key into torero's encrypted store. E.g.
    >_ torero create secret github-token --prompt-value 
  2. Pass in the username and password to the create repository command. E.g.
    >_ torero create repository my-private-repo \
    --url https://github.com/example/some-private-repo-with-automations.git \
    --username username \
    --password-name github-token
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 git@github.com: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 git@github.com:example/some-public-repo-with-automations.git \
--reference devel

Create A Repository That Is Private And Requires SSH Key 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 git@github.com:example/some-private-repo-with-automations.git \
--private-key-name git-key

Create A Repository That Is Private And Requires Username/Password Authentication

Creates a repository called my-private-repo that uses a username and references a password that exists in torero's secret store.

>_ torero create repository my-private-repo \
--url https://github.com/example/some-private-repo-with-automations.git \
--username username \
--password-name github-token

Options

      --description string        A brief description of the repository
  -h, --help                      help for repository
      --password-name string      The secret name for the password/token to utilize when authenticating with
                                  http(s)
      --private-key-name string   The secret name for the SSH private key when authenticating over SSH.
      --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
      --username string           The username to utilize when authenticating with http(s)

Options inherited from parent commands

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

SEE ALSO