feat(proposal draft, submodule): manage repositories as submodules instead of vcstool.#6611
feat(proposal draft, submodule): manage repositories as submodules instead of vcstool.#6611paulsohn wants to merge 14 commits intoautowarefoundation:mainfrom
Conversation
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
7115d02 to
05243ab
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
…ch for `.repos` and `vcs`) Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
f63875b to
0e2802b
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
401f7be to
ca40127
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
8e0c360 to
d6c93b4
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
3c58971 to
4d9bb4e
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
564a5ba to
120e7f4
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
0e630c9 to
9c4df46
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
07c1bcd to
ca4755d
Compare
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
| mkdir -p "$AUTOWARE_PATH" | ||
| chmod 755 "$AUTOWARE_PATH" | ||
| cp -rfT "$WEBAUTO_CI_SOURCE_PATH" "$AUTOWARE_PATH" | ||
| chown -R "$user":"$user" "$AUTOWARE_PATH" |
There was a problem hiding this comment.
Context: Disabling webauto vcstool feature enables us to execute cloning -> dependency resolution -> build chain continuously. For clarity, I would like to have a source file in its place to be before cloning -> dependency resolution -> build chain.
After environment-setup phase, all build phases are done in $AUTOWARE_PATH directory.
| @@ -0,0 +1,54 @@ | |||
| # Update submodules to nightly. | |||
| # .repos sync is not handled here (maybe run pre-commit once?) | |||
| name: Update Nightly Submodules | |||
There was a problem hiding this comment.
Where is nightly?
git submodule update --remote src/xxx is equivalent to importing xxx-nightly.repos.
In this proposal, xxx-nightly.repos files are not materialized. Instead, one can always
- have nightly configuration by
git submodule update --remote src/xxx(equivalent to importingxxx-nightly.repos) - switch to "nightly" branch (which this workflow is assumed to be update daily), and the content of
xxx.reposthere isxxx.reposin main plusxxx-nightly.repos.
The nightly branch here must be branch-protected.
We can further create a PR to 'stable-nightly' branch (branch name is just an example) and manually updated so that the 'stable-nightly' branch always passes build and necessary tests.
| - repo: https://github.com/paulsohn/pre-commit-hooks-submodules | ||
| rev: v0.0.0-pre5 | ||
| hooks: | ||
| - id: check-submodules-branch |
There was a problem hiding this comment.
This pre-commit checks:
- whether the indexed commit hash is contained in the branch specified in
.gitmodule.
This takes some time as it fetches git history, and this might fail (for released repositories which may follow main branch in nightly configuration, tagged commit might be diverged from main branch)
It is not desirable to have a chronically broken check (broken window theory), so this check might get dropped.
| - id: check-gitmodules | ||
| - id: sync-repos-files | ||
| args: [--repos-dir, repositories] |
There was a problem hiding this comment.
This pre-commit checks:
- whether submodule name matches to submodule path
- whether each submodule entry in
.gitmoduleshave eitherupdate = noneorbranch = <branch>(it might have both, but meaningless.) - For each
*.reposfiles contained in--repos-dirdirectory (i.e.repositories/*.repos),repositories.path/to/submoduleentry inxxx.reposshould be in 1-to-1 correspondence with a submodule atsrc/xxx/path/to/submodule, and version (commit hash), branch and git url should agree.- If there are any discrepancies, the repos files are overwritten. submodule status is the source of truth.
- Note that even if there are submodules in
src/xxx/, the check is skipped ifrepositories/xxx.reposis missing. In this way, we can remove repos files in the future.
| source: | ||
| vcstool: | ||
| repositories_files: | ||
| - repositories/autoware.repos | ||
| - repositories/simulator.repos | ||
| import_path: src |
There was a problem hiding this comment.
Removed vcs import in the beginning, so we can take the full control on how we can clone the repositories (either vcs, or submodules)
| - .webauto-ci/main/environment-setup/**/* | ||
| - name: autoware-setup | ||
| user: autoware | ||
| workdir: /opt/autoware |
There was a problem hiding this comment.
After environment-setup phase, workdir should be on the $AUTOWARE_PATH for clarity.
| - src/autoware/**/* | ||
| - src/simulator/**/* |
There was a problem hiding this comment.
Since we used autoware and simulator (corresponding to autoware.repos and simulator.repos), we include them in key_files. Not sure if webauto can handle gitlink.
.gitmodules just contains metadata for manipulation, and the contents of each repository are uniquely determined (up to hash collision) by the gitlink, so .gitmodules should not be a key file.
Description
A design proposal of using git submodules to manage PRs instead of
.reposfiles. Inspired from #6587 .Mapping Rules
aaa/bbbinxxx.repos-> submodulesrc/XXX/aaa/bbbversionis a branch, thensubmodule.<submodule>.branch = <version>.exceptions are the nightly versions:update: branch is set to indicate nightly-able entries.submodule.<submodule>.branchis unset for nightly-able ones.versionis a tag or a commit hash, thensubmodule.<submodule>.update = noneso thatgit submodule update --remoteignores updating. Otherwise,submodule.<submodule>.updateis unset (which defaults to checkout option)Mapping is done by copilot-generated python scripts:
`add_submodules.py`
`set_submodules_nightly.py`
And then I ran:
Manipulations
More operations for this convention of git submodule are explained in my toy repository toy-advanced-submodule, made for testing vcstool-like repository management only using git submodule.
Cloning and Initialization
You can init other submodules or submodule groups at any time you want. Below commands work even if you have init'ed submodules partially.
Use nightly
Only nightly-able submodules (no
update = none) are updated to the latest HEAD (or, to the latest branch HEAD).Returning all submodules into the recorded commits
$ git submodule update --checkout $ git submodule update --checkout src/autoware # equivalent to `vcs import src < autoware.repos` againThis can be used for:
Checking the current submodule status at once
This displays commit hashes, and tags for whichever submodule that is pointing some tag.
How was this PR tested?
The building steps are same as usual. I built this on my local device and confirmed that the build passes without any problem, and
build/install/directories look exactly the same as before.Below is the justification of the versions I was building, and nightly demonstration.
`git submodule status`
Partial init is tested as well.
Notes for reviewers
This PR is NOT intended to be merged as-is; although I updated most actions to keep consistency with the submodule convention, github bots bumping
.reposversions, adapting every.reposin the submodules, and updating tools of AWF and all of its users such as Web.Auto to make this build are clearly out of this PR's scope.Also, we should thoroughly discuss from whether we should accept this submodule design, to (if positive) directory and naming conventions of each submodules, git aliases to ease the learning curve of this particular submodule usage, and how can we migrate everyone's assets while retaining backward compatibility and cause minimal pain.
Effects on system behavior
Obviously CIs and build pipelines will be broken; it should not affect the actual binary built and hence the runtime behavior.