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

DT-1202: Add "inherit steward" support to snapshot creation #1902

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

pshapiro4broad
Copy link
Member

@pshapiro4broad pshapiro4broad commented Feb 6, 2025

Jira ticket: https://broadworkbench.atlassian.net/browse/DT-1202

Addresses

Add support to snapshot creation so the dataset custodian is optionally granted steward permissions on the snapshot.

Summary of changes

In the snapshot creation flight, if the inheritSteward flag is set:

  • the parent is passed to Sam when creating the snapshot
  • the dataset custodian user is added as a reader on the BQ project
  • the dataset custodian user is added as a job executor to the BQ project

Testing Strategy

  • unit tests
  • connected tests - skip for now, add later once feature is exposed at the API layer
  • manual local testing to create snapshot and observe its behavior

@pshapiro4broad pshapiro4broad marked this pull request as ready for review February 7, 2025 15:47
@pshapiro4broad pshapiro4broad requested a review from a team as a code owner February 7, 2025 15:47
@pshapiro4broad pshapiro4broad requested review from snf2ye and fboulnois and removed request for a team February 7, 2025 15:47
Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

Overall looks good, some minor suggestions:

Comment on lines +69 to +78
Boolean inheritEnabled =
context
.getInputParameters()
.get(SnapshotWorkingMapKeys.SNAPSHOT_INHERIT_STEWARD_ENABLED, Boolean.class);
if (inheritEnabled != null && inheritEnabled) {
var datasetPolicyMap =
iamService.retrievePolicyEmails(userReq, IamResourceType.DATASET, sourceDataset.getId());
emails.add(datasetPolicyMap.get(IamRole.CUSTODIAN));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we pull this into a common method somewhere?

Copy link
Member Author

@pshapiro4broad pshapiro4broad Feb 11, 2025

Choose a reason for hiding this comment

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

This code is temporary until https://broadworkbench.atlassian.net/browse/DT-1197 is done. That will replace this code, which reads from the flight input map, to read from a field in sourceDataset. I'm expecting it would look something like

    if (sourceDataset.inheritSteward()) {
      var datasetPolicyMap =
          iamService.retrievePolicyEmails(userReq, IamResourceType.DATASET, sourceDataset.getId());
      emails.add(datasetPolicyMap.get(IamRole.CUSTODIAN));
    }

So I think a lot of it will go away. If there's still a need to refactor common code it can be done then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants