Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
splits IMAGE_NAME into COMPOSE_SERVICE_NAME for docker compose servic…
Browse files Browse the repository at this point in the history
…es as naming has diverged (#884)
  • Loading branch information
Sean Preston authored Jul 15, 2022
1 parent f28888d commit 85c1495
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ IMAGE_TAG := $(shell git fetch --force --tags && git describe --tags --dirty --a
# IMAGE_NAME is webserver rather than fidesops_webserver because commands that don't
# use docker-compose fail with fidesops_webserver. When left as webserver here both
# sets of commands work.
IMAGE_NAME := webserver
COMPOSE_SERVICE_NAME := webserver
IMAGE_NAME := fidesops
IMAGE := $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)
IMAGE_LATEST := $(REGISTRY)/$(IMAGE_NAME):latest

Expand All @@ -31,7 +32,7 @@ help:

init-db: compose-build
@echo "Check for new migrations to run..."
@docker-compose run --rm -e ANALYTICS_OPT_OUT $(IMAGE_NAME) \
@docker-compose run --rm -e ANALYTICS_OPT_OUT $(COMPOSE_SERVICE_NAME) \
python -c "\
from fidesops.db.database import init_db; \
from fidesops.core.config import config; \
Expand All @@ -53,7 +54,7 @@ server-no-db: compose-build
@docker-compose -f docker-compose.no-db.yml up

server-shell: compose-build
@docker-compose run $(IMAGE_NAME) /bin/bash
@docker-compose run $(COMPOSE_SERVICE_NAME) /bin/bash

integration-shell:
@virtualenv -p python3 fidesops_test_dispatch; \
Expand Down Expand Up @@ -92,14 +93,14 @@ black-ci: compose-build
@echo "Running black checks..."
@docker-compose run \
-e ANALYTICS_OPT_OUT \
$(IMAGE_NAME) \
$(COMPOSE_SERVICE_NAME) \
black --check src/ tests/ \
|| (echo "Error running 'black --check src/ tests/', please run 'make black' to format your code!"; exit 1)
@make teardown

check-migrations: compose-build
@echo "Check if there are unrun migrations..."
@docker-compose run --rm -e ANALYTICS_OPT_OUT $(IMAGE_NAME) \
@docker-compose run --rm -e ANALYTICS_OPT_OUT $(COMPOSE_SERVICE_NAME) \
python -c "\
from fidesops.db.database import check_missing_migrations; \
from fidesops.core.config import config; \
Expand All @@ -108,30 +109,30 @@ check-migrations: compose-build

isort-ci:
@echo "Running isort checks..."
@docker-compose run $(IMAGE_NAME) \
@docker-compose run $(COMPOSE_SERVICE_NAME) \
isort src tests --check-only

pylint: compose-build
@echo "Running pylint checks..."
@docker-compose run \
-e ANALYTICS_OPT_OUT \
$(IMAGE_NAME) \
$(COMPOSE_SERVICE_NAME) \
pylint src/
@make teardown

mypy: compose-build
@echo "Running mypy checks..."
@docker-compose run \
-e ANALYTICS_OPT_OUT \
$(IMAGE_NAME) \
$(COMPOSE_SERVICE_NAME) \
mypy src/
@make teardown

pytest: compose-build
@echo "Running pytest unit tests..."
@docker-compose run \
-e ANALYTICS_OPT_OUT \
$(IMAGE_NAME) \
$(COMPOSE_SERVICE_NAME) \
pytest $(pytestpath) -m "not integration and not integration_external and not integration_saas"

@make teardown
Expand All @@ -150,7 +151,7 @@ pytest-integration-external: compose-build
-e REDSHIFT_TEST_URI \
-e SNOWFLAKE_TEST_URI -e REDSHIFT_TEST_DB_SCHEMA \
-e BIGQUERY_KEYFILE_CREDS -e BIGQUERY_DATASET \
$(IMAGE_NAME) pytest $(pytestpath) -m "integration_external"
$(COMPOSE_SERVICE_NAME) pytest $(pytestpath) -m "integration_external"
@make teardown

pytest-saas: compose-build
Expand All @@ -164,7 +165,7 @@ pytest-saas: compose-build
-e SEGMENT_DOMAIN -e SEGMENT_PERSONAS_DOMAIN -e SEGMENT_WORKSPACE -e SEGMENT_ACCESS_TOKEN -e SEGMENT_API_DOMAIN -e SEGMENT_NAMESPACE_ID -e SEGMENT_ACCESS_SECRET -e SEGMENT_USER_TOKEN -e SEGMENT_IDENTITY_EMAIL \
-e STRIPE_DOMAIN -e STRIPE_API_KEY -e STRIPE_PAYMENT_TYPES -e STRIPE_PAGE_SIZE -e STRIPE_IDENTITY_EMAIL \
-e SALESFORCE_DOMAIN -e SALESFORCE_CLIENT_ID -e SALESFORCE_CLIENT_SECRET -e SALESFORCE_ACCESS_TOKEN -e SALESFORCE_USERNAME -e SALESFORCE_PASSWORD -e SALESFORCE_IDENTITY_EMAIL \
$(IMAGE_NAME) pytest $(pytestpath) -m "integration_saas"
$(COMPOSE_SERVICE_NAME) pytest $(pytestpath) -m "integration_saas"
@make teardown


Expand All @@ -175,7 +176,7 @@ pytest-saas: compose-build
.PHONY: black
black: compose-build
@echo "Running black formatting against the src/ and tests/ directories..."
@docker-compose run $(IMAGE_NAME) black src/ tests/
@docker-compose run $(COMPOSE_SERVICE_NAME) black src/ tests/
@make teardown
@echo "Fin"

Expand All @@ -194,7 +195,7 @@ compose-build:
.PHONY: isort
isort:
@echo "Running isort checks..."
@docker-compose run $(IMAGE_NAME) \
@docker-compose run $(COMPOSE_SERVICE_NAME) \
isort src tests

.PHONY: teardown
Expand All @@ -205,7 +206,7 @@ teardown:

.PHONY: docs-build
docs-build: compose-build
@docker-compose run --rm $(IMAGE_NAME) \
@docker-compose run --rm $(COMPOSE_SERVICE_NAME) \
python generate_openapi.py ./docs/fidesops/docs/api/openapi.json

.PHONY: docs-serve
Expand Down

0 comments on commit 85c1495

Please sign in to comment.