Skip to content

Commit

Permalink
Merge branch 'main' into ROCKS-543_charmed-oci-factory-we
Browse files Browse the repository at this point in the history
  • Loading branch information
Linostar authored Feb 19, 2024
2 parents 24777b0 + 2a6ef0e commit 52445ea
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/base_digests/20.04
Original file line number Diff line number Diff line change
@@ -1 +1 @@
public.ecr.aws/ubuntu/ubuntu:focal@sha256:38ee5ef91012d863b9862ef078c372590d180a6b36d0355f8a574184485fd8f2
public.ecr.aws/ubuntu/ubuntu:focal@sha256:5b01ab17d175d88fa3f43b2c6f1ff2fdcd32f861edfb9790fa1a12e01ff7b61e
1 change: 1 addition & 0 deletions oci/mock-rock/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ release:
end-of-life: "2024-05-01T00:00:00Z"
candidate: 1.0-22.04_candidate
test:
end-of-life: "2026-05-01T00:00:00Z"
beta: 1.0-22.04_beta

upload:
Expand Down
7 changes: 7 additions & 0 deletions oci/python/_releases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"3.8-20.04": {
"edge": {
"target": "2"
}
}
}
5 changes: 5 additions & 0 deletions oci/python/contacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
notify:
emails:
- [email protected]
mattermost-channels:
- fbdezwkcxpfofpysjore1wpfoc
32 changes: 32 additions & 0 deletions oci/python/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 1

application: Python
is_chiselled: true
description: |
Python is a high-level, general-purpose programming language. Its
design philosophy emphasizes code readability with the use of
significant indentation. Python is dynamically typed and
garbage-collected. It supports multiple programming paradigms,
including structured, object-oriented and functional programming.
Read more on [python.org](https://www.python.org/).
This image is a chiselled Ubuntu rock that contains only the Python
runtime and its standard libraries. It is production-ready and can
also be used as a base if additional application dependencies are
needed.
debug:
text: |
### Debugging
To debug the container:
```bash
docker logs -f python-container
```
To get an interactive python3 interpreter:
```bash
docker exec -it python-container python3
```
11 changes: 11 additions & 0 deletions oci/python/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 1

upload:
- source: canonical/chiselled-python
commit: 3ce55f41e0e33ce1db3552fb18e8179c4a29941a
directory: python3.8/
release:
3.8-20.04:
end-of-life: "2025-01-26T00:00:00Z"
risks:
- edge
28 changes: 21 additions & 7 deletions src/image/utils/schema/triggers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pydantic

from datetime import datetime
from datetime import datetime, timezone
from typing import Dict, List, Literal, Optional


Expand All @@ -12,17 +12,26 @@ class ImageTriggerValidationError(Exception):
"""Error validating image trigger file."""


class ImageReachedEol(Exception):
"""Exception to be thrown when end-of-life is reached."""


class ImageUploadReleaseSchema(pydantic.BaseModel):
"""Schema of the release option for uploads in the image.yaml trigger"""

end_of_life: Optional[datetime] = pydantic.Field(
alias="end-of-life", default=None
)
end_of_life: datetime = pydantic.Field(alias="end-of-life")
risks: List[Literal["edge", "beta", "candidate", "stable"]]

class Config:
extra = pydantic.Extra.forbid

@pydantic.validator("end_of_life")
def ensure_still_supported(cls, v: datetime) -> datetime:
"""ensure that the end of life isn't reached."""
if v < datetime.now(timezone.utc):
raise ImageReachedEol("This track has reached its end of life")
return v


class ImageUploadSchema(pydantic.BaseModel):
"""Schema of each upload within the image.yaml files."""
Expand All @@ -39,9 +48,7 @@ class Config:
class ChannelsSchema(pydantic.BaseModel):
"""Schema of the 'release' tracks within the image.yaml file."""

end_of_life: Optional[datetime] = pydantic.Field(
alias="end-of-life", default=None
)
end_of_life: datetime = pydantic.Field(alias="end-of-life")
stable: Optional[str]
candidate: Optional[str]
beta: Optional[str]
Expand All @@ -59,6 +66,13 @@ def _check_risks(cls, values: List) -> str:

return values

@pydantic.validator("end_of_life")
def ensure_still_supported(cls, v: datetime) -> datetime:
"""ensure that the end of life isn't reached."""
if v < datetime.now(timezone.utc):
raise ImageReachedEol("This track has reached its end of life")
return v


class ImageSchema(pydantic.BaseModel):
"""Validates the schema of the image.yaml files."""
Expand Down

0 comments on commit 52445ea

Please sign in to comment.