Skip to content

Commit

Permalink
Merge pull request #592 from NBISweden/test-prodtoprod
Browse files Browse the repository at this point in the history
Test prod to production
  • Loading branch information
jhagberg authored Dec 28, 2022
2 parents 9187866 + 8e91691 commit 45e573e
Show file tree
Hide file tree
Showing 44 changed files with 2,436 additions and 1,894 deletions.
60 changes: 33 additions & 27 deletions .github/workflows/create_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:


jobs:
main:
runs-on: ubuntu-latest
Expand All @@ -12,36 +11,43 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Update tags.json version
uses: jossef/[email protected]
with:
file: frontend/src/tags.json
field: gitBranch
value: ${{github.ref_name}}

- name: Build container
env:
GHCR_PAT: ${{ secrets.GHCR_PAT }}
GHCR_USER: ${{ secrets.GHCR_USER }}
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
run: |
echo "${GHCR_PAT}" | docker login ghcr.io -u "${GHCR_USER}" --password-stdin
branch=${GITHUB_REF##*/}
for image in herdbook_r-api herdbook_main herdbook_frontend; do
docker pull "ghcr.io/nbisweden/$image:latest" || true
docker pull "ghcr.io/nbisweden/$image:$branch" || true
done
for p in .docker/*.default ; do
mv "$p" "${p%.default}"
done
docker-compose build --build-arg BUILDKIT_INLINE_CACHE=1 herdbook-frontend main;
for image in herdbook_main herdbook_frontend; do
docker tag "$image:latest" "ghcr.io/nbisweden/$image:$branch"
docker push "ghcr.io/nbisweden/$image:$branch"
for mb in main master develop; do
if [ "$mb" = "$branch" ]; then
docker tag "$image:latest" "ghcr.io/nbisweden/$image:latest"
docker push "ghcr.io/nbisweden/$image:latest"
fi
done
done
echo "${GHCR_PAT}" | docker login ghcr.io -u "${GHCR_USER}" --password-stdin
branch=${GITHUB_REF##*/}
for image in herdbook_r-api herdbook_main herdbook_frontend; do
docker pull "ghcr.io/nbisweden/$image:latest" || true
docker pull "ghcr.io/nbisweden/$image:$branch" || true
done
for p in .docker/*.default ; do
mv "$p" "${p%.default}"
done
docker-compose build --build-arg BUILDKIT_INLINE_CACHE=1 herdbook-frontend main
for image in herdbook_main herdbook_frontend; do
docker tag "$image:latest" "ghcr.io/nbisweden/$image:$branch"
docker push "ghcr.io/nbisweden/$image:$branch"
for mb in main master develop; do
if [ "$mb" = "$branch" ]; then
docker tag "$image:latest" "ghcr.io/nbisweden/$image:latest"
docker push "ghcr.io/nbisweden/$image:latest"
fi
done
done
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
Expand All @@ -48,7 +48,7 @@ jobs:
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@v4
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: develop
Expand Down
58 changes: 29 additions & 29 deletions app/certs/ca.pem
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIUAZwziZfdf2Oepv1HxyI31XvIkzgwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMTA5MjQxMzM0NThaFw0yMjA5
MjQxMzM0NThaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCw54qjDfh+0T8CXNq5Yy83+swhBWfQ6Xajgh22psD4
DE5mtFTi5cbxHrDOxKqCIg8VLJ6qnZGcs/zkEFsafk3MBFzSMCH1biTW8j28khVl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5hktg7zKKxQxxjvZvcJkoE35zqGQUBlHltfzSsYtGHqWSIO6dsRX9YEx
o0aDVImytw==
-----END CERTIFICATE-----
100 changes: 50 additions & 50 deletions app/certs/key.pem
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCw54qjDfh+0T8C
XNq5Yy83+swhBWfQ6Xajgh22psD4DE5mtFTi5cbxHrDOxKqCIg8VLJ6qnZGcs/zk
EFsafk3MBFzSMCH1biTW8j28khVlNlAf2gk8J4+OagDfrVTy7NHAOii7hMwE78JL
4kpqFRadAwyZ4/9606Bl5usijANfpQfiVHq117z2QzseeHgI4bCcKtkvKTlCAVMv
e9tqPjY14Zh+5/6X0EE7+rKgfd4i4HnPUM4y0DOMDanAFgxqyuoeGYIFEALl79RT
LA5IkXGDJFFBoO7pDfXYUAWu73XdF5dPL6LXa5et5wRKB28Rgt1CuOHg2HWiqHVK
3YCZ5z9JmPZ81cB2zJv+9VxOk5jr2MHokoy4/ZCx2fBP5evSNsfQCtsnnH92IM6D
7VdD7zF+x+ghRguxt04N2QbRAD9mjtiMAIRbDZA1rtqVAimI8Ltcp+hgkuQUsacF
1uaYEbtQJ10T3CV+weenBHo3o9Jv7F3PUcJx93K3Jo1A0Tp30crE0PWWF2Q8loyq
20tvFJnuJ/hN1xbnUwVneKwhAb3LAowKSjXDRRPR9hMSHm9wPqiO3P9YbLZE5Vdu
Y4mkk1hxK27go58xFa7hccZvuyYpPND1TvXJRBHHS7phqKO+17eoBGQT/858CKre
OHajDafoDmww9QJL8sv4Lr2VrmLfdwIDAQABAoICAEC1MPzbi1235DhVBpxxL0Bm
uGwLsiG0g/TjD0NUU5lnxvXCWJp2OgLQmxPG1CetlZ7FJ3R5Fl4faA1z/h7+vC44
Gku313QSyd7l1Lc5KCJRb5V3B5G9VsFc/NzUZhJFlaOeom+U75uOp59iMp4DALaF
+wH/Z9/hs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sAKIyNkatpMfmS7AYzyXH8VL4WQd
sVL5gyfUHlm7sjPeHWgpWheAmlPwpSEV6MUPWH3Ekfx1apBaxnmzNCv7hHbBz9hJ
cNnPFbL3C3vCtL3/qAPV0h8tBbwJuDE=
-----END PRIVATE KEY-----
Binary file modified app/herdbook
Binary file not shown.
9 changes: 7 additions & 2 deletions app/herdbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def herd_breeding_list(h_id):
exact birth date if it exists.
"""
breedings = da.get_breeding_events_with_ind(h_id, session.get("user_id", None))

if request.method == "POST":
form = request.json
birth_date = da.validate_date(form.get("birth_date", None))
Expand All @@ -316,13 +317,17 @@ def herd_breeding_list(h_id):
and (
start
<= (
da.validate_date(item["birth_date"])
da.validate_date(item.get("birth_date"))
- datetime.timedelta(days=30)
if item.get("breed_date") is None
else da.validate_date(item.get("breed_date"))
)
<= end
or da.validate_date(item["birth_date"]) == birth_date
or (
da.validate_date(item.get("birth_date")) == birth_date
if item.get("birth_date") is not None
else None
)
)
),
None,
Expand Down
1 change: 1 addition & 0 deletions app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ endesive==2.0.9
boto3==1.17.54
moto==2.0.8
google-auth
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
41 changes: 40 additions & 1 deletion app/utils/data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,26 @@ def form_to_individual(form, user=None):
else:
if not form.get("new_individual", False):
if getattr(individual, key) != form[key]:
# Reset if switching from paper to digital certificate or vice versa
if (
key == "digital_certificate"
and getattr(individual, "certificate") is not None
):
update_logger.info(
f"{user.username},{individual.number},"
f"certificate,{getattr(individual,'certificate')},'None',"
)
setattr(individual, "certificate", None)

if (
key == "certificate"
and getattr(individual, "digital_certificate") is not None
):
update_logger.info(
f"{user.username},{individual.number},"
f"digital_certificate,{getattr(individual,'digital_certificate')},'None',"
)
setattr(individual, "digital_certificate", None)
update_logger.info(
f"{user.username},{individual.number},{key},{getattr(individual,key)},{form[key]},"
)
Expand Down Expand Up @@ -894,14 +914,33 @@ def add_individual(form, user_uuid):
return {"status": "error", "message": "Forbidden"}

if form.get("number", None) is None and "breeding" in form:
form["number"] = next_individual_number(
nextind = next_individual_number(
herd=form["herd"],
birth_date=form["birth_date"],
breeding_event=form["breeding"],
)
logger.error(f"nextind is ${nextind}")
if nextind.get("status", None) == "success":
form["number"] = nextind["number"]
else:
logger.error(f"Next in is not successfull: ${nextind.get('message')}")
return {
"status": "error",
"message": f"kan inte hämta nästa individ nummer: ${nextind.get('message')}",
}

if Individual.select().where(Individual.number == form["number"]).exists():
return {"status": "error", "message": "Individual number already exists"}
if form.get("certificate", None) is not None:
if (
Individual.select()
.where(Individual.certificate == form["certificate"])
.exists()
):
return {
"status": "error",
"message": "Individual certificate already exists",
}

birth_date = form.get("birth_date", None)
if birth_date is None:
Expand Down
Loading

0 comments on commit 45e573e

Please sign in to comment.