Introduction
This article describes the method for
- Setting up a Git workflow among multiple repositories across Cloudlab and ALM
- How to keep those repositories in sync
- How to use another repo within a given repo
Developer Workflow
The overall process is as follows:
Create a local Git repo that is a clone of Cloudlab
ocng_test
repo.Add the
ocng_test
ALM repo as a second remote.Fetch all there is in both the repositories.
Checkout the branch you want to work with. Commit your changes.
Merge the changes from origin/development and/or upstream/development into your local development branch. Resolve conflicts, if any.
Push changes to remotes.
Once the branch is pushed to the remote, the usual Git workflow to integrate changes follows, i.e., by creating a merge request for the target branch and triggering reviews.
Keeping Repositories in-sync
The Cloudlab ocng_test
repo will periodically pull changes from ALM ocng_repo
in master
and development
branches. Both manual and automated synchronizations are supported through the Cloudlab pipeline. The script to do this is shown below
and illustrated in the below pic.
The merge from development-sync
to development
branch in Cloudlab ocng_test
repo will be manual to account for any merge conflicts.
Using NF Test Cases Repo
The ocng_test
repo contains the framework code only. It does not contain the NF specific test cases. The test cases are stored in separate repositories of the NF. If we commit the test cases repository files into Cloudlab instance of ocng_test
repo, it will cause problems when merging the changes back to ALM instance of ocng_test
repo.
Git provides a few options to use another repo within a given repo.
Git Subtree. Git subtree allows you to insert any repository as a sub-directory of another one. To add PCF
ATS
repo as a subtree inocng_test
repo -The ATS repo will be added as a subdirectory under
ocnftest
folder inocng_test
repo. The main drawback is that pushingocng_test
repo to remote pushes sub-tree's files.Git Submodule. Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit. To add PCF
ATS
repo as a submodule inocng_test
repo -The ATS repo will be added as a subdirectory under
ocnftest
folder inocng_test
repo. The advantage over Git subtree is that pushingocng_test
repo to a remote doesn't push sub-module's files. It will, however, create a.gitmodules
file under root folder with following content -As a Subdirectory. Another option is to put
ATS
repo as a subdirectory in theocng_test
local repo. Add the subfolder to .gitignore in your main repo.The ATS repo will be added as a subdirectory under
ocnftest
folder inocng_test
repo. Addocnftest/ocpcf/*
in.gitignore
to avoid the contents ofocpcf
directory to be pushed to theocng_test
remote.
Comments
Post a Comment