Skip to content

Commit

Permalink
replace secrets generation with secrets from existing integration tes…
Browse files Browse the repository at this point in the history
…t workflow
  • Loading branch information
mikealfare committed May 20, 2024
1 parent 74f16ea commit 87c6bef
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions .github/workflows/release-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ jobs:
needs: unit-tests

env:
TOXENV: integration
TOXENV: integration-redshift
PYTEST_ADDOPTS: "-v --color=yes -n4 --csv integration_results.csv"
DBT_INVOCATION_ENV: github-actions

steps:
- name: "Checkout provided ref, default to branch main"
Expand All @@ -107,32 +109,6 @@ jobs:
- name: "Setup Environment Variables - ./scripts/env-setup.sh"
run: source ./scripts/env-setup.sh

- name: "Setup Environment Variables - Secrets Context"
uses: actions/github-script@v7
id: check-env
with:
result-encoding: string
script: |
try {
const { SECRETS_CONTEXT, INTEGRATION_TESTS_SECRETS_PREFIX } = process.env
const secrets = JSON.parse(SECRETS_CONTEXT)
if (INTEGRATION_TESTS_SECRETS_PREFIX) {
for (const [key, value] of Object.entries(secrets)) {
if (key.startsWith(INTEGRATION_TESTS_SECRETS_PREFIX)) {
core.exportVariable(key, value)
}
}
} else {
core.info("The INTEGRATION_TESTS_SECRETS_PREFIX env variable is empty or not defined, skipping the secrets setup.")
}
} catch (err) {
core.error("Error while reading or parsing the JSON")
core.setFailed(err)
}
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}

- name: "Set up Python - ${{ env.PYTHON_TARGET_VERSION }}"
uses: actions/setup-python@v5
with:
Expand All @@ -145,7 +121,7 @@ jobs:
python -m pip install tox
tox --version
- name: Create AWS IAM profiles
- name: "Create AWS IAM profiles"
run: |
aws configure --profile $AWS_USER_PROFILE set aws_access_key_id $AWS_USER_ACCESS_KEY_ID
aws configure --profile $AWS_USER_PROFILE set aws_secret_access_key $AWS_USER_SECRET_ACCESS_KEY
Expand All @@ -172,8 +148,23 @@ jobs:
AWS_ROLE_ARN: ${{ secrets.REDSHIFT_TEST_IAM_ROLE_ARN }}
AWS_REGION: ${{ vars.REDSHIFT_TEST_REGION }}

- name: "Run Tests using tox"
run: tox
- name: "Run tox"
env:
REDSHIFT_TEST_DBNAME: ${{ secrets.REDSHIFT_TEST_DBNAME }}
REDSHIFT_TEST_PASS: ${{ secrets.REDSHIFT_TEST_PASS }}
REDSHIFT_TEST_USER: ${{ secrets.REDSHIFT_TEST_USER }}
REDSHIFT_TEST_PORT: ${{ secrets.REDSHIFT_TEST_PORT }}
REDSHIFT_TEST_HOST: ${{ secrets.REDSHIFT_TEST_HOST }}
REDSHIFT_TEST_REGION: ${{ vars.REDSHIFT_TEST_REGION }}
REDSHIFT_TEST_CLUSTER_ID: ${{ vars.REDSHIFT_TEST_CLUSTER_ID }}
REDSHIFT_TEST_IAM_USER_PROFILE: ${{ vars.REDSHIFT_TEST_IAM_USER_PROFILE }}
REDSHIFT_TEST_IAM_USER_ACCESS_KEY_ID: ${{ vars.REDSHIFT_TEST_IAM_USER_ACCESS_KEY_ID }}
REDSHIFT_TEST_IAM_USER_SECRET_ACCESS_KEY: ${{ secrets.REDSHIFT_TEST_IAM_USER_SECRET_ACCESS_KEY }}
REDSHIFT_TEST_IAM_ROLE_PROFILE: ${{ vars.REDSHIFT_TEST_IAM_ROLE_PROFILE }}
DBT_TEST_USER_1: dbt_test_user_1
DBT_TEST_USER_2: dbt_test_user_2
DBT_TEST_USER_3: dbt_test_user_3
run: tox -- -m "not flaky" --ddtrace

create-internal-release:
name: Create release for internal archive
Expand Down

0 comments on commit 87c6bef

Please sign in to comment.