Skip to content

Commit 4587b80

Browse files
authored
Merge branch 'dev' into feature/APS-3966-sdx
2 parents 846d1b2 + a724bbb commit 4587b80

File tree

77 files changed

+5241
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5241
-422
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ jobs:
280280
steps:
281281
- uses: actions/checkout@v4
282282
with:
283-
fetch-depth: 2
283+
fetch-depth: 2
284284
- name: Check if build needed
285285
id: check
286286
run: |

.github/workflows/master.yml

Lines changed: 64 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ jobs:
6565
poetry run coverage run --branch -m pytest -s -v
6666
poetry run coverage xml
6767
68+
- uses: actions/setup-python@v6
69+
with:
70+
python-version: "3.14"
71+
- name: Test coverage for CSIT OAS Validation API
72+
run: |
73+
export PATH=/root/.local/bin:$PATH
74+
sudo apt install -y nodejs npm
75+
sudo npm install -g @stoplight/spectral-cli@6.14.2
76+
cd microservices/csitOasValidationApi
77+
poetry env use python3.14
78+
poetry install --no-root
79+
./checkout-ruleset-tags.sh ruleset_tag_cache || true
80+
export GITHUB_TAG_CACHE_PATH="$(realpath -m ./ruleset_tag_cache)"
81+
poetry run coverage run --branch -m pytest -s -v
82+
poetry run coverage xml
83+
6884
- name: SonarCloud Scan
6985
uses: sonarsource/sonarcloud-github-action@master
7086
env:
@@ -81,54 +97,66 @@ jobs:
8197
echo "Got tag name ${{ steps.release.outputs.tag_name }}"
8298
echo "Got release version ${{ steps.release.outputs.version }}"
8399
84-
- name: Create gwa-api docker image related to the release
85-
uses: docker/build-push-action@v1
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v3
102+
- name: Log in to GitHub Container Registry
103+
uses: docker/login-action@v3
86104
with:
87-
registry: docker.pkg.github.com
88-
username: $GITHUB_ACTOR
105+
registry: ghcr.io
106+
username: ${{ github.actor }}
89107
password: ${{ secrets.GITHUB_TOKEN }}
90-
repository: bcgov/gwa-api/gwa-gateway-api
91-
path: microservices/gatewayApi
92-
dockerfile: microservices/gatewayApi/Dockerfile
108+
logout: false
109+
- name: Create gwa-api docker image related to the release
110+
uses: docker/build-push-action@v5
111+
with:
112+
context: microservices/gatewayApi
113+
file: microservices/gatewayApi/Dockerfile
93114
push: true
94-
tags: ${{ steps.release.outputs.tag_name }}
95-
tag_with_sha: false
115+
tags: ghcr.io/bcgov/gwa-api/gwa-gateway-api:${{ steps.release.outputs.tag_name }}
116+
labels: |
117+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
118+
org.opencontainers.image.revision=${{ github.sha }}
96119
97120
- name: Create gwa-kube-api docker image related to the release
98-
uses: docker/build-push-action@v1
121+
uses: docker/build-push-action@v5
99122
with:
100-
registry: docker.pkg.github.com
101-
username: $GITHUB_ACTOR
102-
password: ${{ secrets.GITHUB_TOKEN }}
103-
repository: bcgov/gwa-api/gwa-kube-api
104-
path: microservices/kubeApi
105-
dockerfile: microservices/kubeApi/Dockerfile
123+
context: microservices/kubeApi
124+
file: microservices/kubeApi/Dockerfile
106125
push: true
107-
tags: ${{ steps.release.outputs.tag_name }}
108-
tag_with_sha: false
126+
tags: ghcr.io/bcgov/gwa-api/gwa-kube-api:${{ steps.release.outputs.tag_name }}
127+
labels: |
128+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
129+
org.opencontainers.image.revision=${{ github.sha }}
109130
110131
- name: Create gwa-scheduler docker image related to the release
111-
uses: docker/build-push-action@v1
132+
uses: docker/build-push-action@v5
112133
with:
113-
registry: docker.pkg.github.com
114-
username: $GITHUB_ACTOR
115-
password: ${{ secrets.GITHUB_TOKEN }}
116-
repository: bcgov/gwa-api/gwa-scheduler
117-
path: microservices/gatewayJobScheduler
118-
dockerfile: microservices/gatewayJobScheduler/Dockerfile
134+
context: microservices/gatewayJobScheduler
135+
file: microservices/gatewayJobScheduler/Dockerfile
119136
push: true
120-
tags: ${{ steps.release.outputs.tag_name }}
121-
tag_with_sha: false
137+
tags: ghcr.io/bcgov/gwa-api/gwa-scheduler:${{ steps.release.outputs.tag_name }}
138+
labels: |
139+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
140+
org.opencontainers.image.revision=${{ github.sha }}
122141
123142
- name: Create gwa-compatibility-api docker image related to the release
124-
uses: docker/build-push-action@v1
143+
uses: docker/build-push-action@v5
125144
with:
126-
registry: docker.pkg.github.com
127-
username: $GITHUB_ACTOR
128-
password: ${{ secrets.GITHUB_TOKEN }}
129-
repository: bcgov/gwa-api/gwa-compatibility-api
130-
path: microservices/compatibilityApi
131-
dockerfile: microservices/compatibilityApi/Dockerfile
145+
context: microservices/compatibilityApi
146+
file: microservices/compatibilityApi/Dockerfile
147+
push: true
148+
tags: ghcr.io/bcgov/gwa-api/gwa-compatibility-api:${{ steps.release.outputs.tag_name }}
149+
labels: |
150+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
151+
org.opencontainers.image.revision=${{ github.sha }}
152+
153+
- name: Create gwa-csit-oas-validation-api docker image related to the release
154+
uses: docker/build-push-action@v5
155+
with:
156+
context: microservices/csitOasValidationApi
157+
file: microservices/csitOasValidationApi/Dockerfile
132158
push: true
133-
tags: ${{ steps.release.outputs.tag_name }}
134-
tag_with_sha: false
159+
tags: ghcr.io/bcgov/gwa-api/gwa-csit-oas-validation-api:${{ steps.release.outputs.tag_name }}
160+
labels: |
161+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
162+
org.opencontainers.image.revision=${{ github.sha }}

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14.0
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
ruleset_tag_cache/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
.python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# pytype static type analyzer
136+
.pytype/
137+
138+
# Cython debug symbols
139+
cython_debug/
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# BUILD STAGE
2+
FROM python:3.14.2-alpine3.23 AS builder
3+
4+
WORKDIR /build
5+
6+
# Install build dependencies
7+
RUN apk add --no-cache build-base libffi-dev openssl curl git bash nodejs npm
8+
9+
RUN python -m pip install --upgrade pip
10+
11+
# Install Spectral CLI (required for validation)
12+
RUN npm install -g @stoplight/spectral-cli@6.14.2
13+
14+
# Install Poetry
15+
RUN cd /tmp && \
16+
curl -sSL https://install.python-poetry.org > get-poetry.py && \
17+
POETRY_HOME=/opt/poetry python get-poetry.py --version 1.8.2 && \
18+
cd /usr/local/bin && \
19+
ln -s /opt/poetry/bin/poetry && \
20+
poetry config virtualenvs.create false
21+
22+
# Install Python dependencies
23+
COPY pyproject.toml /tmp/
24+
COPY poetry.lock /tmp/
25+
RUN cd /tmp && poetry install --no-root --no-dev
26+
27+
# Retrieve and cache the ruleset
28+
COPY checkout-ruleset-tags.sh /build/
29+
RUN chmod +x /build/checkout-ruleset-tags.sh && \
30+
mkdir -p /build/ruleset_tag_cache && \
31+
/build/checkout-ruleset-tags.sh /build/ruleset_tag_cache
32+
33+
# RUNTIME STAGE
34+
FROM python:3.14.2-alpine3.23
35+
36+
WORKDIR /app
37+
38+
# Install only runtime dependencies
39+
# nodejs is needed for Spectral CLI to run
40+
RUN apk add --no-cache libffi openssl nodejs
41+
42+
# Copy Python packages from builder
43+
COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
44+
45+
# Copy Python entry point scripts (uvicorn, etc.) but exclude build tools
46+
# First, copy all scripts, then we'll remove poetry if it exists
47+
COPY --from=builder /usr/local/bin /usr/local/bin
48+
RUN rm -f /usr/local/bin/poetry 2>/dev/null || true
49+
50+
# Copy Spectral CLI from builder
51+
COPY --from=builder /usr/local/lib/node_modules /usr/local/lib/node_modules
52+
COPY --from=builder /usr/local/bin/spectral /usr/local/bin/spectral
53+
54+
# Copy ruleset cache from builder
55+
COPY --from=builder /build/ruleset_tag_cache /app/ruleset_tag_cache
56+
57+
# Copy application code
58+
COPY . /app
59+
60+
RUN chmod +x /app/entrypoint.sh
61+
62+
ENV GITHUB_TAG_CACHE_PATH=/app/ruleset_tag_cache
63+
64+
EXPOSE 8080
65+
66+
ENTRYPOINT ["./entrypoint.sh"]

0 commit comments

Comments
 (0)