Skip to content

Commit fa9ee0f

Browse files
committed
feat!: allow enabling AWS per-validation-config
1 parent 9125d91 commit fa9ee0f

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

adbc_drivers_dev/generate.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,18 @@ class LangValidateSpec(BaseModel):
105105
default=None,
106106
description="Name of a GitHub Actions Environment to activate",
107107
)
108+
aws: bool = Field(
109+
default=False,
110+
description="Log in to AWS in this config. Expects AWS_ROLE, AWS_ROLE_SESSION_NAME secrets",
111+
)
108112
azure: bool = Field(
109113
default=False,
110114
description="Log in to Azure in this config. Expects AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET secrets",
111115
)
116+
gcloud: bool = Field(
117+
default=False,
118+
description="Log in to Google Cloud in this config. Expects GCLOUD_SERVICE_ACCOUNT, GCLOUD_WORKLOAD_IDENTITY_PROVIDER secrets",
119+
)
112120

113121

114122
class LangValidationConfig(BaseModel):
@@ -152,6 +160,18 @@ class LangTestConfig(BaseModel):
152160
default=None,
153161
description="Name of a GitHub Actions Environment to activate",
154162
)
163+
aws: bool = Field(
164+
default=False,
165+
description="Log in to AWS in this config. Expects AWS_ROLE, AWS_ROLE_SESSION_NAME secrets",
166+
)
167+
azure: bool = Field(
168+
default=False,
169+
description="Log in to Azure in this config. Expects AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET secrets",
170+
)
171+
gcloud: bool = Field(
172+
default=False,
173+
description="Log in to Google Cloud in this config. Expects GCLOUD_SERVICE_ACCOUNT, GCLOUD_WORKLOAD_IDENTITY_PROVIDER secrets",
174+
)
155175

156176

157177
class LangTestPackagesConfig(BaseModel):
@@ -346,9 +366,8 @@ def azure(self) -> int:
346366
return any(
347367
config.azure
348368
for lang in self.lang.values()
349-
if lang
350369
for config in lang.validation.configs
351-
)
370+
) or any(lang.test.azure for lang in self.lang.values())
352371

353372
@model_validator(mode="after")
354373
def default_repository(self) -> "GenerateConfig":

adbc_drivers_dev/templates/test.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ jobs:
164164
pixi-version: v0.72.0
165165
run-install: false
166166

167-
<% if aws %>
167+
<% if aws and lang_config.test.aws %>
168168
- name: AWS Login
169169
uses: aws-actions/configure-aws-credentials@517a711dbcd0e402f90c77e7e2f81e849156e31d # v6.2.2
170170
with:
171171
aws-region: <{aws.region}>
172172
role-to-assume: ${{ secrets.aws_role }}
173173
role-session-name: ${{ secrets.aws_role_session_name }}
174174
<% endif %>
175-
<% if gcloud %>
175+
<% if gcloud and lang_config.test.gcloud %>
176176
- name: Google Cloud Login
177177
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
178178
with:
@@ -290,7 +290,7 @@ jobs:
290290
include:
291291
# I think we only need to test one platform, but we can change that later
292292
<% for config in lang_config.validation.configs %>
293-
- { platform: linux, arch: amd64, runner: ubuntu-latest, service_name: "<{config.service_name}>", vendor_version: "<{config.vendor_version}>", environment: <% if config.environment %>"<{config.environment}>"<% else %>null<% endif %>, azure: <{ "true" if config.azure else "false" }> }
293+
- { platform: linux, arch: amd64, runner: ubuntu-latest, service_name: "<{config.service_name}>", vendor_version: "<{config.vendor_version}>", environment: <% if config.environment %>"<{config.environment}>"<% else %>null<% endif %>, aws: <{ "true" if config.aws else "false" }>, azure: <{ "true" if config.azure else "false" }>, gcloud: <{ "true" if config.gcloud else "false" }> }
294294
<% endfor %>
295295
environment: ${{ matrix.environment }}
296296
permissions:
@@ -356,6 +356,7 @@ jobs:
356356
<% if aws %>
357357
- name: AWS Login
358358
uses: aws-actions/configure-aws-credentials@517a711dbcd0e402f90c77e7e2f81e849156e31d # v6.2.2
359+
if: matrix.aws
359360
with:
360361
aws-region: <{aws.region}>
361362
role-to-assume: ${{ secrets.aws_role }}
@@ -364,6 +365,7 @@ jobs:
364365
<% if gcloud %>
365366
- name: Google Cloud Login
366367
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
368+
if: matrix.gcloud
367369
with:
368370
service_account: ${{ secrets.gcloud_service_account }}
369371
workload_identity_provider: ${{ secrets.gcloud_workload_identity_provider }}

0 commit comments

Comments
 (0)