Cloning a reference Git repository

In this procedure, you learn how to push code from the IBM repository to your repository.

Procedure

  1. Create a Git repository on https://github.com/ or https://github.ibm.com/.
    • Ensure that Initialize this repository with a README is not selected since you need to import assets from the reference repository.
  2. Copy the SSH URL of your new repository.
    For example, if the owner of the repository is WCI and the name of your repository is custom-buc-sample on GitHub, the SSH URL is:
    git@github.com:WCI/custom-buc-sample.git
  3. Open a Git command-line interface (CLI) such as Git Bash and clone the reference repository.
    git clone git@github.com:IBM/oms-buc-customization.git
  4. Rename the currently checked out project folder (oms-buc-customization) to your custom repository name (<your_custom_repo_name>).
    For example, custom-buc-sample.
  5. Change to the directory.
    cd <your_custom_repo_name>
  6. Find and replace references of the old repository name oms-buc-customization with your custom repository name.
    Files include but not limited to:
    • package.json file
    • angular.json file
    • README
    • All *routing.module.ts files
  7. Change the title in README.md and index.html from OmsBucCustomization to a new value.
    For example, CustomBucSample.
  8. Update the /src/app/app.module.ts and src/app/features/homehome.module.ts files.

    The files contain methods and class references that start with OmsBucCustomization and omsBucCustomization.

    Replace these references with a new name. For example, CustomBucSample and customBucSample.

  9. Rename the folder that is used for i18n files /src/assets/oms-buc-customization to use your repository name.
    For example, /src/assets/custom-buc-sample.
  10. Go back to the CLI and ensure that you are in your renamed project folder (custom-buc-sample).
  11. Set yarn as the package manager for this Angular CLI-based project.
    ng config -g cli.packageManager yarn
  12. Install all dependencies by using Yarn.
    yarn install
    Note:
    • To clear yarn cache, use: yarn cache clean
    • To ignore cache and add any dependency, use: yarn add <any dependency name> --force
  13. Run the following commands based on whether your repository has existing content.
    • If your target repository (git@github.com:IBM/custom-buc-sample) is new (not initialized with README):
      1. git remote set-url origin git@github.com:<owner>/<repository_name>.git
        Where
        • <owner>: The owner of the repository. For example, WCI.
        • <repository_name>The name of your repository. For example, custom-buc-sample.
      2. git push -u origin develop
        This command pushes all changes from the develop branch to your new repository. The develop branch is the default branch on the reference repository oms-buc-customization and is used for the DEV tenant in Order Hub.

        This history of the original reference repository git@github.com:IBM/oms-buc-customization.git is retained. If required, you can remove the history.

    • If your target repository (git@github.com:IBM/custom-buc-sample) has existing content:
      1. Change to a temporary parent folder: mkdir temp and cd temp.
      2. Clone the new repository to the folder: git clone git@github.com:<owner>/<custom_repository>.git. For example,
        git@github.com:WCI/custom-buc-sample.git
      3. Copy all the content from the custom-buc-sample folder that you changed from steps 4 to 9, except the .git and node_modules folders, into temp/custom-buc-sample.
      4. Reconcile and merge the content as needed.
      5. Install all dependencies by running the following command.
        yarn install

    You can now view all the content in the develop branch on your new repository: git@github.com:<owner>/<repository_name>.git

    Set develop branch as the default branch in the Settings tab for the repository.
  14. Consider creating branches (and set as protected branches with rules if needed) to align with the number of tenants that you have.
    You might have more than one tenant and configure each tenant as a different type. For example, if you have four tenants, you might want to set each tenant type as DEV, QA, STAGE, or PROD. It is recommended that you configure each tenant as a unique tenant type, and then associate each tenant type to a different branch in the application's repository. The following table summarizes the association:
    Table 1. Association between tenant type and Git branch
    Tenant environment Tenant Type Application branch in Git
    #1 Development DEV develop
    #2 Quality assurance QA master
    #3 Preproduction STAGE release
    #4 Production PROD production