-
Notifications
You must be signed in to change notification settings - Fork 183
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
Sparse checkout docs repository in release step #1585
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes having this split of full vs sparse clone might be a future improvement to consider.
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.
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.