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

updates to deploy-dev.yml to save all workflow artifacts including do… #400

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build-deploy-ocr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
dockerfile-path: ./OCR/Dockerfile
docker-context-path: ./OCR/
api-name: ocr-api
- name: Upload Docker Build Artifact (Optional)
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
uses: actions/upload-artifact@v3
with:
name: ocr-docker-image-artifact
path: ./OCR/dockerbuild_file.dockerbuild # Path to the artifact

deploy-ocr:
name: Deploy OCR
Expand All @@ -74,3 +80,8 @@ jobs:
docker-tag: ${{ inputs.ocr-version }}
docker-registry: ghcr.io
api-name: ocr-api
- name: Download Docker Artifact (Optional)
uses: actions/download-artifact@v3
with:
name: ocr-docker-image-artifact # The name of the artifact to download
path: ./downloaded-artifact # Path where the artifact will be saved
52 changes: 48 additions & 4 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,39 @@ jobs:
outputs:
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: Check if image exists
id: image_check
run: |
echo "docker_inspect=$(
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:${{ inputs.ocr-version }} > /dev/null ; echo $?
)" >> $GITHUB_OUTPUT


# Pull the image from GHCR
# - name: Pull OCR Docker image from GHCR
# run: |
# docker pull ghcr.io/${{ github.repository }}-ocr-api:${{ inputs.ocr-version }}

# Debugging step to check the value of docker_inspect
- name: Debug image inspect result
run: echo "Docker inspect result: ${{ steps.image_check.outputs.docker_inspect }}"

# TODO: Check if image exists, if not create and build & if it does then do a docker pull
- name: Build and Push backend
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
if: ${{ steps.image_check.outputs.docker_inspect == 0 }} # TODO: May need to change this back to 1, but test out 0
uses: ./.github/actions/build-publish-api
with:
docker-registry: ghcr.io
Expand All @@ -48,11 +70,23 @@ jobs:
docker-context-path: ./OCR/
api-name: ocr-api

- name: Upload Docker Build Artifact
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
uses: actions/upload-artifact@v3
with:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the goal here to provide access to the docker image after it's been built? If so we are pushing our images once they're built to https://github.com/CDCgov/ReportVision/pkgs/container/reportvision-ocr-api and we are doing this at .github/actions/build-publish-api. Once that image is published to the GH registry, the azure/webapps-deploy@v3 action uses it here:

images: '${{ inputs.docker-registry }}/${{ env.REPO}}-${{ inputs.api-name }}:${{ inputs.docker-tag }}'

Copy link
Collaborator

@derekadombek derekadombek Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something we could possibly think of doing is migrating our registry to something like ACR instead. The main con however to doing that would be if this system ever needs to be cloud agnostic in the future, which it most likely would need to be.

name: ocr-docker-image-artifact
path: ./OCR/dev-dockerfile # Path to the artifact

# Check to see if the file is uploaded in this directory
- name: List files in OCR directory
run: ls -l ./OCR

build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-frontend
name: Build frontend
with:
Expand Down Expand Up @@ -95,14 +129,24 @@ jobs:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Download Docker Artifact (Optional)
uses: actions/download-artifact@v3
with:
name: ocr-docker-image-artifact # The name of the artifact to download
path: ./OCR # Path where the artifact will be saved

# Ensure that the downloaded artifact is available
- name: List files in the downloaded artifact directory (for debugging)
run: ls -l ./downloaded-artifact

- name: Deploy OCR-API
uses: ./.github/actions/deploy-api
with:
deploy-env: ${{ inputs.deploy-env }}
docker-tag: ${{ inputs.ocr-version }}
docker-registry: ghcr.io
api-name: ocr-api

deploy-frontend:
name: Deploy Frontend
runs-on: ubuntu-latest
Expand All @@ -120,4 +164,4 @@ jobs:
uses: ./.github/actions/deploy-frontend
with:
frontend-tarball: frontend.tgz
deploy-env: ${{ inputs.deploy-env }}
deploy-env: ${{ inputs.deploy-env }}
Loading