Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge workflows, test on all available targets #400

Merged
merged 4 commits into from
Dec 12, 2023

Conversation

erezrokah
Copy link
Member

@erezrokah erezrokah commented Dec 11, 2023

Still work in progress, merged the _postgres and _snowflake workflows and also add tests for BigQuery.

The workflows will check for relevant specs under tests and will run:

  • Postgres target if tests/postgres.yml exists
  • Snowflake target if tests/snowflake.yml exists
  • BigQuery target if tests/bigquery.yml exists

I'll create a matching tests/bigquery.yml file for GCP compliance premium based on https://github.com/cloudquery/policies-premium/blob/f2fdc9dd7e2574a2ba6f3b5f27a1f6c362307154/transformations/gcp/compliance-premium/tests/profiles.yml#L24 just from our integration testing account since cq-playground is nuked on a schedule

@erezrokah erezrokah requested a review from a team December 11, 2023 13:55
@erezrokah erezrokah marked this pull request as draft December 11, 2023 13:55
@erezrokah erezrokah force-pushed the chore/better_tests branch 5 times, most recently from c060e28 to 1490bda Compare December 11, 2023 17:24
@@ -1,5 +1,5 @@
{% macro is_snowflake() %}
{% if target.name == 'snowflake' %}
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this worked at our target name in the profiles.yml is dev-snowflake.
I believe the Snowflake tests were passing due to the --select argument added in https://github.com/cloudquery/policies-premium/pull/166/files#diff-5529d7636471ea70d566f8a3ea390efc26e7d7f7df536b3c65f7066567112757R54 and b9f2782#diff-5529d7636471ea70d566f8a3ea390efc26e7d7f7df536b3c65f7066567112757R54

Copy link
Member Author

@erezrokah erezrokah Dec 12, 2023

Choose a reason for hiding this comment

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

So Snowflake tests were not really running
image

script: |
const fs = require('fs/promises');
const { TRANSFORMATION_DIR: transformation_dir } = process.env;
const [postgres, snowflake, bigquery] = await Promise.all([
Copy link
Member Author

@erezrokah erezrokah Dec 11, 2023

Choose a reason for hiding this comment

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

The main change in this PR is to check for the relevant DB target specs and run migrate + DBT on each existing target. So you can add a new target to the CI by simply adding a bigquery.yml file for example

@@ -1,3 +1,5 @@
{{ config(enabled=is_postgres()) }}
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to merge the README notes on what is supported per target plugin the select argument from https://github.com/cloudquery/policies-premium/pull/166/files#diff-5529d7636471ea70d566f8a3ea390efc26e7d7f7df536b3c65f7066567112757R54 and b9f2782#diff-5529d7636471ea70d566f8a3ea390efc26e7d7f7df536b3c65f7066567112757R54 when adding is_postgres or is_snowflake.

Please verify these are correct (the AWS compliance premium policy is missing the supported models, it only lists the free ones)

@erezrokah erezrokah marked this pull request as ready for review December 12, 2023 13:01
@erezrokah erezrokah merged commit 82cc595 into main Dec 12, 2023
26 checks passed
@erezrokah erezrokah deleted the chore/better_tests branch December 12, 2023 15:03
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.

1 participant