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

Reduce recurring steps in CI workflow #14865

Merged
merged 2 commits into from
Nov 21, 2022
Merged

Conversation

nineinchnick
Copy link
Member

Description

Extracted from #12817

Non-technical explanation

n/a

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:

@cla-bot cla-bot bot added the cla-signed label Nov 2, 2022
@nineinchnick nineinchnick marked this pull request as ready for review November 2, 2022 12:53
@nineinchnick nineinchnick requested review from hashhar and ebyhr November 2, 2022 12:55
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@MiguelWeezardo
Copy link
Member

Shouldn't the caching from #14882 be part of the composite action used here?

@nineinchnick
Copy link
Member Author

Shouldn't the caching from #14882 be part of the composite action used here?

Yes, that's why I opened trinodb/github-actions#15 and I'll update the commit sha here when necessary.

Copy link
Member

@MiguelWeezardo MiguelWeezardo left a comment

Choose a reason for hiding this comment

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

Make sure to update the checkout-and-setup tag to something which uses actions/cache explicitly.

@nineinchnick
Copy link
Member Author

I also extracted uploading test results and reports into a separate action and added a step to grab heap dumps.

@findepi
Copy link
Member

findepi commented Nov 18, 2022

@nineinchnick
who can access the heap dumps? where are they stored and for how long?

@nineinchnick
Copy link
Member Author

Ah, I forgot that they can contain sensitive data, like secrets. If we upload them as artifacts, then they're public. I'll add a condition to only do this if there are no secrets set.

@findepi
Copy link
Member

findepi commented Nov 18, 2022

This will work for now. If we have OOMs with secrets-requiring jobs, we can perhaps encrypt those dumps.

.github/actions/upload/action.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
upload-heap-dump: >-
${{ secrets.TRINO_AWS_ACCESS_KEY_ID == '' &&
secrets.TRINO_AWS_SECRET_ACCESS_KEY == '' &&
secrets.AZURE_ABFS_CONTAINER == '' &&
Copy link
Member

Choose a reason for hiding this comment

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

Let's try to simplify.

Can we somehow explicitly detect the PR is not trusted?
If github doesn't make it explicit, we could check that the build is a PR and the source repo != trinodb/trino

wdyt?

(i am worried that addition of a new secret will be overlook here)

alternatively, we could have a dummy secret SECRETS_PRESENT in trinodb/trino
and condition on that here

Copy link
Member Author

Choose a reason for hiding this comment

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

alternatively, we could have a dummy secret SECRETS_PRESENT in trinodb/trino
and condition on that here

I like this idea. I didn't try to add a condition to detect forks because I'm not sure we wouldn't miss some cases. Checking for secrets seemed more direct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you create such a secret? Or would it be enough to check for just one of the existing secrets, with a comment?

Copy link
Member

Choose a reason for hiding this comment

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

I created org-wide SECRETS_PRESENT secret.

Copy link
Member

Choose a reason for hiding this comment

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

why is checking for PR source not enough? i.e. source repo != trinodb/trino?

@findepi
Copy link
Member

findepi commented Nov 18, 2022

I don't understand commits other than "Attempt to upload heap dump if tests failed".

@hashhar do you want help reviewing?
@nineinchnick would be possible to decouple? (seems not obvious, but maybe...)

@nineinchnick
Copy link
Member Author

@nineinchnick would be possible to decouple? (seems not obvious, but maybe...)

Decoupling would mean I'd have to do this twice, once by duplicating it 4 times and then again in this PR. Would it help if I'd extract it into another PR based on this branch?

@findepi
Copy link
Member

findepi commented Nov 18, 2022

Decoupling would mean I'd have to do this twice, once by duplicating it 4 times and then again in this PR.

sounds bad
how bad?

Would it help if I'd extract it into another PR based on this branch?

no, because i still wouldn't be able to merge this :)

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.

upload-heap-dump should be very carefully used - I'm not strongly in favour of enabling it by default. We should enable it when debugging for a specific job and not always.

Also are the heap dump artifacts only visible to people with write access to repo? If not then it's not safe to do at all.

.github/actions/setup/action.yml Outdated Show resolved Hide resolved
heap-dump-retention-days:
default: 2
upload-heap-dump:
default: "false"
Copy link
Member

Choose a reason for hiding this comment

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

stringly typed booleans create confusion specially when the value being used can be easily confused for a boolean

upload-heap-dump: >-
${{ secrets.TRINO_AWS_ACCESS_KEY_ID == '' &&
secrets.TRINO_AWS_SECRET_ACCESS_KEY == '' &&
secrets.AZURE_ABFS_CONTAINER == '' &&
Copy link
Member

Choose a reason for hiding this comment

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

why is checking for PR source not enough? i.e. source repo != trinodb/trino?

@hashhar
Copy link
Member

hashhar commented Nov 18, 2022

Let's extract last 2 commits and merge the first one. the last 2 are controversial.

@nineinchnick
Copy link
Member Author

Let's extract last 2 commits and merge the first one. the last 2 are controversial.

Done, I'll open up another PR after this one gets merged.

@nineinchnick
Copy link
Member Author

upload-heap-dump should be very carefully used - I'm not strongly in favour of enabling it by default. We should enable it when debugging for a specific job and not always.

If we want to use it to debug OOM errors that happen sporadically, it'll not be very useful. I wonder if it would make more sense to try to reproduce the OOM locally, for ex. in a container with limited memory.

Also are the heap dump artifacts only visible to people with write access to repo? If not then it's not safe to do at all.

Why they're not safe? Do you have ideas for any alternatives?

@hashhar
Copy link
Member

hashhar commented Nov 18, 2022

Also are the heap dump artifacts only visible to people with write access to repo? If not then it's not safe to do at all.

Why they're not safe? Do you have ideas for any alternatives?

I now see that you only upload them if secrets don't exist so that solves my concern.

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.

.github/actions/setup/action.yml Outdated Show resolved Hide resolved
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 % check-commits can also use .github/actions/setup it seems.

@nineinchnick
Copy link
Member Author

@hashhar all green!

@hashhar hashhar merged commit 758c02e into trinodb:master Nov 21, 2022
@nineinchnick nineinchnick deleted the ci-setup branch November 21, 2022 13:19
@github-actions github-actions bot added this to the 404 milestone Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants