-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathconstants_nox.py
60 lines (51 loc) · 1.65 KB
/
constants_nox.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""Define constants to be used across the noxfiles."""
from os import getenv
def get_current_tag() -> str:
"""Get the current git tag."""
from git.repo import Repo
repo = Repo()
git_session = repo.git()
git_session.fetch("--force", "--tags")
current_tag = git_session.describe("--tags", "--dirty", "--always")
return current_tag
# Files
COMPOSE_FILE = "docker-compose.yml"
INTEGRATION_COMPOSE_FILE = "docker-compose.integration-tests.yml"
WITH_TEST_CONFIG = ("-f", "tests/ctl/test_config.toml")
# Image Names & Tags
REGISTRY = "ethyca"
IMAGE_NAME = "fidesctl"
IMAGE = f"{REGISTRY}/{IMAGE_NAME}"
IMAGE_LOCAL = f"{IMAGE}:local"
IMAGE_LOCAL_UI = f"{IMAGE}:local-ui"
IMAGE_DEV = f"{IMAGE}:dev"
IMAGE_LATEST = f"{IMAGE}:latest"
# Disable TTY to perserve output within Github Actions logs
# CI env variable is always set to true in Github Actions
# The else statement is required due to the way commmands are structured and is arbitrary.
CI_ARGS = "-T" if getenv("CI") else "--user=root"
# If FIDESCTL__CLI__ANALYTICS_ID is set in the local environment, use its value as the analytics_id
ANALYTICS_ID_OVERRIDE = ("-e", "FIDESCTL__CLI__ANALYTICS_ID")
# Reusable Commands
RUN = ("docker-compose", "run", "--rm", *ANALYTICS_ID_OVERRIDE, CI_ARGS, IMAGE_NAME)
RUN_NO_DEPS = (
"docker-compose",
"run",
"--no-deps",
"--rm",
*ANALYTICS_ID_OVERRIDE,
CI_ARGS,
IMAGE_NAME,
)
START_APP = ("docker-compose", "up", "-d", "fidesctl")
START_APP_UI = ("docker-compose", "up", "-d", "fidesctl-ui")
START_APP_EXTERNAL = (
"docker-compose",
"-f",
COMPOSE_FILE,
"-f",
INTEGRATION_COMPOSE_FILE,
"up",
"-d",
IMAGE_NAME,
)