Skip to content

Commit

Permalink
Merge pull request #47 from alliance-genome/API-deployment-KANBAN-558
Browse files Browse the repository at this point in the history
Refactored API image repo CDK stack KANBAN-558
  • Loading branch information
mluypaert authored May 15, 2024
2 parents e950a90 + 4200e32 commit 4ef62c7
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 29 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/PR-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: CDK resource assertions (unit tests)
run: |
make run-unit-tests
- name: Python typing test
run: |
make run-python-type-check
Expand All @@ -428,4 +425,4 @@ jobs:
role-session-name: gh-actions-${{github.run_id}}.${{github.run_number}}.${{github.run_attempt}}-cdk-test
aws-region: us-east-1
- name: Validate production CDK stack code
run: cdk diff PaviApiCdkStack
run: make validate
8 changes: 4 additions & 4 deletions .github/workflows/main-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
run: make validate
- name: cdk deploy
run: cdk deploy PaviPipelineCdkStack --require-approval never
api-deploy-aws-infra:
name: Deploy/update AWS infrastructure for API
api-deploy-image-repo:
name: Deploy/update container image repository stack for API
needs: [on-merge-and-deploy]
permissions:
id-token: write # This is required for requesting the JWT for gaining permissions to assume the IAM role to perform AWS actions
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: CDK validations (resource assertions and cdk diff)
run: make validate
- name: cdk deploy
run: cdk deploy PaviApiCdkStack --require-approval never
run: cdk deploy PaviApiImageRepoCdkStack --require-approval never
pipeline-seq-retrieval-build-and-push-docker-image:
needs: [on-merge-and-deploy, pipeline-deploy-aws-infra]
permissions:
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
${{ steps.login-ecr.outputs.registry }}/agr_pavi/pipeline_alignment:${{ github.event.pull_request.base.ref }}
platforms: linux/amd64
api-build-and-push-docker-image:
needs: [on-merge-and-deploy, api-deploy-aws-infra]
needs: [on-merge-and-deploy, api-deploy-image-repo]
permissions:
id-token: write # This is required for requesting the JWT for gaining permissions to assume the IAM role to perform AWS actions
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion api/aws_infra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ run-python-style-check: python-dependencies python-test-dependencies

validate: check-node run-unit-tests
# Validate production stack code
cdk diff PaviApiCdkStack
cdk diff PaviApiImageRepoCdkStack

validate-dev: check-venv-active validate
@:
12 changes: 6 additions & 6 deletions api/aws_infra/cdk_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
from sys import path as sys_path

from cdk_classes.cdk_infra_stack import CdkInfraStack
from cdk_classes.cdk_image_repo_stack import CdkImageRepoStack

repo_root_path = Path(__file__).parent.parent.parent.parent
sys_path.append(str(repo_root_path))
Expand All @@ -13,11 +13,11 @@


app = App()
CdkInfraStack(app, "PaviApiCdkStack",
env=agr_aws_environment)
CdkImageRepoStack(app, "PaviApiImageRepoCdkStack",
env=agr_aws_environment)

CdkInfraStack(app, "PaviApiCdkStack-dev", env_suffix="dev",
shared_api_image_repo='agr_pavi/api',
env=agr_aws_environment)
CdkImageRepoStack(app, "PaviApiImageRepoCdkStack-dev", env_suffix="dev",
shared_api_image_repo='agr_pavi/api',
env=agr_aws_environment)

app.synth()
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from shared_aws_infra.shared_cdk_classes.pavi_ecr_repo import PaviEcrRepository # noqa: E402


class CdkInfraStack(Stack):
class CdkImageRepoStack(Stack):

api_ecr_repo: ecr.Repository | ecr.IRepository

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from aws_cdk.aws_config import ResourceType
import aws_cdk.assertions as assertions

from cdk_classes.cdk_infra_stack import CdkInfraStack
from cdk_classes.cdk_image_repo_stack import CdkImageRepoStack

from pathlib import Path
from sys import path as sys_path
Expand All @@ -19,7 +19,7 @@
from shared_aws_infra.agr_aws_env import agr_aws_environment # noqa: E402

app = App()
stack = CdkInfraStack(app, "pytest-stack", env=agr_aws_environment)
stack = CdkImageRepoStack(app, "pytest-stack", env=agr_aws_environment)
template = assertions.Template.from_stack(stack)


Expand Down
6 changes: 0 additions & 6 deletions api/pyproject.toml

This file was deleted.

5 changes: 5 additions & 0 deletions api/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
addopts =
--import-mode=importlib
--ignore=aws_infra
pythonpath = src
5 changes: 0 additions & 5 deletions pipeline/seq_retrieval/pyproject.toml

This file was deleted.

4 changes: 4 additions & 0 deletions pipeline/seq_retrieval/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
addopts =
--import-mode=importlib
pythonpath = src
6 changes: 6 additions & 0 deletions shared_aws_infra/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
ignore = E266, E501, W503
max-complexity = 18
select = B,C,E,F,W,T4
exclude = venv,node_modules
per-file-ignores = __init__.py:F401

0 comments on commit 4ef62c7

Please sign in to comment.