Skip to content

Commit afcfc4f

Browse files
address review feedback
1 parent 620a603 commit afcfc4f

18 files changed

Lines changed: 402 additions & 157 deletions
Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
# S3-backed tests against MinIO (Linux and macOS only).
19-
name: S3 Tests
18+
# AWS-related tests. ICEBERG_S3 (Arrow's bundled AWS SDK) and ICEBERG_SIGV4
19+
# (vcpkg-installed aws-cpp-sdk-core) are tested in separate jobs: linking
20+
# both into one binary causes ODR conflicts on the shared AWS SDK symbols.
21+
name: AWS Tests
2022

2123
on:
2224
push:
@@ -39,21 +41,31 @@ env:
3941
ICEBERG_HOME: /tmp/iceberg
4042

4143
jobs:
42-
s3-minio:
44+
aws:
4345
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
44-
name: S3 (${{ matrix.title }})
46+
name: AWS (${{ matrix.title }})
4547
runs-on: ${{ matrix.runs-on }}
46-
timeout-minutes: 35
48+
timeout-minutes: 45
4749
strategy:
4850
fail-fast: false
4951
matrix:
5052
include:
51-
- title: AMD64 Ubuntu 24.04
53+
- title: AMD64 Ubuntu 24.04, S3
5254
runs-on: ubuntu-24.04
5355
CC: gcc-14
5456
CXX: g++-14
55-
- title: AArch64 macOS 26
57+
s3: "ON"
58+
sigv4: "OFF"
59+
- title: AMD64 Ubuntu 24.04, SigV4
60+
runs-on: ubuntu-24.04
61+
CC: gcc-14
62+
CXX: g++-14
63+
s3: "OFF"
64+
sigv4: "ON"
65+
- title: AArch64 macOS 26, S3
5666
runs-on: macos-26
67+
s3: "ON"
68+
sigv4: "OFF"
5769
env:
5870
ICEBERG_TEST_S3_URI: s3://iceberg-test
5971
AWS_ACCESS_KEY_ID: minio
@@ -70,6 +82,17 @@ jobs:
7082
if: ${{ startsWith(matrix.runs-on, 'ubuntu') }}
7183
shell: bash
7284
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
85+
- name: Cache vcpkg packages
86+
if: ${{ matrix.sigv4 == 'ON' }}
87+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
88+
id: vcpkg-cache
89+
with:
90+
path: /usr/local/share/vcpkg/installed
91+
key: vcpkg-x64-linux-aws-sdk-cpp-core-${{ hashFiles('.github/workflows/aws_test.yml') }}
92+
- name: Install AWS SDK via vcpkg
93+
if: ${{ matrix.sigv4 == 'ON' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
94+
shell: bash
95+
run: vcpkg install aws-sdk-cpp[core]:x64-linux
7396
- name: Set Ubuntu Compilers
7497
if: ${{ startsWith(matrix.runs-on, 'ubuntu') }}
7598
run: |
@@ -82,8 +105,11 @@ jobs:
82105
brew install fmt
83106
echo "CMAKE_PREFIX_PATH=$(brew --prefix fmt):${CMAKE_PREFIX_PATH:-}" >> "${GITHUB_ENV}"
84107
- name: Start MinIO
108+
if: ${{ matrix.s3 == 'ON' }}
85109
shell: bash
86110
run: bash ci/scripts/start_minio.sh
87-
- name: Build and test Iceberg with S3
111+
- name: Build and test Iceberg
88112
shell: bash
89-
run: ci/scripts/build_iceberg.sh "$(pwd)" OFF OFF ON
113+
env:
114+
CMAKE_TOOLCHAIN_FILE: ${{ matrix.sigv4 == 'ON' && '/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake' || '' }}
115+
run: ci/scripts/build_iceberg.sh "$(pwd)" OFF OFF ${{ matrix.s3 }} ${{ matrix.sigv4 }}

.github/workflows/sigv4_test.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

ci/scripts/build_iceberg.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ if is_windows; then
6060
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release")
6161
else
6262
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Debug")
63-
if [[ -n "${CMAKE_TOOLCHAIN_FILE:-}" ]]; then
64-
CMAKE_ARGS+=("-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
65-
fi
6663
fi
6764

6865
if [[ "${build_enable_sccache}" == "ON" ]]; then

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ function(resolve_aws_sdk_dependency)
549549
set(ICEBERG_SYSTEM_DEPENDENCIES
550550
${ICEBERG_SYSTEM_DEPENDENCIES}
551551
PARENT_SCOPE)
552+
# Forwarded to find_dependency(AWSSDK ...) in iceberg-config.cmake.in so
553+
# downstream installed builds load aws-cpp-sdk-core via AWSSDK_FIND_COMPONENTS.
554+
set(ICEBERG_FIND_EXTRA_ARGS_AWSSDK
555+
"COMPONENTS;core"
556+
PARENT_SCOPE)
552557
endfunction()
553558

554559
if(ICEBERG_SIGV4)

src/iceberg/catalog/rest/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set(ICEBERG_REST_SOURCES
2828
endpoint.cc
2929
error_handlers.cc
3030
http_client.cc
31+
http_request.cc
3132
json_serde.cc
3233
resource_paths.cc
3334
rest_catalog.cc

src/iceberg/catalog/rest/auth/auth_manager.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ Result<std::shared_ptr<AuthSession>> AuthManager::InitSession(
3838
}
3939

4040
Result<std::shared_ptr<AuthSession>> AuthManager::ContextualSession(
41-
[[maybe_unused]] const std::unordered_map<std::string, std::string>& context,
42-
std::shared_ptr<AuthSession> parent) {
41+
[[maybe_unused]] const SessionContext& context, std::shared_ptr<AuthSession> parent) {
4342
// By default, return the parent session as-is
4443
return parent;
4544
}

src/iceberg/catalog/rest/auth/auth_manager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <string>
2424
#include <unordered_map>
2525

26+
#include "iceberg/catalog/rest/auth/session_context.h"
2627
#include "iceberg/catalog/rest/iceberg_rest_export.h"
2728
#include "iceberg/catalog/rest/type_fwd.h"
2829
#include "iceberg/result.h"
@@ -70,13 +71,12 @@ class ICEBERG_REST_EXPORT AuthManager {
7071
/// This method is used by SessionCatalog to create sessions for different contexts
7172
/// (e.g., different users or tenants).
7273
///
73-
/// \param context Context properties (e.g., user credentials, tenant info).
74+
/// \param context Per-session properties and credentials.
7475
/// \param parent Catalog session to inherit from or return as-is.
7576
/// \return A context-specific session, or the parent session if no context-specific
7677
/// session is needed, or an error if session creation fails.
7778
virtual Result<std::shared_ptr<AuthSession>> ContextualSession(
78-
const std::unordered_map<std::string, std::string>& context,
79-
std::shared_ptr<AuthSession> parent);
79+
const SessionContext& context, std::shared_ptr<AuthSession> parent);
8080

8181
/// \brief Create or reuse a session scoped to a single table/view.
8282
///

src/iceberg/catalog/rest/auth/auth_managers.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ const std::unordered_set<std::string, StringHash, StringEqual>& KnownAuthTypes()
4646
// Infer the authentication type from properties.
4747
std::string InferAuthType(
4848
const std::unordered_map<std::string, std::string>& properties) {
49+
// Deprecated alias: rest.sigv4-enabled=true forces SigV4.
50+
if (auto it = properties.find(AuthProperties::kSigV4Enabled);
51+
it != properties.end() && StringUtils::EqualsIgnoreCase(it->second, "true")) {
52+
return AuthProperties::kAuthTypeSigV4;
53+
}
54+
4955
auto it = properties.find(AuthProperties::kAuthType);
5056
if (it != properties.end() && !it->second.empty()) {
5157
return StringUtils::ToLower(it->second);
@@ -61,8 +67,8 @@ std::string InferAuthType(
6167
return AuthProperties::kAuthTypeNone;
6268
}
6369

64-
AuthManagerRegistry CreateDefaultRegistry() {
65-
AuthManagerRegistry registry = {
70+
AuthManagerRegistry& GetRegistry() {
71+
static AuthManagerRegistry registry = {
6672
{AuthProperties::kAuthTypeNone, MakeNoopAuthManager},
6773
{AuthProperties::kAuthTypeBasic, MakeBasicAuthManager},
6874
{AuthProperties::kAuthTypeOAuth2, MakeOAuth2Manager},
@@ -71,12 +77,6 @@ AuthManagerRegistry CreateDefaultRegistry() {
7177
return registry;
7278
}
7379

74-
// Get the global registry of auth manager factories.
75-
AuthManagerRegistry& GetRegistry() {
76-
static AuthManagerRegistry registry = CreateDefaultRegistry();
77-
return registry;
78-
}
79-
8080
} // namespace
8181

8282
void AuthManagers::Register(std::string_view auth_type, AuthManagerFactory factory) {

src/iceberg/catalog/rest/auth/auth_properties.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class ICEBERG_REST_EXPORT AuthProperties : public ConfigBase<AuthProperties> {
5454

5555
// ---- SigV4 entries ----
5656

57+
/// Deprecated: `rest.sigv4-enabled=true` selects SigV4 regardless of
58+
/// `rest.auth.type`.
59+
inline static const std::string kSigV4Enabled = "rest.sigv4-enabled";
5760
inline static const std::string kSigV4DelegateAuthType =
5861
"rest.auth.sigv4.delegate-auth-type";
5962
inline static const std::string kSigV4SigningRegion = "rest.signing-region";
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#include <string>
23+
#include <unordered_map>
24+
25+
#include "iceberg/catalog/rest/iceberg_rest_export.h"
26+
27+
namespace iceberg::rest::auth {
28+
29+
/// \brief Per-session context passed to AuthManager::ContextualSession.
30+
///
31+
/// Mirrors Java's `SessionCatalog.SessionContext`. Separate `properties` and
32+
/// `credentials` so per-context credential overrides don't silently collapse
33+
/// into properties.
34+
struct ICEBERG_REST_EXPORT SessionContext {
35+
std::unordered_map<std::string, std::string> properties;
36+
std::unordered_map<std::string, std::string> credentials;
37+
};
38+
39+
} // namespace iceberg::rest::auth

0 commit comments

Comments
 (0)