Skip to content

Commit 172624d

Browse files
author
Thierry RAMORASOAVINA
committed
Use the C++ drivers for remote file access (GCS, S3) instead of the old golang ones
- the GCS tests use a real Google account (via "Workload Identity Federation" authentication mode) - the S3 ones still use an emulated S3 server
1 parent 6a8926a commit 172624d

File tree

4 files changed

+43
-29
lines changed

4 files changed

+43
-29
lines changed

.github/workflows/dev-docker.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ env:
55
DEFAULT_IMAGE_INCREMENT: 0
66
DEFAULT_SERVER_REVISION: main
77
DEFAULT_PYTHON_VERSIONS: 3.8 3.9 3.10 3.11 3.12 3.13
8-
DEFAULT_KHIOPS_GCS_DRIVER_REVISION: 0.0.10
9-
DEFAULT_KHIOPS_S3_DRIVER_REVISION: 0.0.12
8+
DEFAULT_KHIOPS_GCS_DRIVER_REVISION: 0.0.11
9+
DEFAULT_KHIOPS_S3_DRIVER_REVISION: 0.0.13
1010
on:
1111
pull_request:
1212
paths: [packaging/docker/khiopspydev/Dockerfile.*, .github/workflows/dev-docker.yml]
@@ -38,11 +38,11 @@ on:
3838
description: Khiops Server Revision
3939
khiops-gcs-driver-revision:
4040
type: string
41-
default: 0.0.10
41+
default: 0.0.11
4242
description: Driver version for Google Cloud Storage remote files
4343
khiops-s3-driver-revision:
4444
type: string
45-
default: 0.0.12
45+
default: 0.0.13
4646
description: Driver version for AWS-S3 remote files
4747
concurrency:
4848
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

.github/workflows/tests.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,19 @@ jobs:
133133
cat ${GITHUB_WORKSPACE}/.aws/credentials
134134
echo "Generated AWS configuration..."
135135
cat ${GITHUB_WORKSPACE}/.aws/configuration
136-
137-
# Prepare GCS credentials
138-
touch ${GITHUB_WORKSPACE}/google-credentials.json
139136
/scripts/run_fake_remote_file_servers.sh . # launch the servers in the background
137+
- name: Authenticate to GCP using "Workload Identity Federation"
138+
# For integration tests on GCS we use a real Google account
139+
# Retrieve the Google credentials through "Workload Identity Federation"
140+
# see https://github.com/google-github-actions/auth?tab=readme-ov-file#workload-identity-federation-through-a-service-account
141+
uses: google-github-actions/auth@v2
142+
with:
143+
service_account: khiops-gcs-driver-test-sa@ino-olr-dak-ideal-sbx.iam.gserviceaccount.com
144+
workload_identity_provider: projects/322269704080/locations/global/workloadIdentityPools/github/providers/my-repo
145+
# 'create_credentials_file' is true by default but let's make it explicit
146+
# After authentication, the required GOOGLE_APPLICATION_CREDENTIALS environment variable is exported
147+
# https://github.com/google-github-actions/auth?tab=readme-ov-file#inputs-miscellaneous
148+
create_credentials_file: true
140149
- name: Run Unit & Integration Tests
141150
env:
142151
KHIOPS_SAMPLES_DIR: ${{ github.workspace }}/khiops-samples
@@ -150,19 +159,14 @@ jobs:
150159
# Oversubscribe for MPI > 4.x
151160
OMPI_MCA_rmaps_base_oversubscribe: true
152161
# for the tests with GCS
153-
GCS_BUCKET_NAME: gcs-bucket
154-
# we take advantage of the built-in `STORAGE_EMULATOR_HOST` env variable
155-
# that every GCS client can read and lets us use a local fake file server
156-
STORAGE_EMULATOR_HOST: http://localhost:4443
157-
# even in GCS emulation mode, the credentials file must exist
158-
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/google-credentials.json
162+
GCS_BUCKET_NAME: data-test-khiops-driver-gcs/khiops_data
159163
GCS_DRIVER_LOGLEVEL: info # set to debug for diagnosis
160-
S3_DRIVER_LOGLEVEL: info # set to debug for diagnosis
161164
# for the tests with S3
165+
S3_DRIVER_LOGLEVEL: info # set to debug for diagnosis
162166
S3_BUCKET_NAME: s3-bucket
163167
AWS_SHARED_CREDENTIALS_FILE: ${{ github.workspace }}/.aws/credentials
164168
AWS_CONFIG_FILE: ${{ github.workspace }}/.aws/configuration
165-
# common var for tests with GCS & S3
169+
# Var for tests with S3
166170
no_proxy: localhost
167171
run: |
168172
# This is needed so that the Git tag is parsed and the khiops-python

