Location of repositories
Code for Matlab 2020a and above will be stored in Git repositories.
The location of all the "master" repositories for FACET-II is in AFS:
/afs/slac/g/cd/swe/git/repos/slac/FACET/
The repository for Matlab files is here:
/afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a.git
The production version (on facet-srv0X) is here:
/usr/local/facet/tools/matlab2020a/
Cloning the repo on AFS (rhel6-64, lcls-dev3, et al)
In your user directory on AFS, create a working directory ('git_work' in this example). Then execute the 'git clone' command:
[sgess@rhel6-64a ~/sgess/git_work ]$ git clone /afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a.git Initialized empty Git repository in /u/at/sgess/git_work/matlab2020a/.git/ remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done. [sgess@rhel6-64a ~/sgess/git_work ]$ ls matlab2020a
Cloning the repo on facet-srv0X
In your user directory, create a working directory ('git_work' in this example). Then execute the 'git clone' command:
[fphysics@facet-srv01 ~/sgess/git_work ]$ git clone ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a.git Initialized empty Git repository in /home/fphysics/sgess/git_work/matlab2020a/.git/ sgess@mcclogin's password: remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done. [fphysics@facet-srv01 ~/sgess/git_work ]$ ls matlab2020a
Editing a file and pushing the changes
In this example, we will edit the file 'README.md'. Then we use 'git commit' to commit our changes and 'git push' to add them to the master repo:
Working in home workspace on AFS
[sgess@lcls-dev3 ~/sgess/git_work/matlab2020a ]$ vim README.md [sgess@lcls-dev3 ~/sgess/git_work/matlab2020a ]$ git commit -m "test commit from AFS" README.md [master c2cb0c2] test commit from AFS 1 files changed, 2 insertions(+), 0 deletions(-) [sgess@lcls-dev3 ~/sgess/git_work/matlab2020a ]$ git push origin master Counting objects: 5, done. Delta compression using up to 40 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 333 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To /afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a.git ffd224e..c2cb0c2 master -> master
Working in home workspace on production
[fphysics@facet-srv01 ~/sgess/git_work/matlab2020a ]$ vim README.md [fphysics@facet-srv01 ~/sgess/git_work/matlab2020a ]$ git commit -m "test commit from facet-srv01" README.md [master c2cb0c2] test commit from facet-srv01 1 files changed, 2 insertions(+), 0 deletions(-) [fphysics@facet-srv01 ~/sgess/git_work/matlab2020a ]$ git push origin master sgess@mcclogin's password: Counting objects: 5, done. Delta compression using up to 40 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 333 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a.git ffd224e..c2cb0c2 master -> master
Updating the production repo
Once you've pushed your changes to the master repo, they are not automatically updated in production. To do that:
[fphysics@facet-srv01 ~/sgess/git_work/matlab2020a ]$ cd /usr/local/facet/tools/matlab2020a/ [fphysics@facet-srv01 /usr/local/facet/tools/matlab2020a ]$ git pull sgess@mcclogin's password: remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a c2cb0c2..4cb81f7 master -> origin/master Updating c2cb0c2..4cb81f7 Fast-forward README.md | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-
Git Etiquette
- General Git workflow: add, commit, fetch*, pull, push (*fetch is optional, used for sanity checking in case of upstream changes)
- Leaving helpful descriptions of changes, bug fixes, etc. is strongly encouraged in your commits
When releasing a new repo to the production release area, the remote repo should be specified with the `ssh://` protocol. This will ensure that other FACET-II shared account users (fsoftegr/fphysics) will be able to access the repo and make changes. E.g.:
[fphysics@facet-srv01 /usr/local/facet/tools/matlab2020a ]$ git clone ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a/my_new_repo.git [fphysics@facet-srv01 /usr/local/facet/tools/matlab2020a ]$ cd my_new_repo && git remote -v origin ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a/my_new_repo.git (fetch) origin ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlab2020a/my_new_repo.git (push)
- You may work with repos hosted in cloud services such as GitHub/GitLab/etc, but when deploying code to production you must sync them to the master AFS repos as indicated above. This is typically done as follows:
1. Sync to local AFS workspace via internet accessible node (rhel6-64, lcls-dev3).
2. Push to AFS master repo (this can be done by setting different remote repos for fetching and pushing).
3. Proceed with releasing software to production as indicated above.