Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.32 KiB
Newer Older
#  Copyright 2020 Google LLC
#  Copyright 2020 EPAM Systems
#
#  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
#
#      http://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.

image: google/cloud-sdk:alpine
  - unit_tests
  - test_dags
  - containerize
  - bootstrap
  - end_to_end_postman_tests
include:
    - project: "osdu/platform/ci-cd-pipelines"
      ref: 'master'
      file: "cloud-providers/azure_dag.yml"
    - project: "osdu/platform/ci-cd-pipelines"
      ref: "master"
      file: "build/python-linters.yml"

    - project: "osdu/platform/ci-cd-pipelines"
      ref: "master"
      file: "cloud-providers/osdu-gcp-dag.yaml"

  variables:
    SRC_FILES: "src/*/*.py"
  before_script:
    - pip install -r src/osdu_dags/requirements.txt
  variables:
    SRC_FILES: "src/*/*.py"
test_dags:
  stage: test_dags
  needs: ["pylint", "isort"]
  image: eu.gcr.io/osdu-cicd-epam/airflow-python-dags/airflow-python-dags:latest
  script:
    - chmod +x tests/test_dags.sh
    - tests/./test_dags.sh  || EXIT_CODE=$?
    - exit ${EXIT_CODE}
  artifacts:
    paths:
      - logs/
    when: on_failure
    expire_in: 1 week
unit_tests:
  stage: unit_tests
  needs: ["pylint", "isort"]
  image: eu.gcr.io/osdu-cicd-epam/airflow-python-dags/airflow-python-dags:latest
  script:
    - chmod +x tests/unit_tests.sh
    # - tests/./unit_tests.sh  || EXIT_CODE=$? #TODO: unit tests moved to airflow-osdu-lib, need to remove `unit_tests` CI step later
osdu_gcp_deploy_composer_community:
  needs: ["unit_tests", "test_dags"]
  variables:
    DAG_FOLDER: "src/osdu_dags"

osdu_gcp_deploy_composer_pre_ship:
  needs: ["unit_tests", "test_dags"]
  variables:
    DAG_FOLDER: "src/osdu_dags"

osdu_gcp_postman_tests_community:
  stage: end_to_end_postman_tests
  variables:
    TEST_SOURCE_FILES_DIR: "Postman Collection/29_CICD_Setup_Ingestion"
    COLLECTION_PATH: "Postman Collection/29_CICD_Setup_Ingestion/R3 Full manifest-based ingestion.postman_collection.json"
osdu_gcp_postman_tests_pre_ship:
  stage: end_to_end_postman_tests
  variables:
    TEST_SOURCE_FILES_DIR: "Postman Collection/29_CICD_Setup_Ingestion"
    COLLECTION_PATH: "Postman Collection/29_CICD_Setup_Ingestion/R3 Full manifest-based ingestion.postman_collection.json"

osdu_gcp_bootstrap_dag_community:
  stage: deploy
  variables: 
    OSDU_GCP_SKIP_BOOTSTRAP: "true"

osdu_gcp_bootstrap_dag_pre_ship:
  stage: deploy
  variables: 
    OSDU_GCP_SKIP_BOOTSTRAP: "true"
# We are skipping this stage using AZURE_SKIP_STANDALONE_TESTS variable as there is already a common stage for Executing Unit
# tests, but we need to override here because of stage name mismatch
azure_standalone_tests:
    stage: unit_tests
    needs: ["pylint"]
    variables:
        AZURE_SKIP_STANDALONE_TESTS: 'true'

azure_build_dag:
    needs: ["unit_tests"]