Skip to content

Commit f7a8902

Browse files
authored
Merge pull request #65 from MeteoSwiss-APN/feature/DT-196-integrate-gitops-pipeline
DT-196 Integrate GitOps pipeline
2 parents 042ae51 + 7a56b3d commit f7a8902

16 files changed

Lines changed: 172 additions & 415 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,7 @@ venv_*/
115115
poetry.toml
116116

117117
# Conda environment for local CSCS development
118-
.conda-env
118+
.conda-env
119+
120+
.idea
121+
test-data

.mch-ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
default:
2+
- build:
3+
- checkGivenSemanticVersion:
4+
checkSemanticVersion:
5+
- getSemanticVersion:
6+
gitCalculateSemanticVersion:
7+
- getImageName:
8+
containerConstructImageName:
9+
- imageTester:
10+
containerBuildImage:
11+
fullImageName: ${var.image}-tester
12+
target: tester
13+
extraArgs:
14+
- --build-arg
15+
- VERSION=${var.version}
16+
- imageAwsRunner:
17+
containerBuildImage:
18+
fullImageName: ${var.image}
19+
target: runner
20+
extraArgs:
21+
- --build-arg
22+
- VERSION=${var.version}
23+
pullAlways: false
24+
- test:
25+
- unit:
26+
- script: mkdir -p test_reports
27+
- pythonTest:
28+
fullImageName: ${var.image}-tester
29+
testDirectory: tests
30+
packageManager: ''
31+
pullAlways: false
32+
- pythonCoverage:
33+
fullImageName: ${var.image}-tester
34+
packageManager: ''
35+
pullAlways: false
36+
- lint:
37+
- script: mkdir -p test_reports
38+
- pythonLint:
39+
fullImageName: ${var.image}-tester
40+
packageManager: ''
41+
pullAlways: false
42+
- pythonTypeChecker:
43+
fullImageName: ${var.image}-tester
44+
packageManager: ''
45+
pullAlways: false
46+
- publish:
47+
- image:
48+
containerPublishImage:
49+
- clean:
50+
- images:
51+
script: |
52+
if test -n "${var.version}"; then
53+
podman image rm -f $(podman image ls -q \
54+
-f "label=ch.meteoswiss.project=${var.project}-${var.version}") || :
55+
fi
56+
57+
variables:
58+
project: pyflexplot
59+
# default full image name, useful when running tasks locally
60+
image: ${var.containerImageName}:${var.version}
61+
solution: dispersionmodelling
62+
notifyOnNightlyFailure: p_dispersionmodelling@meteoswiss.ch

Dockerfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM dockerhub.apps.cp.meteoswiss.ch/mch/python-3.10 AS builder
2+
ARG VERSION
3+
LABEL ch.meteoswiss.project=pyflexplot-${VERSION}
24

35
COPY poetry.lock /src/app-root/
46
COPY pyproject.toml /src/app-root/
@@ -9,10 +11,12 @@ RUN cd /src/app-root \
911
# we need to build the wheel in order to install the binary python \
1012
# package that uses click to parse the command arguments
1113
&& poetry build --format wheel \
12-
&& poetry export --without-hashes -o requirements.txt \
13-
&& poetry export --without-hashes --dev -o requirements_dev.txt
14+
&& poetry export -o requirements.txt \
15+
&& poetry export --dev -o requirements_dev.txt
1416

1517
FROM dockerhub.apps.cp.meteoswiss.ch/mch/python-3.10:latest-slim AS base
18+
ARG VERSION
19+
LABEL ch.meteoswiss.project=pyflexplot-${VERSION}
1620

1721
COPY --from=builder /src/app-root/dist/*.whl /src/app-root/
1822
COPY --from=builder /src/app-root/requirements.txt /src/app-root/
@@ -24,24 +28,18 @@ RUN pip install -r /src/app-root/requirements.txt \
2428
WORKDIR /src/app-root
2529

2630
FROM base AS runner
31+
ARG VERSION
32+
LABEL ch.meteoswiss.project=pyflexplot-${VERSION}
2733

2834
RUN mkdir /src/app-root/data /src/app-root/output
2935

30-
ENV HTTPS_PROXY=\
31-
HTTP_PROXY=\
32-
http_proxy=\
33-
https_proxy=\
34-
NO_PROXY=\
35-
no_proxy=
36-
3736
ENTRYPOINT ["pyflexplot"]
3837

3938
FROM base AS tester
39+
ARG VERSION
40+
LABEL ch.meteoswiss.project=pyflexplot-${VERSION}
4041

4142
COPY --from=builder /src/app-root/requirements_dev.txt /src/app-root/requirements_dev.txt
4243
RUN pip install -r /src/app-root/requirements_dev.txt
4344

4445
COPY tests /src/app-root/tests
45-
COPY pyproject.toml test_ci.sh /src/app-root/
46-
47-
CMD ["/bin/bash", "-c", "source /src/app-root/test_ci.sh && run_ci_tools"]

0 commit comments

Comments
 (0)