Skip to content

Add GitHub Actions workflows and provisioning scripts for cloud databases - #5863

Merged
johnsimons merged 14 commits into
john/cloud_testsfrom
john/cloud_ci_tests
Sep 11, 2026
Merged

Add GitHub Actions workflows and provisioning scripts for cloud databases#5863
johnsimons merged 14 commits into
john/cloud_testsfrom
john/cloud_ci_tests

Conversation

@johnsimons

Copy link
Copy Markdown
Member

Introduces two workflows and supporting PowerShell scripts to run the persistence and acceptance test suites against managed cloud databases (Azure SQL, Azure Database for PostgreSQL, Aurora PostgreSQL, RDS SQL Server).

The test workflow provisions a fresh database per run, executes the relevant test projects against it, and tears it down regardless of outcome.

A nightly cleanup workflow sweeps any resources tagged sc-cloud-test that are older than four hours.

@johnsimons johnsimons self-assigned this Sep 8, 2026
@johnsimons
johnsimons removed this pull request from stack #5864 September 9, 2026 01:34
@johnsimons
johnsimons changed the base branch from john/cloud_tests to master September 9, 2026 01:35
@johnsimons
johnsimons changed the base branch from master to john/cloud_tests September 9, 2026 01:35
@johnsimons
johnsimons added this pull request to stack #5866 September 9, 2026 03:12
@johnsimons
johnsimons force-pushed the john/cloud_ci_tests branch 2 times, most recently from 554681c to 99a4a3a Compare September 10, 2026 00:15
run:
shell: pwsh
concurrency:
# Deliberately not cancel-in-progress: cancelling a run mid-flight risks skipping the teardown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are absolutely still cases where this can and will happen such as an agent failing and timing out the run.

Generally you would just make sure the resources are somewhere predictable with a DeleteAfter tag on them so a daily cleanup can clear them out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, you are right, and we are dealing with that situation too.
But in a successful run we want to clean-up even if another commit is pushed

…ase tests

Introduces two workflows and supporting PowerShell scripts to run the persistence and acceptance test suites against managed cloud databases (Azure SQL, Azure Database for PostgreSQL, Aurora PostgreSQL, RDS SQL Server).

The test workflow provisions a fresh database per run, executes the relevant test projects against it, and tears it down regardless of outcome.

A nightly cleanup workflow sweeps any resources tagged `sc-cloud-test` that are older than four hours.
…ub Actions composite action

The PowerShell scripts required an explicit teardown step in every workflow that used them, which could be skipped or forgotten if a job failed early. Replacing them with a JavaScript action (node24) allows declaring a post step, which GitHub runs automatically at job end regardless of outcome, making teardown impossible to omit.

The action also folds in the stale security group sweep that was previously handled by a nightly cleanup workflow, so that workflow is removed. Each run cleans up what earlier runs left behind, keeping the account self-healing without a scheduled job.

Other notable changes: Aurora PostgreSQL moves from db.t4g.medium to db.r6g.large and Azure PostgreSQL from a burstable B1ms to a General Purpose D4ds_v5 to avoid throttling mid-run; the run name now includes the attempt number so a retried run does not collide with its predecessor's still-deleting resources; and a verify-postgresql.cs script is added alongside the existing verify-sqlserver.cs to wait for PostgreSQL servers to become reachable before handing off to the test run.
…e PostgreSQL CLI flag

Three independent fixes to the cloud database action:

- AWS: instead of failing when a region has no default VPC, create one. RDS needs the default VPC's subnet group for publicly accessible instances, and the account may not have one in every region. Concurrent jobs racing to create it are handled by re-reading after the call. An IAM policy document is added alongside as a reference for the required permissions.

- SQL Server verify script: only the initial TCP connection is retried. The previous loop retried database creation and Full-Text Search checks too, turning a real server-side failure into a silent ten-minute wait. The post-connection work is moved outside the retry loop, and `sys.databases` replaces `DB_ID` to handle Azure SQL's logical master database correctly.

- Azure PostgreSQL: remove `--high-availability Disabled` because the CLI version on the runner does not accept the flag.
…g a fixed AWS region

RDS requires a subnet group spanning at least two availability zones, but regions do not reliably have a default one even when a default VPC exists. This adds a `dbSubnetGroupName` helper that creates and reuses a named subnet group (`servicecontrol-cloud-tests`) as shared account infrastructure, matching the same concurrent-creation pattern already used for the default VPC.

The workflow also switches RDS targets to a fixed region (`us-east-2`) rather than the shared `AWS_REGION` secret, which is at its VPC ceiling and cannot host publicly accessible RDS instances.

A `tryRun` helper is added to `common.mts` to capture CLI failure output without throwing, allowing callers to distinguish a race-condition loss from a genuine error.
…r run concurrently

Both AWS targets run at the same time using the same run name, so their security groups and RDS identifiers collide. Aurora PostgreSQL now appends `-aurora` to its resource names and SQL Server appends `-mssql`, making them distinct within the same run.

Also fixes the Azure PostgreSQL database creation command, which requires `--name` rather than `--database-name` for the `flexible-server db create` subcommand.
General Purpose stores its transaction log on remote storage, capping log throughput at roughly one-tenth of what Business Critical provides on local SSD. The test suites create, index, and drop a schema per test around 550 times, so log throughput is the binding constraint—not CPU. A run on General Purpose measured 9 to 21 times slower than a local container and timed out. Business Critical keeps data and log on local SSD and resolves the bottleneck.
…ure-sqlserver

All four managed database targets are upgraded to larger instance classes (db.r6g.2xlarge for Aurora PostgreSQL, db.m5.2xlarge for RDS SQL Server, Standard_D8ds_v5 with 512 GB storage for Azure PostgreSQL, BC_Gen5_8 for Azure SQL Server) to avoid CPU and IO throttling mid-run. The test suites are IO bound, and premium SSD IOPS on Azure PostgreSQL scale with disk size, so the storage is intentionally oversized.

The azure-sql target is renamed to azure-sqlserver throughout—action inputs, TypeScript types, the workflow dispatch options, and the provisioner file itself—to match the naming convention of the other SQL Server target (rds-sqlserver).
RDS instances take minutes to finish deleting and hold their security group until then. Rather than failing, the deletion attempt now treats DependencyViolation as an expected transient condition and leaves the group for removeStaleSecurityGroups to clean up on a later run. Any other error is still re-thrown.
… as CLI arguments

Passwords containing characters like `-` or `+` could be interpreted as CLI flags when passed as a separate argument. Switching to the `--flag=value` form prevents the CLI from misinterpreting the password value.

Also removes `-` and `+` from the generated password's symbol set to avoid a leading `-` after shuffling, and ensures the first character is always a letter to satisfy provider constraints that require passwords to begin with an alphabetic character.
Converts cloud-database-tests.yml to a reusable workflow (workflow_call) and calls it from release.yml alongside the existing jobs, so cloud database tests run automatically on every release rather than requiring a manual trigger or branch/tag push.
@johnsimons
johnsimons merged commit c4ad657 into master Sep 11, 2026
134 of 138 checks passed
@johnsimons
johnsimons deleted the john/cloud_ci_tests branch September 11, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants