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

Fix: EOL filtering to only exclude builds with no valid tracks. #272

Merged
merged 41 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ae87140
fix: EOL filtering to only exclude builds with no valid tracks.
clay-lake Oct 21, 2024
beb931a
fix: clean revision data of extra fields
clay-lake Oct 30, 2024
a5e7da1
fix: correct import path
clay-lake Oct 30, 2024
502421a
fix: corrections for relative paths
clay-lake Oct 30, 2024
342a805
fix: serialization of datetime object
clay-lake Oct 30, 2024
6af1751
fix: readded track to revision data json
clay-lake Nov 6, 2024
b20304a
fix: broken import in src/image/merge_release_info.py
clay-lake Nov 8, 2024
c28721b
Merge branch 'main' into fix_eol_filtering
clay-lake Nov 8, 2024
6ce0f03
Merge branch 'main' into fix_eol_filtering
clay-lake Nov 8, 2024
d1b5f67
fix: formatting issues
clay-lake Nov 11, 2024
f341a46
fix: syntax issue in python3.10
clay-lake Nov 11, 2024
8e86560
fix: EOL filtering to only exclude builds with no valid tracks.
clay-lake Oct 21, 2024
7ce59ec
fix: clean revision data of extra fields
clay-lake Oct 30, 2024
fc26de4
fix: correct import path
clay-lake Oct 30, 2024
d647b9d
fix: corrections for relative paths
clay-lake Oct 30, 2024
b761f30
fix: serialization of datetime object
clay-lake Oct 30, 2024
c333e0c
fix: readded track to revision data json
clay-lake Nov 6, 2024
6ba07dd
fix: broken import in src/image/merge_release_info.py
clay-lake Nov 8, 2024
e2b87e4
fix: formatting issues
clay-lake Nov 11, 2024
71c8579
fix: syntax issue in python3.10
clay-lake Nov 11, 2024
4dd7294
Merge branch 'fix_eol_filtering' of https://github.com/canonical/oci-…
clay-lake Nov 11, 2024
deddda5
trigger build
clay-lake Nov 11, 2024
d102dd9
fix: dump revision_data by alias to fix eol field
clay-lake Nov 11, 2024
f30157c
test: added debug statement
clay-lake Nov 11, 2024
d7c12ff
fix(Image.yaml): remove unnecessary revision_file filtering
clay-lake Nov 14, 2024
6ee5fde
fix: update remaining pydantic to 2.8.2
clay-lake Nov 14, 2024
0d7084f
fix(release.py): simplify image_trigger iteration
clay-lake Nov 14, 2024
775b540
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Nov 14, 2024
b0ef739
fix(release.py): typo
clay-lake Nov 14, 2024
a417784
refactor(trigger.py): update for pydantic2
clay-lake Nov 14, 2024
8866ac0
Merge branch 'fix_eol_filtering' of https://github.com/canonical/oci-…
clay-lake Nov 14, 2024
20565af
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Nov 14, 2024
c29f1bf
fix: more updates for pydantic 2
clay-lake Nov 14, 2024
1a3030f
Merge branch 'fix_eol_filtering' of https://github.com/canonical/oci-…
clay-lake Nov 14, 2024
d6a3652
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Nov 14, 2024
1127c90
fix: more updates for pydantic 2
clay-lake Nov 14, 2024
262620f
Merge branch 'fix_eol_filtering' of https://github.com/canonical/oci-…
clay-lake Nov 14, 2024
d62b609
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Nov 14, 2024
4a4439a
Merge branch 'main' into fix_eol_filtering
clay-lake Nov 14, 2024
2b915da
refactor: merge_release_info.py excess print
clay-lake Nov 14, 2024
7dc9685
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Nov 14, 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
20 changes: 4 additions & 16 deletions .github/workflows/Image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
run: |
mkdir ${{ env.DATA_DIR }}

./src/image/prepare_single_image_build_matrix.py \
python3 -m src.image.prepare_single_image_build_matrix \
--oci-path ${{ steps.validate-image.outputs.img-path }} \
--revision-data-dir ${{ env.DATA_DIR }}

Expand All @@ -131,7 +131,6 @@ jobs:
fail-fast: true
matrix: ${{ fromJSON(needs.prepare-build.outputs.build-matrix) }}
steps:

- name: Clone GitHub image repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -254,7 +253,7 @@ jobs:

mkdir ${{ env.DATA_DIR }}

