From 02ae68079a790892a5f18d530fca5e8533ffca57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Ducharme?= Date: Thu, 2 Mar 2023 13:54:25 -0500 Subject: [PATCH] chore(ci): add integration test to validate local environment (#1659) --- .circleci/config.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e538b80..b83ddccd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,6 +29,29 @@ jobs: - store_test_results: path: test-results + test-local-environment: + executor: docker/machine + steps: + - checkout + - attach_workspace: + at: artifacts + - docker/install-docker-compose + - run: + name: Load Docker image artifact from previous job + command: docker load -i artifacts/telemetry-airflow.tar + - run: + name: Override docker-compose.yaml with artifact + command: | + sed -i "s/ build: ./ image: $CIRCLE_PROJECT_REPONAME:${CIRCLE_SHA1:0:9}/g" docker-compose.yml + - run: + name: Start up local environment + command: | + echo "AIRFLOW_UID=$(id -u)" >> .env + echo "FERNET_KEY=$(python3 -c "from cryptography.fernet import Fernet; fernet_key = Fernet.generate_key(); print(fernet_key.decode())")" >> .env + docker-compose up --wait + docker-compose exec airflow-webserver airflow variables import dev_variables.json + docker-compose exec airflow-webserver airflow connections import dev_connections.json + black: executor: *python-executor steps: @@ -102,6 +125,7 @@ workflows: ignore: main tags: ignore: /.*/ + - docker/publish: name: 🛠️ Docker build test before_build: &version @@ -116,12 +140,29 @@ workflows: - run: name: Output version.json command: cat version.json + after_build: + - run: + name: Persist image + command: | + mkdir -p artifacts + docker save -o artifacts/telemetry-airflow.tar $CIRCLE_PROJECT_REPONAME:${CIRCLE_SHA1:0:9} + - persist_to_workspace: + root: artifacts + paths: + - telemetry-airflow.tar deploy: false image: $CIRCLE_PROJECT_REPONAME tag: ${CIRCLE_SHA1:0:9} filters: *ci-filter requires: - 🧪 Validate requirements + + - test-local-environment: + name: 🧪 Validate local environment + filters: *ci-filter + requires: + - 🛠️ Docker build test + - black: name: ⚫ black filters: *ci-filter