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

Skip actions for read-only repositories #7477

Merged
merged 2 commits into from
Feb 20, 2024
Merged

Conversation

idanovo
Copy link
Contributor

@idanovo idanovo commented Feb 19, 2024

Part of #7465

@idanovo idanovo self-assigned this Feb 19, 2024
@idanovo idanovo added the include-changelog PR description should be included in next release changelog label Feb 19, 2024
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

10 passed

Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

I don't understand this PR, and I believe @treeverse/product involvement is required. I can understand why I would want some actions not to run, for instance pre-merge validations. But I am not sure why I would want to prevent all actions from running. For instance, it does make sense to run export hooks (and we could make it easier by exposing e.g. the region to them).

So I believe we need to discuss this, maybe with a design partner.

Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Thanks!

Given that it's an explicit requirement in the product definition, obviously my previous objections are moot. The code itself is good, with a comment about the use of deepcopy -- I would much prefer if you could address it.

It is unfortunate that the hooks API forces us to repeat the same code in so many places! I worry that we will miss some change in one hook call. But this PR is about readonly repos more than it is about the hooks API, so I don't think we should rewrite that API just for safety here.

@@ -1737,12 +1748,15 @@ func TestGraveler_PreCommitHook(t *testing.T) {
if tt.hook {
g.SetHooksHandler(h)
}
repo := deepcopy.Copy(repository).(*graveler.RepositoryRecord)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is scary: AFAICU deepcopy.Copy can only copy exported (uppercased) fields. It so happens that RepositoryRecord and Repository are both plain-data objects -- but there is no guarantee that this will be true.

I believe it would be safer and easier to understand if we just used a separate object repositoryRO or something. I think it would also be safer.

@idanovo idanovo merged commit b9ddb4f into master Feb 20, 2024
35 checks passed
@idanovo idanovo deleted the not-run-actions-ro-repos branch February 20, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Actions that are not relevant for read-only repositories should be disabled
2 participants