Skip to content

Conversation

@sawantpritam
Copy link
Contributor

This PR depends on cdapio/cdap-e2e-tests#83

@rmstar @itsankit-google Please review.

@google-cla
Copy link

google-cla bot commented Apr 28, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@itsankit-google itsankit-google added the build Trigger unit test build label May 3, 2022
@sawantpritam
Copy link
Contributor Author

Conflicts resolved.

if (serviceAccountType.equalsIgnoreCase("FilePath")) {
String serviceAccountFilePath = System.getenv("SERVICE_ACCOUNT_FILE_PATH");
if (!(serviceAccountFilePath == null) && !serviceAccountFilePath.equalsIgnoreCase("auto-detect")) {
PluginPropertyUtils.addPluginProp("serviceAccountFilePath", serviceAccountFilePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is required for macro runtime arguments.

Then Enter runtime argument value "serviceAccountFilePath" for key "gcsServiceAccount"

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the macro scenario needs to be modified, what if service account type is set as "JSON" instead of "filePath". It will fail, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have separate macro tests with Service Account Type as macro param

#937

Copy link
Contributor

Choose a reason for hiding this comment

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

What about the existing macro tests? They will fail if serviceAccountType is set as JSON in environment variable, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated macro tests.

Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

The clients used to setup input data should also be created using the given credentials. Are we taking care of this as well?

@itsankit-google
Copy link
Contributor

Also there is one GCS sink test failure, please ensure Run tests step is green in Build e2e tests workflow.

@sawantpritam
Copy link
Contributor Author

The clients used to setup input data should also be created using the given credentials. Are we taking care of this as well?

Clients use projectId - which needs to be updated in pluginParameters.properties file as per config.

@itsankit-google
Copy link
Contributor

The clients used to setup input data should also be created using the given credentials. Are we taking care of this as well?

Clients use projectId - which needs to be updated in pluginParameters.properties file as per config.

If we don't set credentials while creating GCP API clients, they internally use the credentials from GCE VM which will be similar to auto-detect. If we want to create the clients in different projects you will need to set the service credentials which have permissions on the given project. See this for example, https://github.com/data-integrations/google-cloud/blob/develop/src/main/java/io/cdap/plugin/gcp/common/GCPUtils.java#L186

@sawantpritam
Copy link
Contributor Author

The clients used to setup input data should also be created using the given credentials. Are we taking care of this as well?

Clients use projectId - which needs to be updated in pluginParameters.properties file as per config.

If we don't set credentials while creating GCP API clients, they internally use the credentials from GCE VM which will be similar to auto-detect. If we want to create the clients in different projects you will need to set the service credentials which have permissions on the given project. See this for example, https://github.com/data-integrations/google-cloud/blob/develop/src/main/java/io/cdap/plugin/gcp/common/GCPUtils.java#L186

We can achieve this by setting env variable GOOGLE_APPLICATION_CREDENTIALS with same actual filepath or json used for overriding.

@sawantpritam
Copy link
Contributor Author

Also there is one GCS sink test failure, please ensure Run tests step is green in Build e2e tests workflow.

All tests passed in build

Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

LGTM, please squash commits.

@sawantpritam
Copy link
Contributor Author

LGTM, please squash commits.

Squashed commits.

@itsankit-google itsankit-google merged commit e92e702 into data-integrations:develop May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Trigger unit test build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants