diff --git a/end-to-end-tests.yml b/end-to-end-tests.yml index 3c8ab0780..f18a5151f 100644 --- a/end-to-end-tests.yml +++ b/end-to-end-tests.yml @@ -23,6 +23,10 @@ jobs: inputs: versionSpec: '3.12' addToPath: true + - bash: | + mkdir -p ~/.pyrit + displayName: "Create PyRIT configuration directory" + name: create_pyrit_dir - task: AzureKeyVault@2 displayName: Azure Key Vault - retrieve .env file secret inputs: @@ -36,13 +40,13 @@ jobs: secret = os.environ.get('PYRIT_TEST_SECRET'); if not secret: raise ValueError('PYRIT_TEST_SECRET is not set'); - with open('.env', 'w') as file: + with open(os.path.expanduser('~/.pyrit/.env'), 'w') as file: file.write(secret)" env: PYRIT_TEST_SECRET: $(env-global) name: create_env_file - bash: | - cp build_scripts/env_local_integration_test .env.local + cp build_scripts/env_local_integration_test ~/.pyrit/.env.local displayName: "Create .env.local from example" - script: wget -qO- https://astral.sh/uv/install.sh | sh @@ -83,8 +87,6 @@ jobs: NEW_DIR="e2e_test_directory" cd .. mkdir -p $NEW_DIR/tests - cp $PyRIT_DIR/.env $NEW_DIR - cp $PyRIT_DIR/.env.local $NEW_DIR cp -r $PyRIT_DIR/doc $NEW_DIR cp -r $PyRIT_DIR/assets $NEW_DIR cp -r $PyRIT_DIR/tests/end_to_end $NEW_DIR/tests @@ -112,7 +114,7 @@ jobs: # Run end-to-end tests make end-to-end-test - bash: | - rm -f .env + rm -f ~/.pyrit/.env ~/.pyrit/.env.local name: clean_up_env_files condition: always() - task: PublishTestResults@2 diff --git a/integration-tests.yml b/integration-tests.yml index 9b54218f7..ff6fe4d0e 100644 --- a/integration-tests.yml +++ b/integration-tests.yml @@ -21,6 +21,10 @@ jobs: inputs: versionSpec: '3.12' addToPath: true + - bash: | + mkdir -p ~/.pyrit + displayName: "Create PyRIT configuration directory" + name: create_pyrit_dir - task: AzureKeyVault@2 displayName: Azure Key Vault - retrieve .env file secret inputs: @@ -34,13 +38,13 @@ jobs: secret = os.environ.get('PYRIT_TEST_SECRET'); if not secret: raise ValueError('PYRIT_TEST_SECRET is not set'); - with open('.env', 'w') as file: + with open(os.path.expanduser('~/.pyrit/.env'), 'w') as file: file.write(secret)" env: PYRIT_TEST_SECRET: $(env-global) name: create_env_file - bash: | - cp build_scripts/env_local_integration_test .env.local + cp build_scripts/env_local_integration_test ~/.pyrit/.env.local displayName: "Create .env.local from example" - script: wget -qO- https://astral.sh/uv/install.sh | sh @@ -81,8 +85,6 @@ jobs: NEW_DIR="integration_test_directory" cd .. mkdir -p $NEW_DIR/tests - cp $PyRIT_DIR/.env $NEW_DIR - cp $PyRIT_DIR/.env.local $NEW_DIR cp -r $PyRIT_DIR/doc $NEW_DIR cp -r $PyRIT_DIR/assets $NEW_DIR cp -r $PyRIT_DIR/tests/integration $NEW_DIR/tests @@ -110,7 +112,7 @@ jobs: # Run integration tests make integration-test - bash: | - rm -f .env + rm -f ~/.pyrit/.env ~/.pyrit/.env.local name: clean_up_env_files condition: always() - task: PublishTestResults@2