Skip to content
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

Set multiple sparse checkout paths in one command/job #1577

Merged
1 commit merged into from
Apr 29, 2021
Merged

Set multiple sparse checkout paths in one command/job #1577

1 commit merged into from
Apr 29, 2021

Conversation

benbp
Copy link
Member

@benbp benbp commented Apr 27, 2021

For pipelines with many paths (e.g. core ci), it can be annoying to have so many separate jobs show up in the UI, one for each path. Additionally, sometimes git tries to do garbage collection and it can take a lot longer to run many git sparse-checkout add commands as opposed to a single set command. This PR changes the behavior to parse the yaml paths parameter object into the script, and run a single command to set the sparse checkout paths. I use invoke-expression here because otherwise powershell treats the space-separated string as a single parameter and it all ends up on the same line in the sparse checkout config file.

@benbp benbp added the Central-EngSys This issue is owned by the Engineering System team. label Apr 27, 2021
@benbp benbp self-assigned this Apr 27, 2021
@benbp benbp requested a review from a team as a code owner April 27, 2021 20:36
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@@ -24,15 +24,13 @@ steps:
- pwsh: |
git clone --no-checkout --filter=tree:0 git://github.com/${{ repo.Name }} .
git sparse-checkout init
git sparse-checkout set eng
$paths = ('${{ convertToJson(parameters.Paths) }}' | ConvertFrom-Json) -Join ' '
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting pattern. We might be able to use this to move other things into inline loop in the script block instead of having many devops steps.

Copy link
Member Author

@benbp benbp Apr 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's very useful. I could see some of our release configs being made much simpler this way (instead of iterating over artifacts).

@ghost
Copy link

ghost commented Apr 29, 2021

Hello @azure-sdk!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 52d9e6a into Azure:master Apr 29, 2021
@benbp benbp deleted the benbp/sparse-checkout-path-improvement branch April 29, 2021 17:27
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants