Skip to content

Add CI infrastructure for trino-redshift#15817

Closed
findinpath wants to merge 1 commit intotrinodb:masterfrom
findinpath:findinpath/trino-redshift-ci
Closed

Add CI infrastructure for trino-redshift#15817
findinpath wants to merge 1 commit intotrinodb:masterfrom
findinpath:findinpath/trino-redshift-ci

Conversation

@findinpath
Copy link
Copy Markdown
Contributor

@findinpath findinpath commented Jan 23, 2023

Description

This PR adds CI infrastructure for running the integration tests on trino-redshift.

The code spins up on the fly an ephemeral AWS Redshift Cluster before running the tests and deletes it after running the tests.

Additional context and related issues

Release notes

(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Jan 23, 2023
@findinpath findinpath marked this pull request as draft January 23, 2023 22:01
@findinpath findinpath force-pushed the findinpath/trino-redshift-ci branch 3 times, most recently from e7351ec to 8f0fba3 Compare January 24, 2023 11:15
@findinpath findinpath requested review from dain and electrum January 24, 2023 11:21
@findinpath findinpath force-pushed the findinpath/trino-redshift-ci branch from 8f0fba3 to e461288 Compare January 24, 2023 23:09
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't need to be env

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are Trino forks which may be using this Amazon Redshift cluster instances which are not necessarily publicly accessible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we think of a fork, it can do whatever changes it wants, so we don't need hooks in ci.yml for that.

if we want a fork to be able to run the tests without modifying the ci.yml, the REDSHIFT_PUBLICLY_ACCESSIBLE would need to become a repo var (or secret)

Comment on lines 33 to 34
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

instead of this, just invoke ./mvnw with exec

Copy link
Copy Markdown
Contributor Author

@findinpath findinpath Jan 26, 2023

Choose a reason for hiding this comment

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

Would the command

trap - INT TERM EXIT

be still executed afterwards in case of a problem occurring during the tests?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it has to be, otherwise CI won't work

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The names TRINO_AWS_ACCESS_KEY_ID and TRINO_AWS_SECRET_ACCESS_KEY are too generic. There's currently no Trino-owned AWS infra and no guarantee that the keys used for redshift are appropriate for other tests, so they should be named specifically for redshift.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. We'll create a special AWS IAM user for testing trino-redshift

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no need for pwd, see

SCRIPT_DIR="${BASH_SOURCE%/*}"
INTEGRATION_TESTS_ROOT="${SCRIPT_DIR}/.."
PROJECT_ROOT="${INTEGRATION_TESTS_ROOT}/../.."
for how we usually do stuff like this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

always put variables in " quotes. the code here would break if the path contained a whitespace

also, put variable name in ${...} braces (i am following https://google.github.io/styleguide/shellguide.html#variable-expansion here)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

|| exit 1

this reminds me that all scripts should start with

set -xeuo pipefail

then you don't need exit code checks on individual statements like here

@findinpath findinpath force-pushed the findinpath/trino-redshift-ci branch 5 times, most recently from f53b2c5 to 657f5e8 Compare January 26, 2023 12:09
Comment on lines 1071 to 1073
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

left over?

Use an ephemeral/throw-away Redshift cluster for running integration tests
on `trino-redshift` connector.
Once the tests are run, the testing Redshift cluster is being reclaimed.

The Redshift cluster is publicly accessible in order to be accessible
from the general purpose Github runners.
@findinpath findinpath force-pushed the findinpath/trino-redshift-ci branch from 657f5e8 to 2b3864d Compare February 16, 2023 11:01
@findinpath findinpath closed this Feb 16, 2023
@findinpath
Copy link
Copy Markdown
Contributor Author

findinpath commented Feb 20, 2023

Superseded by #16142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants