Skip to content

`lex gitlab` "Mirror"

Rick Pernak edited this page Apr 25, 2022 · 10 revisions

Mirror Initialization

For internal development, we wanted a private repository. GitHub doesn't allow accessibility levels to change between branches or forks, so to have something completely private, I've mirrored this repository as of commit 96bd498 to AER's internal Gitlab server lex-gitlab with:

% pwd
/rd47/scratch/RC/LBLRTM
% git remote -v
origin	[email protected]:AER-RC/LBLRTM.git (fetch)
origin	[email protected]:AER-RC/LBLRTM.git (push)
% git remote add mirror [email protected]:RC/lblrtm.git
% git push -u mirror --all
% git push -u mirror --tags

note: i have not used the Gitlab-recommended (and much simpler) web interface to mirror. i was not successful with that initially.

from Slack:

@Karen @eli this was harder than i realized. GitHub will not allow one to change "visibility" of a repository that one forks -- i.e., since our LBLRTM repo in GitHub is publicly available, so are any forks of it. i've abandoned this plan.

instead, i've migrated what is currently in GitHub to our AER internal Gitlab server so only AER employees see it, and more specifically only our RC group in Gitlab have access. everyone in the RC Gitlab group has at least developer permissions. Igor and I have maintainer privileges, meaning we are the only ones that can change master in Gitlab. it looks like ALL AER-RC members on GitHub are owners and thus can change master there -- i don't recall allowing this. i can try to downgrade permissions if that is desireable.

i have started issue tracking, which you can view in the Gitlab board. I don't think Eli will have access but Karen can have a look and suggest any additions. you'll see that the Gitlab migration takes care of one issue (the "Overarching" goal of having a "Local version" in which we can develop), and i also tagged the current master branch with a tag/release of v12.12 and a branch of UMinn_v12.12

i've documented what i've done so far with the migration in a Wiki page and issue tracking

Branches vs. Tags

Branches and Tags should not be named identically (e.g., a v12.12 tag and branch cannot co-exist). Please use branches for development and tags for releases. Naming conventions should be v*.* for tags (major.minor), and branches are more free-form (e.g., pernak_v12.13_dev).

Since developers cannot push branches to master, they need not concern themselves with tags. Maintainers are responsible for releases.

Development in Mirror

Since LBLRTM has submodules associated with it, and those submodules are publicly available in GitHub, and .gitmodules does not specify a URL (I had to do this to allow SSH and HTTPS cloning), the submodule update is a little clunky. It requires a clone of each submodule after cloning the entire repository:

git clone [email protected]:RC/lblrtm.git lblrtm-mirror # NO RECURSIVE KEYWORD
cd lblrtm-mirror
rmdir aer_rt_utils cross-sections
git clone [email protected]:AER-RC/aer_rt_utils.git
git clone [email protected]:AER-RC/cross-sections.git
git checkout v12.11

note: the --recursive keyword is not used here. it can be, but the clone will return an error after checking out the core LBL code.

also note we are NOT working with the master branch. users should checkout the the latest version of LBL as of this writing, which is v12.11

then for developing:

git branch your_branch
git checkout your_branch
... # develop
git commit -a -m 'initial commit to my branch'
git push -u origin master

Then create a merge request. Maintainers of the repository take it from here.

Merging With GitHub (Maintainers Only)

The merge request created in the previous section will likely not be a merge of the development branch onto the master branch of the mirror. Rather, the branch probably should be pushed to the GitHub original.

First, we should ensure clarity between the private (lex-gitlab) and public (GitHub) repositories, which I will refer to as the remote mirror and remote origin, respectively:

% pwd

/rd47/scratch/RC/lblrtm-mirror

% git remote -v

origin [email protected]:RC/lblrtm.git (fetch)

origin [email protected]:RC/lblrtm.git (push)

% git remote rename origin mirror

% git remote add origin [email protected]:AER-RC/LBLRTM.git

Now a test branch to verify this works:

git checkout v12.11
git branch rp_test
git checkout rp_test
touch test.txt
git add test.txt 
git commit -a -m 'test merge between mirror and original'
git push mirror rp_test
git push origin rp_test

Note we can push the branch to both remotes (Gitlab and GitHub), so similar procedures can be followed for branches developed in Development in Mirror

Clone this wiki locally