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

feat: ims-service accepts new profiles #5

Merged
merged 25 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
34f8560
add proxy_web_service, event_store to ims_service
mackenzie-grimes-noaa Dec 18, 2024
2d6e4ff
bug fixes with filenaming, writing json, health endpoint
mackenzie-grimes-noaa Dec 18, 2024
424833f
rename EventStore to ProfileStore
mackenzie-grimes-noaa Dec 18, 2024
fad680e
delete unnecessary private methods
mackenzie-grimes-noaa Dec 18, 2024
a644bfb
move ims_service dir to nwsc_dummy_service
mackenzie-grimes-noaa Dec 18, 2024
f39cd5e
load IMS responses as individual support profiles on startup, NamedTu…
mackenzie-grimes-noaa Dec 18, 2024
c72c42a
add .id attribute to CachedProfile
mackenzie-grimes-noaa Dec 18, 2024
4b73ec5
drop ims_service from setup.py, update docker/local/Dockerfile
mackenzie-grimes-noaa Dec 18, 2024
caa722c
add test_profile_store unit tests
mackenzie-grimes-noaa Dec 18, 2024
7fd21ac
rename nwsc_dummy_web_service to ncd_web_service
mackenzie-grimes-noaa Dec 18, 2024
7049977
Add unit test GitHub Action, add dummy service to linter
mackenzie-grimes-noaa Dec 18, 2024
e79aa31
improve test coverage, fix unit test import
mackenzie-grimes-noaa Dec 18, 2024
c2470fe
ignore pylint warning about "id" variable
mackenzie-grimes-noaa Dec 18, 2024
f9a9def
increase test_ncd_web_service.py unit test coverage
mackenzie-grimes-noaa Dec 19, 2024
e97d3f0
add flask to run-tests.yml, linter ignore pytest syntax
mackenzie-grimes-noaa Dec 19, 2024
b23926f
store GSL_KEY in app.config
mackenzie-grimes-noaa Dec 19, 2024
019330e
minor code cleanup
mackenzie-grimes-noaa Dec 19, 2024
889e9e4
allow dataSource 'ANY'
mackenzie-grimes-noaa Dec 19, 2024
0b12e6b
fix Dockerfile
mackenzie-grimes-noaa Dec 19, 2024
175ae71
move docker/mockims to docker/dummyservice
mackenzie-grimes-noaa Dec 19, 2024
a80f35f
update readme.md
mackenzie-grimes-noaa Dec 19, 2024
8ab95f6
hide /test and __init__.py from test coverage
mackenzie-grimes-noaa Dec 19, 2024
1587839
rename service to to nwsc_proxy
mackenzie-grimes-noaa Dec 19, 2024
16b9fa4
rename a couple more "ims" references
mackenzie-grimes-noaa Dec 19, 2024
ecf31a0
Merge branch 'main' into proxy-accepts-new-profiles
mackenzie-grimes-noaa Dec 20, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/build-package-mock-ims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: true
matrix:
app:
- mockims
- dummyservice
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/dummyservice/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 dummy service
run: |
echo "PYTHONPATH=python/nwsc_dummy_service" >> $GITHUB_ENV

- name: Run code linter for dummy service
run: pylint ./python/nwsc_dummy_service --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_dummy_service" >> $GITHUB_ENV

- name: Test pytest
working-directory: python/nwsc_dummy_service/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_dummy_service/test/coverage.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IMS Gateway Request Service using python commons base image
# NWSC Dummy 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_dummy_service

# Copy source files
COPY ./python/idsse/testing/ims_service/src/ims_service.py /python/ims_service/
COPY ./python/nwsc_dummy_service/*.py /python/nwsc_dummy_service/
COPY ./python/nwsc_dummy_service/src/*.py /python/nwsc_dummy_service/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_dummy_service/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_dummy_service/ncd_web_service.py", "--base_dir", "/python/profiles"]
25 changes: 25 additions & 0 deletions docker/dummyservice/local/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# NWSC Dummy 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_dummy_service

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

# (TEMPORARY) Copy canned criteria files. To be removed when integration with NWS Connect API exists
COPY ./python/nwsc_dummy_service/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_dummy_service/ncd_web_service.py", "--base_dir", "/python/profiles"]
23 changes: 0 additions & 23 deletions docker/mockims/local/Dockerfile

This file was deleted.

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
Loading