Skip to content

Commit

Permalink
Merge pull request #5 from NOAA-GSL/proxy-accepts-new-profiles
Browse files Browse the repository at this point in the history
feat: ims-service accepts new profiles
  • Loading branch information
mackenzie-grimes-noaa authored Dec 30, 2024
2 parents 2d4e99f + ecf31a0 commit 022c6fd
Show file tree
Hide file tree
Showing 21 changed files with 915 additions and 188 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-package-mock-ims.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Package the Mock IMS Service to Dev Registry
name: Build and Package the NWSC Proxy Service to Dev Registry
on:
push:
branches: [ main ]
Expand All @@ -11,7 +11,7 @@ jobs:
fail-fast: true
matrix:
app:
- mockims
- proxy
steps:

- name: Login to GitHub Container Registry
Expand All @@ -20,7 +20,7 @@ jobs:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: pull
run: |
docker pull ghcr.io/noaa-gsl/idss/commons/python/python-base:main
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
--build-arg COMMITBRANCH=${{env.BRANCH}} \
--build-arg COMMITSHA=${{github.sha}} \
-t ${{env.DEV_REGISTRY}}/${{env.APP_LOWERCASE}}:${{env.BRANCH}} \
-f ./docker/mockims/dev/Dockerfile .
-f ./docker/nwsc_proxy/dev/Dockerfile .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ jobs:
- name: Run code linter
run: pylint ./python/idsse/testing --max-line-length=120 --recursive true

- name: Set PYTHONPATH for proxy service
run: |
echo "PYTHONPATH=python/nwsc_proxy" >> $GITHUB_ENV
- name: Run code linter for proxy service
run: pylint ./python/nwsc_proxy --max-line-length=120 --recursive true
56 changes: 56 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Run Pytest

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
strategy:
matrix:
python-version: [ "3.11" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov pylint==2.17.5 python-dateutil==2.8.2 flask==2.3.2
- name: Checkout idss-engine-commons
uses: actions/checkout@v2
with:
repository: NOAA-GSL/idss-engine-commons
ref: main
path: commons/

- name: Install IDSSE python commons
working-directory: commons/python/idsse_common
run: pip install .

- name: Set PYTHONPATH for pytest
run: |
echo "PYTHONPATH=python/nwsc_proxy" >> $GITHUB_ENV
- name: Test pytest
working-directory: python/nwsc_proxy/test
run: |
set -o pipefail; # exit immediately if pytest fails (tee obfuscates the exit code)
pytest --cov=.. --cov-report=term --junitxml=./pytest.xml | tee ./coverage.txt;
- name: Pytest coverage comment
if: ${{ github.ref == 'refs/heads/main' }}
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
hide-comment: true
badge-title: Coverage
title: Report
pytest-coverage-path: python/nwsc_proxy/test/coverage.txt
23 changes: 0 additions & 23 deletions docker/mockims/local/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IMS Gateway Request Service using python commons base image
# NWSC Proxy Service using python commons base image
FROM ghcr.io/noaa-gsl/idss/commons/python/python-base:main

ARG maintainer
Expand All @@ -8,17 +8,18 @@ LABEL maintainer ${maintainer}
#RUN conda config --add channels conda-forge && \
# conda install -y flask=2.3.2

WORKDIR /python/ims_service
WORKDIR /python/nwsc_proxy

# Copy source files
COPY ./python/idsse/testing/ims_service/src/ims_service.py /python/ims_service/
COPY ./python/nwsc_proxy/*.py /python/nwsc_proxy/
COPY ./python/nwsc_proxy/src/*.py /python/nwsc_proxy/src/

# (TEMPORARY) Copy canned criteria files. To be removed when integration with IMS API exists
COPY ./python/idsse/testing/ims_service/profiles/*.json /python/profiles/
# (TEMPORARY) Copy canned criteria files. To be removed when integration with NWS Connect API exists
COPY ./python/nwsc_proxy/src/profiles/*.json /python/profiles/

# The volume mapping here is kind of strange for k8s deployment, because if we map an empty volume to /criteria
# then the temp copy of json above will get blown away by the volume mapping...just omit it for k8s deployment
# for now.
#VOLUME /python/profiles

ENTRYPOINT [ "python3", "/python/ims_service/ims_service.py" ]
ENTRYPOINT [ "python3", "/python/nwsc_proxy/ncp_web_service.py", "--base_dir", "/python/profiles"]
25 changes: 25 additions & 0 deletions docker/nwsc_proxy/local/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# NWSC Proxy Service using python commons base image
FROM idss.engine.commons.python-base:local

ARG maintainer
LABEL maintainer ${maintainer}

# Install additional dependencies
#RUN conda config --add channels conda-forge && \
# conda install -y flask=2.3.2

WORKDIR /python/nwsc_proxy

# Copy source files
COPY ./python/nwsc_proxy/*.py /python/nwsc_proxy/
COPY ./python/nwsc_proxy/src/*.py /python/nwsc_proxy/src/

# (TEMPORARY) Copy canned criteria files. To be removed when integration with NWS Connect API exists
COPY ./python/nwsc_proxy/src/profiles/*.json /python/profiles/

# The volume mapping here is kind of strange for k8s deployment, because if we map an empty volume to /criteria
# then the temp copy of json above will get blown away by the volume mapping...just omit it for k8s deployment
# for now.
#VOLUME /python/profiles

ENTRYPOINT [ "python3", "/python/nwsc_proxy/ncp_web_service.py", "--base_dir", "/python/profiles"]
77 changes: 0 additions & 77 deletions python/idsse/testing/ims_service/README.md

This file was deleted.

77 changes: 0 additions & 77 deletions python/idsse/testing/ims_service/src/ims_service.py

This file was deleted.

Loading

0 comments on commit 022c6fd

Please sign in to comment.