Testing
Overall
Tests must validate the following:
- Migrating to LFS does not present data loss
- PRs must not loose data, can be closed, but must be recoverable
- Must work for forks and PRs that use Rebase strategy
- Must work for forks and PRs that use Merge strategy
- Must work for internal branch PRs
- Must potentially work without having to enforce LFS downloads/uploads of all files
Setup
- Make sure repos pdellaert/fbw-aircraft-git-lfs and fbw-devops/fbw-aircraft-git-lfs do not exist
- Create pdellaert/fbw-aircraft-git-lfs repo, empty
- Empty the LFS Bucket with
TEST-cleanup-ALL-fbw-git-lfs-bucket.sh
Steps
-
Mirror large repo using git-mirror-large-repo.sh, this mirrors flybywiresim/aircraft to pdellaert/fbw-aircraft-git-lfs
git-mirror-large-repo.sh
-
Fork the pdellaert/fbw-aircraft-git-lfs repo to the fbw-devops org
-
Clone the fork with
git clone [email protected]:fbw-devops/fbw-aircraft-git-lfs.git
-
Add a remote of a PR to the cloned repo (https://github.com/lukecologne/a32nx/tree/fmgc-computer) and push the PR branch to the origin (fork) repo
git remote add luke [email protected]:lukecologne/a32nx.git git fetch luke git checkout luke/fmgc-computer git switch -c luke-fmgc-computer git push origin luke-fmgc-computer
-
Create the PR on the pdellaert/fbw-aircraft-git-lfs repo for the luke-fmgc-computer branch
-
Add a remote of a PR to the cloned repo (https://github.com/BravoMike99/a32nx/tree/fix-pfd-presel-text) and push the PR branch to the origin (fork) repo
git remote add bravomike [email protected]:BravoMike99/a32nx.git git fetch bravomike git checkout bravomike/fix-pfd-presel-text git switch -c bm-fix-pfd-presel-text git push origin bm-fix-pfd-presel-text
-
Create a PR on the pdellaert/fbw-aircraft-git-lfs repo for the bm-fix-pfd-presel-text branch
-
Create a PR for the fms-v2 branch as well (local to pdellaert/fbw-aircraft-git-lfs
-
Migrate the pdellaert/fbw-aircraft-git-lfs repo to LFS using the git-migrate-lfs.sh script
git-migrate-lfs.sh
-
Clone the fbw-devops/fbw-aircraft-git-lfs fork
git clone [email protected]:fbw-devops/fbw-aircraft-git-lfs.git git remote add upstream [email protected]:pdellaert/fbw-aircraft-git-lfs.git git fetch upstream
-
(OPTIONAL) Enable LFS
git config lfs.url https://git-lfs.fbw.straks.dev/aircraft.git
Optionally you might need to disable locks (although the Worker should tell LFS it doesn't support it, so then you don't need this)
git config lfs.https://git-lfs.fbw.straks.dev/aircraft.git.locksverify false
By skipping this step, git is not aware LFS is enabled for the repo, and will just work with the large files (pointers) as if they are regular files.
-
If LFS is enabled: Fetch all LFS data for the repo
git lfs fetch --all
-
Rebase the main branch of the fork so it is now using git lfs
-
If LFS is enabled:
git rebase --onto upstream/master git push --force origin master
-
If LFS is not enabled:
GIT_LFS_SKIP_SMUDGE=1 git rebase --onto upstream/master GIT_LFS_SKIP_SMUDGE=1 git push --force --no-verify origin master
-
-
Rebase the PR branch to the main upstream branch for luke-fmgc-computer (original deviating commit: de25ee7e325402e2ad8f4eb8e923c6cc0f47886)
-
If LFS is enabled:
git checkout luke-fmgc-computer git rebase --onto upstream/master de25ee7e325402e2ad8f4eb8e923c6cc0f478863 luke-fmgc-computer git push --force origin luke-fmgc-computer
-
If LFS is not enabled:
GIT_LFS_SKIP_SMUDGE=1 git checkout luke-fmgc-computer GIT_LFS_SKIP_SMUDGE=1 git rebase --onto upstream/master de25ee7e325402e2ad8f4eb8e923c6cc0f478863 luke-fmgc-computer git push --force origin luke-fmgc-computer
Note: Had to push with LFS upload because certain files had to be pushed, this seems to have worked
-
-
Rebase the PR branch to the main upstream branch for bm-fix-pfd-presel-text (original deviating commit: 7e1f8614c7b91e10e3bbd1730677b9002d3f4672 or de25ee7e325402e2ad8f4eb8e923c6cc0f47886)
-
If LFS is enabled:
git checkout bm-fix-pfd-presel-text git rebase --onto upstream/master de25ee7e325402e2ad8f4eb8e923c6cc0f47886 bm-fix-pfd-presel-text git push --force origin bm-fix-pfd-presel-text
-
If LFS is not enabled:
GIT_LFS_SKIP_SMUDGE=1 git checkout bm-fix-pfd-presel-text GIT_LFS_SKIP_SMUDGE=1 git rebase --onto upstream/master de25ee7e325402e2ad8f4eb8e923c6cc0f47886 bm-fix-pfd-presel-text git push --force origin bm-fix-pfd-presel-text
Note: Either of the commit hashes resulted in a conflict on the CHANGELOG file that had to be manually corrected. (Used de25ee7e325402e2ad8f4eb8e923c6cc0f47886).
-
-
Reopen all PRs:
- FMS-v2 - Branch was migrated automatically
- luke-fmgc-computer - branch was manually rebased
- bm-fix-pfd-presel-text - branch was manually rebased
-
Testing cloning of repo with LFS:
-
Cloning without downloading LFS files (in case only source code is relevant)
time GIT_LFS_SKIP_SMUDGE=1 git clone [email protected]:fbw-devops/fbw-aircraft-git-lfs.git NOLFSDOWNLOAD-fbw-aircraft-git-lfs time git clone [email protected]:fbw-devops/fbw-aircraft-git-lfs.git --config lfs.url=https://git-lfs.fbw.straks.dev/aircraft.git LFSDOWNLOAD-fbw-aircraft-git-lfs time git clone [email protected]:fbw-devops/fbw-aircraft-git-lfs.git --config lfs.url=https://git-lfs.fbw.straks.dev/aircraft.git --depth 1 LFSDOWNLOAD-ONEDEPTH-fbw-aircraft-git-lfs
-
Results
2023-12-26 - Mirror, Migrate & Clone only
This time not pushing chunks during Migrate, as the repo is small enough to have every push happen in 1 go.
Storage usage:
9.7G LFSDOWNLOAD-ONEDEPTH-fbw-aircraft-git-lfs
9.8G LFSDOWNLOAD-fbw-aircraft-git-lfs
161M NOLFSDOWNLOAD-fbw-aircraft-git-lfs
--
14G OLDREPO-aircraft
7.2G OLDREPO-ONEDEPTH-aircraft
2023-12-26 - Full test with LFS
Same as 2023-12-25, not showing screenshots of github anymore, but this contains an asciinema recording of the whole process.
2023-12-25
This test was executed on December 25th, 2023. Relevant commit hashes:
- flybywiresim/aircraft:master -
fee32c995aa33daac713697c74530f070ca7bfda
- flybywiresim/aircraft:fms-v2 -
d79ea0d85b73d75bc4e906af05b135ec966b75cb
- lukecologne/a32nx:fmgc-computer -
69582eed6a8e404504681de3a30fd3510c8d3827
- BravoMike99/a32nx:fix-pfd-presel-text -
42b7841b84d2f36037f87d2c3f4e90187a22bb1b
This test followed the process where LFS is not enforced on the fork after migration. This resulsts in executing steps 1-16, except for tests 11 and 13.
Remarkable notes:
- All PRs get closed because the entire history of the repository is rewritten (new commit hashes for all commits)
- The FMS-v2 branch is local to the repo and gets migrated, so recreating the PR is easy
- The PR for Luke's FMGC Computer (uses rebase) gets migrated easily, but it seemed like there were files being deleted. There's one more commit for files being deleted which was not in the original PR. Might need investigation.
- The PR for BM's fix pfd presel text (uses merge) misses the merge commit at the end, this is because during the
rebase --onto
, the entire history is rebased anyway, so the merge commit has nothing to do.