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

Run compilation check as a composite action #15157

Merged

Conversation

MiguelWeezardo
Copy link
Member

@MiguelWeezardo MiguelWeezardo commented Nov 22, 2022

Description

Previous compilation check had a design flaw.
It used environment definitions from the HEAD of the PR for all commits in the PR.

Additional context and related issues

In our CI pipeline we want to test if all commits of a PR would compile if checked out individually.
This ensures commits don't have dependencies on changes added afterwards.
This makes it possible to automate git bisect.

Previous approach used a step in the main CI workflow, which is loaded when a CI workflow starts.
This means that the method of compiling each commit in the entire PR branch will be the one used for the PR HEAD.
This may cause problems if the PR changes any Maven parameters in any commit except the first one.

Consider for example adding a settings.xml file to Maven parameters in a second commit of a PR.
Since the environment variables from PR HEAD are in effect, the CI workflow would call Maven with the -s settings.xml option for all commits of the PR. The commit adding the file might be self-contained, but if it's not the first commit of the PR, it will trigger a failure for older commits.

Release notes

(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Nov 22, 2022
@MiguelWeezardo MiguelWeezardo force-pushed the check-commits-composite-action branch 2 times, most recently from ca77d75 to 2801898 Compare November 22, 2022 23:42
@MiguelWeezardo MiguelWeezardo force-pushed the check-commits-composite-action branch 5 times, most recently from baa350d to e1b8e4e Compare November 24, 2022 14:36
needs: check-commits
if: github.event_name == 'pull_request' && needs.check-commits.outputs.matrix != '{}'
strategy:
fail-fast: false
Copy link
Member

Choose a reason for hiding this comment

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

why not fail-fast? If some intermediate commit is broken by definition someone needs to fix the commit hence invalidating all results of any commits that come after the broken one?

Copy link
Member

Choose a reason for hiding this comment

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

Please undo this change - my understanding was wrong.

The matrix entries are only created in a specific order - their execution order can be different/concurrent unless max-parallel: 1 is added.

Each check-commit takes ~10mins at most so doing it serially via max-parallel: 1 doesn't sound good.

So let's disable fail-fast like it was before.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was supposed to be a simple pass/fail check, we don't have to find all broken commits if we already know the check will fail.

Copy link
Member

Choose a reason for hiding this comment

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

that's a fair point - we can offload which commit is broken to PR author.

@MiguelWeezardo MiguelWeezardo force-pushed the check-commits-composite-action branch 4 times, most recently from 8676b9b to 8de10a2 Compare November 24, 2022 22:11
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM % can you add a temporary 2nd commit to this PR which changes ci.yml in some way?

@MiguelWeezardo
Copy link
Member Author

LGTM % can you add a temporary 2nd commit to this PR which changes ci.yml in some way?

I already tested this using my own fork: MiguelWeezardo#12

In our CI pipeline we want to test if all commits of a PR would compile
if checked out individually. This ensures commits don't have dependencies
on changes added afterwards. This makes git bisect automation possible.

Previous approach used a step in the main CI workflow, which is loaded
when a CI workflow starts. This means that the method of compiling each
commit in the entire PR branch will be the one used for the PR HEAD.
This may cause problems if the PR changes any Maven parameters in any
commit except the first one.

Consider for example adding a settings.xml file to Maven parameters
in a second commit of a PR. Since the environment variables from PR HEAD
are in effect for the entire workflow run, the workflow would call Maven
with the `-s settings.xml` option for all commits of the PR.
The commit adding the file might be self-contained, but if it's not
the first commit of the PR, it will trigger a failure for older commits.
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM % undo testing changes + #15157 (comment)

Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM.

@hashhar hashhar merged commit faa0385 into trinodb:master Nov 26, 2022
@hashhar hashhar added the no-release-notes This pull request does not require release notes entry label Nov 26, 2022
@github-actions github-actions bot added this to the 404 milestone Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

3 participants