Clone Template repositories

Overview

When you create an Environment from a Template, the Component repositories from the Environment point to the repositories the Template contains. This is the desired outcome when you are working with your own Templates on a given project.

But whenever starting a new project, you need to "break free" of the Template repositories, so that you can test things out, and eventually create a new, distinct Template out of the resulting bunnyshell.yaml.


Steps

  1. Clone/fork the original Template repositories, so you have the code separated, in a new, distinct repository.
  2. Modify the gitRepo properties, for each of the Components, so they point to your new repositories.

📘

You can use the Bunnyshell CLI to help you with this.

You can update the git repo and branch for a single component.

bns env update-components \
      --component-name my-component \
      --target https://github.com/my-fork/my-repo@my-main

Or update all components matchig a certain repo (with or without branch).

bns env update-components \
    --source https://github.com/original/repo
    --target [email protected]/my-fork/my-repo
bns env update-components \
    --source https://github.com/original/repo@orig-branch
    --target [email protected]/my-fork/my-repo@new-branch

 

Use the CLI to find the repositories

First, you need to list the Environments, and find the ID of the Environment you're targetting.

$ bns env list
EnvironmentID | ProjectID  | Name                       | Namespace | Type    | OperationStatus
b1XarqzE8Y    | DEKr5YlrPp | Demo Books                 | v4h6fa    | primary | stopped
70xNn2Jxz1    | DEKr5YlrPp | Demo Books Dev             | k3uylq    | primary | stopped
zqx8BkeXkM    | DEKr5YlrPp | Express + React + Postgres | 7zjzcg    | primary | stopped

Once you have the Environment ID, you can run bns git info to retrieve the Git information.

$ bns git info --environment b1XarqzE8Y
EnvironmentID | ComponentID | Name     | Repository                                        | Branch    | Sha                                      | DeployedSha
b1XarqzE8Y    | KQ0r8DqGYw  | backend  | https://github.com/sorinbunnyshell/demo-books.git | main      | fa565d504a461f3fc2fa78017137eacdc091de73 | fa565d504a461f3fc2fa78017137eacdc091de73
b1XarqzE8Y    | gWzl8DNz3Q  | db       | https://github.com/sorinbunnyshell/demo-books.git | main      |                                          |
b1XarqzE8Y    | A50Arg3z98  | frontend | https://github.com/sorinbunnyshell/demo-books.git | main      | fa565d504a461f3fc2fa78017137eacdc091de73 | fa565d504a461f3fc2fa78017137eacdc091de73