./src/image/prepare_single_image_build_matrix.py \
python3 -m src.image.prepare_single_image_build_matrix \
--oci-path ${{ needs.prepare-build.outputs.oci-img-path }} \
--revision-data-dir ${{ env.DATA_DIR }} \
--next-revision ${{ steps.get-next-revision.outputs.revision }} \
Expand All @@ -278,17 +277,6 @@ jobs:
./src/uploads/swift_lockfile_unlock.sh \
${{ needs.prepare-build.outputs.oci-img-name }}

# The revision files have to be sanitised before merging,
# since the `track` field should not be present.
- name: Sanitise revision files
run: |
set -ex
for revision_file in `ls ${{ env.DATA_DIR }}`
do
jq 'del(.track, .base)' ${{ env.DATA_DIR }}/$revision_file > ${{ env.DATA_DIR }}/$revision_file.tmp
mv ${{ env.DATA_DIR }}/$revision_file.tmp ${{ env.DATA_DIR }}/$revision_file
done

- uses: actions/cache/save@v4
with:
path: ${{ steps.prepare-matrix.outputs.revision-data-dir }}
Expand Down Expand Up @@ -535,7 +523,7 @@ jobs:

echo "Merge revision $revision_file with requested releases"

./src/image/merge_release_info.py \
python3 -m src.image.merge_release_info \
--image-trigger "${{ needs.prepare-build.outputs.oci-img-path }}/image.yaml" \
--revision-data-file "${{ env.REVISION_DATA_DIR }}/${revision_file}"
done
Expand Down Expand Up @@ -640,7 +628,7 @@ jobs:
id: get-summary
run: |
echo '${{ toJson(needs) }}' > jobs.json
./src/notifications/summarize_workflow_results.py --jobs-file jobs.json
python3 -m src.notifications.summarize_workflow_results --jobs-file jobs.json

