github-actions[bot] commented on code in PR #62303:
URL: https://github.com/apache/doris/pull/62303#discussion_r3108767517


##########
be/test/io/client/s3_file_system_test.cpp:
##########
@@ -58,18 +67,25 @@ class S3TestConfig {
 
         access_key = GET_ENV_IF_DEFINED(S3_AK);
         secret_key = GET_ENV_IF_DEFINED(S3_SK);
-        endpoint = GET_ENV_IF_DEFINED(S3_ENDPOINT);
+        role_arn = GET_ENV_IF_DEFINED(AWS_ROLE_ARN);
+        external_id = GET_ENV_IF_DEFINED(AWS_EXTERNAL_ID);
+        endpoint = get_env_with_fallback("S3_ENDPOINT", "AWS_ENDPOINT");
         provider = GET_ENV_IF_DEFINED(S3_PROVIDER);
-        bucket = GET_ENV_IF_DEFINED(S3_BUCKET);
-        region = GET_ENV_IF_DEFINED(S3_REGION);
-        prefix = GET_ENV_IF_DEFINED(S3_PREFIX);
+        bucket = get_env_with_fallback("S3_BUCKET", "AWS_BUCKET");
+        region = get_env_with_fallback("S3_REGION", "AWS_REGION");
+        prefix = get_env_with_fallback("S3_PREFIX", "AWS_PREFIX");
     }
 
     bool is_enabled() const { return enabled; }
 
     bool is_valid() const {
-        return enabled && !access_key.empty() && !secret_key.empty() && 
!endpoint.empty() &&
-               !region.empty() && !bucket.empty();
+        if (!enabled || endpoint.empty() || region.empty() || bucket.empty() 
|| prefix.empty()) {
+            return false;
+        }
+        if (has_partial_static_credentials()) {
+            return false;
+        }
+        return has_static_credentials() || use_instance_profile();

Review Comment:
   `use_instance_profile()` is now just `!has_static_credentials()`, so 
`is_valid()` returns true even when there is no actual IAM configuration at 
all. `create_client()` only constructs the SDK client, it does not prove that 
credentials can be resolved, so this changes incomplete setups from a clean 
`GTEST_SKIP` into late failures on the first S3 call. The existing BE role-only 
test still gates on `AWS_ROLE_ARN`/`AWS_EXTERNAL_ID` before running 
(`be/test/io/fs/s3_obj_storage_client_role_test.cpp`).



##########
cloud/test/s3_accessor_client_test.cpp:
##########
@@ -72,18 +81,25 @@ class S3TestConfig {
 
         access_key = GET_ENV_IF_DEFINED(S3_AK);
         secret_key = GET_ENV_IF_DEFINED(S3_SK);
-        endpoint = GET_ENV_IF_DEFINED(S3_ENDPOINT);
+        role_arn = GET_ENV_IF_DEFINED(AWS_ROLE_ARN);
+        external_id = GET_ENV_IF_DEFINED(AWS_EXTERNAL_ID);
+        endpoint = get_env_with_fallback("S3_ENDPOINT", "AWS_ENDPOINT");
         provider = GET_ENV_IF_DEFINED(S3_PROVIDER);
-        bucket = GET_ENV_IF_DEFINED(S3_BUCKET);
-        region = GET_ENV_IF_DEFINED(S3_REGION);
-        prefix = GET_ENV_IF_DEFINED(S3_PREFIX);
+        bucket = get_env_with_fallback("S3_BUCKET", "AWS_BUCKET");
+        region = get_env_with_fallback("S3_REGION", "AWS_REGION");
+        prefix = get_env_with_fallback("S3_PREFIX", "AWS_PREFIX");
     }
 
     bool is_enabled() const { return enabled; }
 
     bool is_valid() const {
-        return enabled && !access_key.empty() && !secret_key.empty() && 
!endpoint.empty() &&
-               !region.empty() && !bucket.empty();
+        if (!enabled || endpoint.empty() || region.empty() || bucket.empty() 
|| prefix.empty()) {
+            return false;
+        }
+        if (has_partial_static_credentials()) {
+            return false;
+        }
+        return has_static_credentials() || use_instance_profile();

Review Comment:
   Same validation issue as the BE test: `use_instance_profile()` is only 
checking whether `S3_AK`/`S3_SK` are absent, not whether any usable IAM auth is 
actually configured. `S3Accessor::create()` only builds the client, and the 
default v2 chain falls back to anonymous, so this can turn what used to be a 
clean `GTEST_SKIP` into late write failures. The existing role-specific cloud 
test still requires `AWS_ROLE_ARN`/`AWS_EXTERNAL_ID` before running 
(`cloud/test/s3_accessor_test.cpp:398-415`).



##########
be/test/io/client/s3_file_system_test.cpp:
##########
@@ -159,6 +192,11 @@ class S3FileSystemTest : public ::testing::Test {
         s3_conf.client_conf.bucket = config_->get_bucket();
         s3_conf.client_conf.region = config_->get_region();
         s3_conf.client_conf.provider = 
convert_provider(config_->get_provider());
+        if (config_->use_instance_profile()) {
+            s3_conf.client_conf.cred_provider_type = 
CredProviderType::InstanceProfile;

Review Comment:
   This forced `InstanceProfile` provider type makes the BE path less 
compatible than the cloud one. In `S3ClientFactory` v2, `role_arn + 
InstanceProfile` uses `InstanceProfileCredentialsProvider` as the base provider 
(`be/src/util/s3_util.cpp`), so ambient env credentials / OIDC web-identity 
credentials are bypassed. A runner that exposes standard AWS ambient 
credentials still cannot authenticate through this path. If the goal is generic 
IAM-role support, this should preserve the default provider chain unless the 
environment explicitly requests a narrower provider type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to