Sparse checkout docs repository in release step#1585
Sparse checkout docs repository in release step#15853 commits merged intoAzure:masterfrom benbp:benbp/docs-repo-clone
Conversation
|
The following pipelines have been queued for testing: |
|
The following pipelines have been queued for testing: |
|
The following pipelines have been queued for testing: |
|
The following pipelines have been queued for testing: |
| - pwsh: git checkout ${{ repo.Commitish }} | ||
| displayName: Sparse checkout at ${{ repo.Commitish }} | ||
| - pwsh: | | ||
| git checkout ${{ repo.Commitish }} # this will use the default branch if repo.Commitish is empty |
There was a problem hiding this comment.
How does it pick-up the default branch? Are you sure git checkout without parameters checks out the default branch? As best I can tell it will be a noop.
There was a problem hiding this comment.
From my testing (local and in-pipeline), it does. According to the docs:
You could omit , in which case the command degenerates to "check out the current branch", which is a glorified no-op with rather expensive side-effects to show only the tracking information, if exists, for the current branch.
Since we're in a state where sparse checkout paths are set but no blobs are downloaded, this seems to have the effect of grabbing all the relevant blobs.
I could switch it back to using the regex that we're using elsewhere, but as this seems to work I thought it was much cleaner.
There was a problem hiding this comment.
If this works than great. If not I was think we could use the default branch template and the $(DefaultBranch) variable in this place.
There was a problem hiding this comment.
I actually only discovered this because I copied that DefaultBranch code over and forgot to change the remote from Source to origin, so it failed to set the variable and just ran git checkout, which worked!
| displayName: Clone Documentation Repository | ||
| ignoreLASTEXITCODE: false | ||
|
|
||
| - ${{ if not(parameters.SparseCheckoutPaths) }}: |
There was a problem hiding this comment.
I definitely like this approach better as it should allow both scenarios to work. It might actually be interesting make this an option in the sparse-checkout template itself if we find more patterns like this.
There was a problem hiding this comment.
Ah you mean perhaps replacing all our checkouts with calls to some checkout template, and we can have a parameter like sparse or full? I initially tried doing a sparse checkout with /* but that actually doubled the checkout time, hence why I went this route instead.
There was a problem hiding this comment.
Yes having this split of full vs sparse clone might be a future improvement to consider.
weshaggard
left a comment
There was a problem hiding this comment.
On question about the default branch but otherwise looks good.
|
The following pipelines have been queued for testing: |
|
Hello @azure-sdk! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
In our release stages, we do a full git clone of the docs repo. This can add up to 4 minutes of time to the release stage. Checking out only the files we need reduces that time to around 10 seconds.