diff --git a/.dockerignore b/.dockerignore index 7f4d222715..d071ecf439 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,11 +3,31 @@ build/ dist/ src/fidesctl.egg-info/ +# Ignore Python-Specific Files +.mypy_cache/ +.nox/ +.pytest_cache/ +__pycache__/ +.coverage + +# pyenv +.python-version + +# Environments +.env +.venv +env/ +venv/ + +# Editors +.vscode/ +.idea/ + # Ignore the docs docs/ # Ignore dev files +.git/ .github/ .devcontainer/ - node_modules/ diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 285e6ed585..a5a2546085 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -2,12 +2,15 @@ name: Docker Build & Push on: push: + branches: + - main tags: - "*" env: DOCKER_USER: ethycaci DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} + TAG: ${{ github.event.release.tag_name }} jobs: push-fidesctl: @@ -26,8 +29,12 @@ jobs: - name: Install Dev Requirements run: pip install -r dev-requirements.txt - - name: Build Fidesctl + - name: Build Fidesctl Image run: nox -s "build(prod)" - - name: Push Fidesctl - run: nox -s push + - name: Push Fidesctl Dev Tag + run: nox -s "push(dev)" + + - name: Push Fidesctl Prod Tags + if: ${{ env.TAG }} + run: nox -s "push(prod)" diff --git a/CHANGELOG.md b/CHANGELOG.md index 53a6df85c4..8d610234ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The types of changes are: * Add a component for Identifiability tags * Okta, aws and database credentials can now come from `fidesctl.toml` config [#694](https://github.com/ethyca/fides/pull/694) * New `validate` endpoint to test aws and okta credentials [#722](https://github.com/ethyca/fides/pull/722) +* A new image tagged `ethyca/fidesctl:dev` is published on each push to `main` [781](https://github.com/ethyca/fides/pull/781) * A new cli command (`fidesctl sync`) [#765](https://github.com/ethyca/fides/pull/765) ### Changed diff --git a/noxfiles/constants_nox.py b/noxfiles/constants_nox.py index d72aa03367..b70beabe61 100644 --- a/noxfiles/constants_nox.py +++ b/noxfiles/constants_nox.py @@ -24,6 +24,7 @@ def get_current_tag() -> str: 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 diff --git a/noxfiles/docker_nox.py b/noxfiles/docker_nox.py index 4312499ff2..4fe9436bc4 100644 --- a/noxfiles/docker_nox.py +++ b/noxfiles/docker_nox.py @@ -2,6 +2,7 @@ import nox from constants_nox import ( IMAGE, + IMAGE_DEV, IMAGE_LATEST, IMAGE_LOCAL, IMAGE_LOCAL_UI, @@ -49,8 +50,23 @@ def build(session: nox.Session, image: str) -> None: @nox.session() -def push(session: nox.Session) -> None: +@nox.parametrize( + "tag", + [ + nox.param("prod", id="prod"), + nox.param("dev", id="dev"), + ], +) +def push(session: nox.Session, tag: str) -> None: """Push the fidesctl Docker image to Dockerhub.""" - session.run("docker", "tag", get_current_image(), IMAGE_LATEST, external=True) - session.run("docker", "push", IMAGE, external=True) - session.run("docker", "push", IMAGE_LATEST, external=True) + + tag_matrix = {"prod": IMAGE_LATEST, "dev": IMAGE_DEV} + + # Push either "ethyca/fidesctl:dev" or "ethyca/fidesctl:latest" + session.run("docker", "tag", get_current_image(), tag_matrix[tag], external=True) + session.run("docker", "push", tag_matrix[tag], external=True) + + # Only push the tagged version if its for prod + # Example: "ethyca/fidesctl:1.7.0" + if tag == "prod": + session.run("docker", "push", IMAGE, external=True)