# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

timeout: 7200s
options:
  pool:
    name: 'projects/pso-kokoro-resources/locations/us-central1/workerPools/private-pool'
steps:
- id: lint
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=lint'
  waitFor: ['-']
- id: unit
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=unit'
  waitFor: ['-']
- id: proxy-install
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/install_cloud_proxy.sh']
  waitFor: ["-"]
- id: integration_mysql
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_mysql'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'CLOUD_SQL_CONNECTION=pso-kokoro-resources:us-central1:data-validator-mysql=tcp:3306'
  waitFor: ['proxy-install']
  secretEnv: ['MYSQL_PASSWORD']
- id: integration_postgres
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_postgres'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'CLOUD_SQL_CONNECTION=pso-kokoro-resources:us-central1:data-validator-postgres12=tcp:5432'
  secretEnv: ['POSTGRES_PASSWORD']
  waitFor: ['proxy-install']
- id: integration_sql_server
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_sql_server'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'CLOUD_SQL_CONNECTION=pso-kokoro-resources:us-central1:data-validator-mssql2017=tcp:1433'
  secretEnv: ['SQL_SERVER_PASSWORD']
  waitFor: ['proxy-install']
- id: integration_bigquery
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_bigquery'
  - 'PROJECT_ID=pso-kokoro-resources'
  waitFor: ['-']
- id: integration_spanner
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_spanner'
  - 'PROJECT_ID=pso-kokoro-resources'
  waitFor: ['-']
- id: integration_teradata
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_teradata'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'TERADATA_HOST=10.128.15.235'
  secretEnv: ['TERADATA_PASSWORD']
  waitFor: ['-']
- id: integration_state
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_state'
  - 'PROJECT_ID=pso-kokoro-resources'
  waitFor: ['-']
- id: integration_oracle
  name: 'gcr.io/pso-kokoro-resources/python-multi-oracle-21client'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_oracle'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'ORACLE_HOST=10.128.15.246'
  - 'CLOUD_SQL_CONNECTION=pso-kokoro-resources:us-central1:data-validator-postgres12=tcp:5432'
  secretEnv: ['ORACLE_PASSWORD', 'POSTGRES_PASSWORD']
  waitFor: ['proxy-install']
- id: integration_hive
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_hive'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'HIVE_HOST=10.128.15.219'
  waitFor: ['-']
- id: integration_snowflake
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_snowflake'
  - 'PROJECT_ID=pso-kokoro-resources'
  secretEnv: ['SNOWFLAKE_ACCOUNT', 'SNOWFLAKE_USER', 'SNOWFLAKE_PASSWORD']
  waitFor: ['-']
- id: integration_db2
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_db2'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'DB2_HOST=10.128.0.45'
  secretEnv: ['DB2_PASSWORD']
  waitFor: ['-']
- id: integration_filesystem
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_filesystem'
  - 'PROJECT_ID=pso-kokoro-resources'
  waitFor: ['-']
- id: integration_impala
  name: 'gcr.io/cloud-devrel-public-resources/python-multi'
  args: ['bash', './ci/build.sh']
  env:
  - 'NOX_SESSION=integration_impala'
  - 'PROJECT_ID=pso-kokoro-resources'
  - 'IMPALA_HOST=10.128.0.118'
  waitFor: ['-']

availableSecrets:
  secretManager:
  - versionName: projects/$PROJECT_ID/secrets/mysql_password/versions/latest
    env: 'MYSQL_PASSWORD'
  - versionName: projects/$PROJECT_ID/secrets/postgres_password/versions/latest
    env: 'POSTGRES_PASSWORD'
  - versionName: projects/$PROJECT_ID/secrets/sql_server_password/versions/latest
    env: 'SQL_SERVER_PASSWORD'
  - versionName: projects/$PROJECT_ID/secrets/teradata_password/versions/latest
    env: 'TERADATA_PASSWORD'
  - versionName: projects/$PROJECT_ID/secrets/oracle_password/versions/latest
    env: 'ORACLE_PASSWORD'
  - versionName: projects/$PROJECT_ID/secrets/snowflake_account/versions/latest
    env: 'SNOWFLAKE_ACCOUNT'
  - versionName: projects/$PROJECT_ID/secrets/snowflake_user/versions/latest
    env: 'SNOWFLAKE_USER'
  - versionName: projects/$PROJECT_ID/secrets/snowflake_password/versions/latest
    env: 'SNOWFLAKE_PASSWORD'
  - versionName: projects/$PROJECT_ID/secrets/db2_password/versions/latest
    env: 'DB2_PASSWORD'
