Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push a continual "dev" image to dockerhub #781

Merged
merged 11 commits into from
Jun 21, 2022
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ build/
dist/
src/fidesctl.egg-info/

# Ignore Python-Specific Files
.mypy_cache/
.pytest_cache/
__pycache__/
.coverage
ThomasLaPiana marked this conversation as resolved.
Show resolved Hide resolved

# Ignore the docs
docs/

# Ignore dev files
.git/
.github/
.devcontainer/

node_modules/
13 changes: 10 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -26,8 +29,12 @@ jobs:
- name: Install Dev Requirements
run: pip install -r dev-requirements.txt

- name: Build Fidesctl
- name: Build Fidesctl Prod
run: nox -s "build(prod)"
ThomasLaPiana marked this conversation as resolved.
Show resolved Hide resolved

- name: Push Fidesctl
run: nox -s push
- name: Push Fidesctl Dev
run: nox -s "push(dev)"
ThomasLaPiana marked this conversation as resolved.
Show resolved Hide resolved

- name: Push Fidesctl Prod
if: ${{ env.TAG }}
run: nox -s "push(prod)"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
* There is now a new image tagged `ethyca/fidesctl:dev` pushed on each push to main [781](https://github.com/ethyca/fides/pull/781)
ThomasLaPiana marked this conversation as resolved.
Show resolved Hide resolved

### Changed

Expand Down
1 change: 1 addition & 0 deletions noxfiles/constants_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 20 additions & 4 deletions noxfiles/docker_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import nox
from constants_nox import (
IMAGE,
IMAGE_DEV,
ThomasLaPiana marked this conversation as resolved.
Show resolved Hide resolved
IMAGE_LATEST,
IMAGE_LOCAL,
IMAGE_LOCAL_UI,
Expand Down Expand Up @@ -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)