- name: Get contacts for ${{ needs.prepare-build.outputs.oci-img-name }}
id: get-contacts
Expand Down
32 changes: 16 additions & 16 deletions oci/mock-rock/_releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
"edge": {
"target": "latest_beta"
},
"end-of-life": "2025-05-01T00:00:00Z"
"end-of-life": "2030-05-01T00:00:00Z"
},
"1.0-22.04": {
"candidate": {
"target": "654"
"target": "732"
},
"beta": {
"target": "654"
"target": "732"
},
"edge": {
"target": "654"
"target": "732"
},
"end-of-life": "2025-05-01T00:00:00Z"
"end-of-life": "2030-05-01T00:00:00Z"
},
"test": {
"beta": {
Expand All @@ -30,36 +30,36 @@
"edge": {
"target": "test_beta"
},
"end-of-life": "2025-05-01T00:00:00Z"
"end-of-life": "2030-05-01T00:00:00Z"
},
"1.1-22.04": {
"end-of-life": "2025-05-01T00:00:00Z",
"end-of-life": "2030-05-01T00:00:00Z",
"candidate": {
"target": "677"
"target": "733"
},
"beta": {
"target": "677"
"target": "733"
},
"edge": {
"target": "677"
"target": "733"
}
},
"1-22.04": {
"end-of-life": "2025-05-01T00:00:00Z",
"end-of-life": "2030-05-01T00:00:00Z",
"candidate": {
"target": "677"
"target": "733"
},
"beta": {
"target": "677"
"target": "733"
},
"edge": {
"target": "677"
"target": "733"
}
},
"1.2-22.04": {
"end-of-life": "2025-05-01T00:00:00Z",
"end-of-life": "2030-05-01T00:00:00Z",
"beta": {
"target": "678"
"target": "734"
},
"edge": {
"target": "1.2-22.04_beta"
Expand Down
18 changes: 12 additions & 6 deletions oci/mock-rock/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,41 @@ version: 1

release:
latest:
end-of-life: "2025-05-01T00:00:00Z"
end-of-life: "2030-05-01T00:00:00Z"
candidate: 1.2-22.04_beta
test:
end-of-life: "2025-05-01T00:00:00Z"
end-of-life: "2030-05-01T00:00:00Z"
beta: 1.1-22.04_beta

upload:
- source: "canonical/rocks-toolbox"
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f
directory: mock_rock/1.0
release:
1.0-22.04:
1.0.0-22.04:
end-of-life: "2024-05-01T00:00:00Z"
risks:
- candidate
- edge
- beta
1.0-22.04:
end-of-life: "2030-05-01T00:00:00Z"
risks:
- candidate
- edge
- beta
- source: "canonical/rocks-toolbox"
commit: 17916dd5de270e61a6a3fd3f4661a6413a50fd6f
directory: mock_rock/1.1
release:
1.1-22.04:
end-of-life: "2025-05-01T00:00:00Z"
end-of-life: "2030-05-01T00:00:00Z"
risks:
- candidate
- edge
- beta
1-22.04:
end-of-life: "2025-05-01T00:00:00Z"
end-of-life: "2030-05-01T00:00:00Z"
risks:
- candidate
- edge
Expand All @@ -40,6 +46,6 @@ upload:
directory: mock_rock/1.2
release:
1.2-22.04:
end-of-life: "2025-05-01T00:00:00Z"
end-of-life: "2030-05-01T00:00:00Z"
risks:
- beta
3 changes: 2 additions & 1 deletion src/docs/generate_oci_doc_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This module contains functions for generating documentation
for OCI images within the oci-factory
"""

import argparse
import base64
import json
Expand Down Expand Up @@ -279,7 +280,7 @@ def read_documentation_yaml(doc_file: str) -> Dict:
try:
base_doc_data = DocSchema(
**yaml.load(file, Loader=yaml.BaseLoader) or {}
).dict(exclude_none=True)
).model_dump(exclude_none=True)
except (yaml.YAMLError, pydantic.ValidationError) as exc:
msg = f"Error loading the {doc_file} file"
raise Exception(msg) from exc
Expand Down
2 changes: 1 addition & 1 deletion src/docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
boto3
pyyaml
pydantic==1.9.0
pydantic==2.8.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pydantic==2.8.2
pydantic==2.8.2

66 changes: 21 additions & 45 deletions src/docs/schema/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

from typing import Optional
from pydantic import BaseModel, Extra, constr, conlist
from pydantic import BaseModel, constr, conlist, ConfigDict


class ConfigMapFile(BaseModel):
Expand All @@ -14,22 +14,16 @@ class ConfigMapFile(BaseModel):
name: str
link: str

class Config:
"""permit to not accept extra parameters"""

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class Microk8sConfigMap(BaseModel):
"""Schema of the microk8s[configmap] section."""

name: Optional[str]
files: conlist(item_type=ConfigMapFile, min_items=1)

class Config:
"""permit to not accept extra parameters"""
name: Optional[str] = None
files: conlist(item_type=ConfigMapFile, min_length=1)

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class Microk8sDeploy(BaseModel):
Expand All @@ -38,34 +32,25 @@ class Microk8sDeploy(BaseModel):
link: str
access: str

class Config:
"""permit to not accept extra parameters"""

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class Microk8sInfo(BaseModel):
"""Schema of the microk8s section."""

configmap: Optional[Microk8sConfigMap]
configmap: Optional[Microk8sConfigMap] = None
deploy: Microk8sDeploy

class Config:
"""permit to not accept extra parameters"""

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class DockerRunParameters(BaseModel):
"""Schema of the docker section."""

parameters: conlist(item_type=str, min_items=1)
access: Optional[str]

class Config:
"""permit to not accept extra parameters"""
parameters: conlist(item_type=str, min_length=1)
access: Optional[str] = None

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class Parameter(BaseModel):
Expand All @@ -75,36 +60,27 @@ class Parameter(BaseModel):
value: str
description: str

class Config:
"""permit to not accept extra parameters"""

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class DebugInfo(BaseModel):
"""Schema of the debug section."""

text: str

class Config:
"""permit to not accept extra parameters"""

extra = Extra.forbid
model_config = ConfigDict(extra="forbid")


class DocSchema(BaseModel):
"""Schema of the documentation.yaml file, and also validation of the schema"""

version: str
application: constr(min_length=1, strip_whitespace=True)
is_chiselled: Optional[bool]
description: constr(min_length=1, strip_whitespace=True)
docker: Optional[DockerRunParameters]
parameters: Optional[conlist(item_type=Parameter, min_items=1)]
debug: Optional[DebugInfo]
microk8s: Optional[Microk8sInfo]

class Config:
"""permit to not accept extra parameters"""

extra = Extra.forbid
is_chiselled: Optional[bool] = None
description: constr(min_length=1, strip_whitespace=True) = None
docker: Optional[DockerRunParameters] = None
parameters: Optional[conlist(item_type=Parameter, min_length=1)] = None
debug: Optional[DebugInfo] = None
microk8s: Optional[Microk8sInfo] = None

model_config = ConfigDict(extra="forbid")
4 changes: 2 additions & 2 deletions src/image/merge_release_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import json
import yaml

from utils.schema.triggers import ImageSchema, KNOWN_RISKS_ORDERED
from utils.schema.revision_data import RevisionDataSchema
from .utils.schema.triggers import ImageSchema, KNOWN_RISKS_ORDERED
from .utils.schema.revision_data import RevisionDataSchema


def backfill_higher_risks(channels: dict) -> None:
Expand Down
Loading