-
Notifications
You must be signed in to change notification settings - Fork 4
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
Don't hit GitHub API for schema comparisons #933
base: master
Are you sure you want to change the base?
Conversation
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.
As of recently, we've stopped checking out the entire repository as this is a slow operation for some providers to do in every step. We need to ensure this change works with a shallow clone as downloading the whole git history is slower than fetching the single file.
native-provider-ci/src/steps.ts
Outdated
@@ -553,12 +553,10 @@ export function CheckSchemaChanges(provider: string): Step { | |||
if: "github.event_name == 'pull_request'", | |||
name: "Check Schema is Valid", | |||
run: | |||
"git show ${{ github.event.repository.default_branch }}:provider/cmd/pulumi-resource-${{ env.PROVIDER }}/schema.json > ${{ runner.temp }}/schema.json;\n" + |
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.
Will this work when we only have a shallow clone of the repository? Does the shallow clone include the default_branch?
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.
As an alternative, I'd suggest adding the complexity to the schema-tools to check if the base is available in git directly, then falling back to the github API if it's a shallow clone.
We don't need to query the GitHub API for the original schema because we already have it in git history.
The latest
schema-tools
supports reading from disk instead of fetching from GitHub. This changes the job to drop the original schema into a temporary location and use that for comparison.actions/checkout
gives us a shallow merge commit. To compute the original schema, we usegit apply --reverse
to construct the schema as it existed before our merge.Requires a schema-tools release to work.
Fixes pulumi/schema-tools#64.