packaging/docker/khiopspydev/Dockerfile.ubuntu

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ RUN true \
4040
# set up all the supported Python environments under conda (for the unit tests)
4141
# relying on a variable containing all the versions
4242
ARG PYTHON_VERSIONS
43+
ARG KHIOPS_GCS_DRIVER_REVISION
44+
ARG KHIOPS_S3_DRIVER_REVISION
4345
RUN true \
4446
&& export CONDA="/root/miniforge3/bin/conda" \
4547
&& /bin/bash -c 'for version in ${PYTHON_VERSIONS}; \
@@ -49,7 +51,12 @@ RUN true \
4951
do \
5052
$CONDA create -y -n $CONDA_ENV python=${version}; \
5153
done; \
54+
# khiops core \
5255
$CONDA install -y -n py${version}_conda -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
56+
# remote files drivers installed in the conda environment \
57+
$CONDA install -y -n py${version}_conda -c khiops \
58+
khiops-driver-s3=${KHIOPS_S3_DRIVER_REVISION} \
59+
khiops-driver-gcs=${KHIOPS_GCS_DRIVER_REVISION}; \
5360
done' \
5461
&& true
5562

@@ -58,12 +65,12 @@ COPY ./run_service.sh ./run_fake_remote_file_servers.sh /scripts/
5865
RUN chmod +x /scripts/run_service.sh /scripts/run_fake_remote_file_servers.sh && \
5966
useradd -rm -d /home/ubuntu -s /bin/bash -g root -u 1000 ubuntu
6067

61-
# new gcs & s3 drivers (written in C++)
62-
ARG KHIOPS_GCS_DRIVER_REVISION
63-
ARG KHIOPS_S3_DRIVER_REVISION
68+
# remote files drivers installed system-wide
6469
RUN true \
65-
&& wget -O khiops-gcs.deb https://github.com/KhiopsML/khiopsdriver-gcs/releases/download/${KHIOPS_GCS_DRIVER_REVISION}/khiops-gcs_${KHIOPS_GCS_DRIVER_REVISION}.deb \
66-
&& wget -O khiops-s3.deb https://github.com/KhiopsML/khiopsdriver-s3/releases/download/${KHIOPS_S3_DRIVER_REVISION}/khiops-s3_${KHIOPS_S3_DRIVER_REVISION}.deb \
70+
# Get Linux distribution codename \
71+
&& if [ -f /etc/os-release ]; then . /etc/os-release; fi \
72+
&& wget -O khiops-gcs.deb https://github.com/KhiopsML/khiopsdriver-gcs/releases/download/${KHIOPS_GCS_DRIVER_REVISION}/khiops-driver-gcs_${KHIOPS_GCS_DRIVER_REVISION}-1-${VERSION_CODENAME}.amd64.deb \
73+
&& wget -O khiops-s3.deb https://github.com/KhiopsML/khiopsdriver-s3/releases/download/${KHIOPS_S3_DRIVER_REVISION}/khiops-driver-s3_${KHIOPS_S3_DRIVER_REVISION}-1-${VERSION_CODENAME}.amd64.deb \
6774
&& (dpkg -i --force-all khiops-gcs.deb khiops-s3.deb || true) \
6875
&& apt-get -f -y install \
6976
&& rm -f khiops-gcs.deb khiops-s3.deb \

tests/test_remote_access.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,7 @@ def remote_access_test_case(self):
105105
return ""
106106

107107
def should_skip_in_a_conda_env(self):
108-
"""To be overriden by descendants
109-
110-
Temporarily skip the S3 and GCS tests in a conda environment
111-
until the drivers for remote files access
112-
are released as conda packages
113-
"""
108+
"""To be overriden by descendants"""
114109
return True
115110

116111
def print_test_title(self):
@@ -145,11 +140,9 @@ def is_in_a_conda_env():
145140
) == os.path.dirname(khiops_path)
146141

147142
def setUp(self):
143+
148144
self.skip_if_no_config()
149145
if self.is_in_a_conda_env() and self.should_skip_in_a_conda_env():
150-
# TODO : Temporarily skip the test for Conda-installed khiops-core
151-
# until the drivers for remote files access
152-
# are released as conda packages
153146
self.skipTest(
154147
f"Remote test case {self.remote_access_test_case()} "
155148
"in a conda environment is currently skipped"
@@ -322,6 +315,11 @@ def tearDownClass(cls):
322315
if s3_config_exists():
323316
kh.get_runner().__init__()
324317

318+
def should_skip_in_a_conda_env(self):
319+
# The S3 driver is now released for conda too.
320+
# No need to skip the tests any longer in a conda environment
321+
return False
322+
325323
def config_exists(self):
326324
return s3_config_exists()
327325

@@ -360,6 +358,11 @@ def tearDownClass(cls):
360358
if gcs_config_exists():
361359
kh.get_runner().__init__()
362360

361+
def should_skip_in_a_conda_env(self):
362+
# The GCS driver is now released for conda too.
363+
# No need to skip the tests any longer in a conda environment
364+
return False
365+
363366
def config_exists(self):
364367
return gcs_config_exists()
365368

0 commit comments

Comments
 (0)