Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Contact all previous developers and tell them that the repository will move to GitHub. Ask them to push commits that are pending, otherwise, they will need to change the remotes later.

3. For SLAC-created software, rename "master" to "main" and create "pre-release"

This doesn't apply to software modified from code external to SLAC.

...

You will need to use GitHub's web system to create the repository or the github GitHub CLI tool. A couple of rules:

  • Public repository for software that has SLAC's license file and headers.
  • Private repository otherwise.
  • Don't create a README.md file.

5.1 Step-by-Step Guide

If you're unfamiliar with GitHub's interface, follow this step-by-step guide with pictures. If you already know how to do this, you may skip this section.

  1. Navigate to https://github.com
  2. In the top right corner, click the 'create repository' icon as demonstrated here.
    Image Added
  3. Next, you will be greeted with the repository creation UI. Fill it out as appropriate and click 'create repository'
    Image Added

6. Send the repository to GitHub

Replace <organization> and <repo> with the proper names in the recipe below. You will need to push every branch that you need. Below is just an example for code created at SLAC, but customized code from the community will have different branches than this example. Don't forget to add --tags to the push command. For code created at SLAC, use the -u argument for the pre-release branch. This will make it the default branch.

Code Block
languagebash
themeRDark
git remote add github-origin https://githubgit@github.com/:<organization>/<repo>.git
git push -u github-origin main --tags
git push -u github-origin pre-release --tags

7.

...

Archive & Decommission Repository in AFS

We are using this convention to name the tar.gz file: <repo_name>_moved_to_github_see_readme.tar.gz. See this example:

...

languagebash
themeRDark

The script in this repository can be used to automate the decommissioning process: https://github.com/slac-epics/migration-scripts/tree/main

This script performs the following tasks for you automatically:

  1. Adds a pre-receive hook to the AFS repository to reject any pushes, and show the new repository location to the pusher
  2. Archives the repository in a file called <repo_name>

...

  1. _moved_to_github_see_readme.tar.gz

...

  1.  
  2. Creates README_github

...

  1. with the new location of the repository

As an example, let's decommission timing/bsa:

Code Block
# Clone the scripts
git clone git@github.com:slac-epics/migration-scripts.git

cd migration-scripts

# Give it the location of the BSA repository on AFS and on GitHub, and run.
./decommission-repo.sh -r $GIT_SITE_TOP/package/timing/bsa.git -u https://github.com/slaclab/bsa.git


That's it! Now, when you try to push to that repository, you will be greeted with the following text:

Code Block
$ git push
...
remote:
remote: NOTICE: This repository has been moved to 

Create or edit the README_github file in the repository directory in AFS. Here's what the content looks like:

Code Block
languagebash
themeRDark
$ cat /afs/slac/g/cd/swe/git/repos/package/timing/README_github 
The modules below were transferred to GitHub. eco already knows it, so
if you use eco -m you will get the clone from GitHub.

The tar.gz here contains the bare repo and is just for backup purposes.

hpsTpr: https://github.com/slaclab/hpsTpr
bsa: https://github.com/slaclab/timing_bsabsa.git
remote: 
remote: Pushes here are no longer accepted, please update your remote with:
remote: git remote set-url origin git@github.com:slaclab/bsa.git
remote:
...

8. Modify eco_modulelist

In your local area (not the release area!), use eco to retrieve the module list:

...

No Format
# Packages (or non-epics drivers)
l2Mps                   https://githubgit@github.com/:slaclab/l2Mps.git
yamlReader              https://githubgit@github.com/:slaclab/yamlReader.git
hpsTpr                  https://githubgit@github.com/:slaclab/hpsTpr.git
commonATCA              https://githubgit@github.com/:slaclab/commonATCA.git
bsa                     https://githubgit@github.com/:slaclab/timing_bsa

Now commit and push the changes and update them in the release area:

Code Block
languagebash
themeRDark
# Commit our changes to the module list
git add modulelist.txt
git commit -m "migrate things to GitHub"
git push origin master

# Go to the release area and pull in the latest changes
cd /afs/slac/g/lcls/tools/eco_modulelist
git pull

...

  • Click on Settings.
  • Click on Collaborators and teams.
  • Click on Add teams.
  • Search for the group tid-cdsid-acs cse and make this group admin of the repository.
  • This is only for code created at SLAC and not for code from the community:
    • Still in the Settings page, click on the General link on the menu on the left. 
    • Find the section Default branch. Change from If it is not pre-release, change from main to pre-release. This is to avoid accidental clones starting at main and pull requests made at main.
    • Still in the Settings page, click on the Branches link on the menu on the left. 
    • Click on Add branch protection rule.
    • For the main branch:
      • Branch name pattern: type main in this field.
      • Check these boxes:
        • Require a pull request before merging
        • Require approvals
        • Require conversation resolution before merging
        • Lock branch
      • Click on Save changes.
    • For the pre-release branch:
      • Branch name pattern: type pre-release in this field.
      • Check these boxes:
        • Require a pull request before merging
        • Require approvals
        • Require conversation resolution before merging
      • Click on Save changes.

...