Skip to content

Commit

Permalink
Merge pull request #303 from AutomatingSciencePipeline/298-refactor-r…
Browse files Browse the repository at this point in the history
…unner-to-backend

Refactor Runner to Backend
  • Loading branch information
rhit-windsors authored Sep 30, 2024
2 parents c6cbac2 + e5d4d15 commit f8d19e8
Show file tree
Hide file tree
Showing 20 changed files with 885 additions and 350 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/publish-backend-docker-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Dev Backend Docker image

on:
push:
branches: ['development']

env:
REGISTRY: gladospipeline
IMAGE_NAME: glados-backend

jobs:
backend_push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
ref: development

- name: Log in to Docker Hub
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: ./apps/backend
file: ./apps/backend/backend.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: "index.docker.io/${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

2 changes: 1 addition & 1 deletion .github/workflows/publish-backend-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Backend Docker image
name: Publish Production Backend Docker image

on:
push:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/publish-frontend-docker-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Dev Frontend Docker image

on:
push:
branches: ['development']

env:
REGISTRY: gladospipeline
IMAGE_NAME: glados-frontend

jobs:
frontend_push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
ref: development

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v3
with:
context: ./apps/frontend
file: ./apps/frontend/frontend.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: "index.docker.io/${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

2 changes: 1 addition & 1 deletion .github/workflows/publish-frontend-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Frontend Docker image
name: Publish Production Frontend Docker image

on:
push:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/publish-runner-docker-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Dev Runner Docker image

on:
push:
branches: ['development']

env:
REGISTRY: gladospipeline
IMAGE_NAME: glados-runner

jobs:
runner_push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
ref: development

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v3
with:
context: ./apps/runner
file: ./apps/runner/runner.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: "index.docker.io/${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

2 changes: 1 addition & 1 deletion .github/workflows/publish-runner-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Runner Docker image
name: Publish Production Runner Docker image

on:
push:
Expand Down
37 changes: 26 additions & 11 deletions apps/backend/.pylintrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# pylint python linter configuration
# .pylintrc configuration for Pylint 3.2.7

[MASTER]
extension-pkg-whitelist=pydantic # stop "No name 'BaseModel' in module 'pydantic'" https://github.com/pydantic/pydantic/issues/1961#issuecomment-759522422
extension-pkg-allow-list=pydantic # Updated from 'extension-pkg-whitelist'
disable=
C0301, # line too long
C0114, # missing-module-docstring
C0116, # missing-function-docstring
C0115, # missing-class-docstring
C0103, # we chose to use camel case to be consistent with our frontend code
W1203, # we want to use fstrings for log message readability, the performance cost is not significant enough for us to care. but, don't turn off W1201 because if the dev wants to use % syntax, they should use lazy logging since the syntax readability is equivalent

# Load our own custom plugins
C0301, # line too long
C0114, # missing-module-docstring
C0116, # missing-function-docstring
C0115, # missing-class-docstring
C0103, # variable name doesn't conform to snake_case (using camelCase instead)
W1203, # f-string used for logging
W1201, # enable lazy logging format for % operator usage, prevents f-strings from being confused

# To load custom plugins, enable this line and include the plugin name below
; load-plugins=
; linters.no_print
; linters.no_print

# Updated init-hook to avoid 'find_pylintrc' import
init-hook="import os, sys; sys.path.append(os.path.abspath(os.path.dirname(__file__)))"

# Additional optional settings for consistency or improved readability
[REPORTS]
output-format=colorized

[FORMAT]
# Maximum allowed line length
max-line-length=100

# Set indentation size for better formatting
indent-string=' '
2 changes: 2 additions & 0 deletions apps/backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ requests = "*"
kubernetes = "*"
flask-cors = "*"
pytest-cov = "*"
pymongo = "*"
pylint = "*"

[dev-packages]
# libmagic dlls for windows hosts https://pypi.org/project/python-magic/ (when missing, vague errors and it crashes)
Expand Down
Loading

0 comments on commit f8d19e8

Please sign in to comment.