Skip to main content

Git FAQ

info

In this FAQ, a "resource" refers to any Application, Workflow, or Scheduled Job.

Can I add multiple resources to the same Git repository?

Yes, you can initialize multiple resources within a single repository. That said, you may want to group your resources into different repositories based on team or use case. For example, the Solutions Engineering team might create their own repository for all of their Superblocks tools, whereas the Product team may maintain a separate repository.

How do I remove a resource from source control?

  1. Checkout a new branch in your local Git directory, then run the following command with the Superblocks CLI:

    superblocks rm
  2. Scroll through the displayed resources with the arrow keys ↑↓ or type the name of a resource to find it in the list of options. Press 'Space' to select the resource(s) to remove, then press 'Enter' to continue. Locally, this will remove the resource(s) from the repository's .superblocks/superblocks.json file, as well as remove the resource folder.

  3. Commit the changes and push them to your repository:

    git add .
    git commit -m "commit message"
    git push origin/<MY_BRANCH>
  4. In your repository, merge the changes into your main branch to sync changes back to Superblocks.

After completing these steps, the resource(s) will no longer appear in the Superblocks repositories page.

How do I develop custom components for an Application with source control enabled?

  1. Navigate to your Application in Superblocks and create a new branch.
  2. In the local directory for your cloned Git repository, checkout this same branch and cd into your apps/APP_NAME directory. There, create or edit your custom component (more on this here).
  3. Once you are satisfied with your custom component in Local Dev mode, run superblocks components upload to make the component available to the Edit mode of your Application.
  4. Navigate to your Application in Superblocks and disable Local Dev mode to return to Edit mode. Your component registration and upload actions will now show as Uncommitted changes. Commit these changes to push them to your Git repository.
  5. Once your changes are approved, merge them into your main branch to trigger the CI to sync changes back to your Superblocks Application's main branch, then deploy this latest commit in Superblocks.

How do I rename a resource?

Renaming a resource is an un-versioned change in Superblocks. However, you may still want to update the resource definition and folder structure in your Git repository to reflect the new name. The best way to accomplish this is as follows:

  1. Move resources into a new folder

On a new branch in the local directory for your cloned Git repository, move the resource folder to a new folder based on the resource name. For example, if an Application is currently named My App 1, and it is being renamed to My App 2, run this command to move the app to a new folder based on the name:

mv apps/my_app_1 apps/my_app_2
  1. Update files

cd into your new resource folder and open the application.yaml (Application) or api.yaml (Workfkows and Scheduled Jobs) file. There, update the name configuration to use the new name.

Open your repository's root .superblocks/superblocks.json file and update the location value to use your new resource directory (apps/my_app_2 in the example above).

  1. Commit, push, and merge changes

Commit and push the changes up to your Git repository and merge them with the main branch. The commit will then be pushed to Superblocks via the CI. Note, there will be no visible change in Superblocks to reflect this change, other than the new commit in the commit log.

  1. Update the resource name in Superblocks

Lastly, update the resource name in the Superblocks UI. After you do this, your resource name will now be cleanly aligned with the definition in your Git repository.