-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checkout submodules #173
checkout submodules #173
Conversation
744fdac
to
dbba4e3
Compare
await git.remoteAdd('origin', repositoryUrl) | ||
} | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff looks pretty bad right here, even though mostly indention just changed.
I made the above if-block return
to short circuit.
Since this function is basically a long sequence of git commands, i wanted to de-indent the below code one level so this overall function is a little bit easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave comments to call out what actually changed
// Checkout | ||
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint) | ||
|
||
// Submodules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These additional submodule commands are the only thing that changed
@@ -84,6 +84,35 @@ jobs: | |||
shell: bash | |||
run: __test__/verify-lfs.sh | |||
|
|||
# Submodules false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i really love being able to e2e validate :)
@@ -61,32 +80,39 @@ describe('git-auth-helper tests', () => { | |||
).toBeGreaterThanOrEqual(0) | |||
}) | |||
|
|||
const configuresAuthHeaderEvenWhenPersistCredentialsFalse = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test got renamed to configureAuth_blahblah
|
||
const registersBasicCredentialAsSecret = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, this test got renamed (prefixed)
if (settings.submodules) { | ||
try { | ||
// Temporarily override global config | ||
await authHelper.configureGlobalAuth() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the trick for auth:
- Copy global git config to runner_temp
- Temporarily override $HOME to point to the temp folder (just during submodule commands)
- Add auth token to the global git config (under runner temp)
Spent forever trying to figure out how to do this securely. Here's the problems involved:
- Avoid passing creds on the command line due to customers commonly logging process audit events (dont want creds written to security event log).
- Avoid cred helper due to issue w/ apple git caching and not calling cred helper
- Submodules do not use the main repository's local git config, they have their own
- A submodule's local git config does not exist until
submodule update
is run (the fetch). So the trick we use when cloning the main repo isnt possible (git init, git remote add, git config auth, then finally git fetch).
await this.execGit(args) | ||
} | ||
|
||
async submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add retry for submoduleUpdate
Hi. Is this PR targeting only the usecase from #166 or is it trying to bring more general submodule support back into checkout@v2? |
@timsnyder-siv the goal is to add general submodule support to checkout@v2 |
|
||
// Persist credentials | ||
if (settings.persistCredentials) { | ||
await authHelper.configureSubmoduleAuth() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we remove the cred during post-job cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git-auth-helper.removeAuth() removes it
14250c9
to
3577377
Compare
Checkout action introduced number of improvements simplifying checkout of submodules and fetch of all history for all tags and branches: - actions/checkout#258 - actions/checkout#173
Checkout action introduced number of improvements simplifying checkout of submodules and fetch of all history for all tags and branches: - actions/checkout#258 - actions/checkout#173
Add input to control whether to checkout submodules.
Related to ADR #157