Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/canonical/oci-factory into …
Browse files Browse the repository at this point in the history
…fix_release_of_eol_images
  • Loading branch information
clay-lake committed Dec 20, 2024
2 parents d875dc3 + aab644b commit 1063f6f
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 12 deletions.
75 changes: 75 additions & 0 deletions oci/prometheus/_releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,5 +268,80 @@
"edge": {
"target": "2.45-22.04_beta"
}
},
"2.53-24.04": {
"end-of-life": "2025-03-14T00:00:00Z",
"stable": {
"target": "111"
},
"candidate": {
"target": "2.53-24.04_stable"
},
"beta": {
"target": "2.53-24.04_candidate"
},
"edge": {
"target": "2.53-24.04_beta"
}
},
"2.53.3-24.04": {
"end-of-life": "2025-03-14T00:00:00Z",
"stable": {
"target": "111"
},
"candidate": {
"target": "2.53.3-24.04_stable"
},
"beta": {
"target": "2.53.3-24.04_candidate"
},
"edge": {
"target": "2.53.3-24.04_beta"
}
},
"2-24.04": {
"end-of-life": "2025-03-14T00:00:00Z",
"stable": {
"target": "112"
},
"candidate": {
"target": "2-24.04_stable"
},
"beta": {
"target": "2-24.04_candidate"
},
"edge": {
"target": "2-24.04_beta"
}
},
"2.55-24.04": {
"end-of-life": "2025-03-14T00:00:00Z",
"stable": {
"target": "112"
},
"candidate": {
"target": "2.55-24.04_stable"
},
"beta": {
"target": "2.55-24.04_candidate"
},
"edge": {
"target": "2.55-24.04_beta"
}
},
"2.55.1-24.04": {
"end-of-life": "2025-03-14T00:00:00Z",
"stable": {
"target": "112"
},
"candidate": {
"target": "2.55.1-24.04_stable"
},
"beta": {
"target": "2.55.1-24.04_candidate"
},
"edge": {
"target": "2.55.1-24.04_beta"
}
}
}
4 changes: 2 additions & 2 deletions src/image/define_image_revision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ set -x

# Does image already exist in Swift?
# If not, then this is immediately revision number 1
swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME | grep $IMAGE_NAME || \
swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME/ | grep $IMAGE_NAME || \
(echo "revision=1" >> "$GITHUB_OUTPUT" && exit 0)

# If the script gets here, then it means this image already has revisions
highest_revision=$(swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME \
highest_revision=$(swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME/ \
| sort -t / -k 3 -V \
| tail -1 \
| awk -F'/' '{print $3}')
Expand Down
2 changes: 1 addition & 1 deletion src/image/get_canonical_tags_from_swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source $(dirname $0)/../configs/swift.public.novarc

set -x

canonical_tags=$(swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME \
canonical_tags=$(swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME/ \
| awk -F '/' '{print $2"_"$3}' | uniq | sort | tr '\n' ',')

echo "canonical-tags=${canonical_tags}" >> "$GITHUB_OUTPUT"
Expand Down
2 changes: 1 addition & 1 deletion src/uploads/swift_lockfile_lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pushd "${staging_area}"
# are waiting for the lockfile to get removed, and they may exit
# the while loop at the same time, getting into a race condition.
while [ $TIMEOUT -gt 0 ]; do
swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME | grep "lockfile.lock" && sleep $SLEEP_TIME || break
swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME/ | grep "lockfile.lock" && sleep $SLEEP_TIME || break
TIMEOUT=$(( $TIMEOUT - $SLEEP_TIME ))
if [ $TIMEOUT -lt 1 ]; then
echo "Timeout reached while waiting to write lockfile into the Swift container for ${IMAGE_NAME}."
Expand Down
2 changes: 1 addition & 1 deletion src/uploads/swift_lockfile_unlock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ IMAGE_NAME=$1
# if it does not, emit an error
# SWIFT_CONTAINER_NAME comes from env
LOCKFILE="${IMAGE_NAME}/lockfile.lock"
swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME | grep "$LOCKFILE" && \
swift list $SWIFT_CONTAINER_NAME -p $IMAGE_NAME/ | grep "$LOCKFILE" && \
(swift delete $SWIFT_CONTAINER_NAME "$LOCKFILE" && echo "Lock file removed successfully.") || \
echo "Lock file does not exist."
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
import json
import logging
import os
from datetime import datetime, timezone
import requests
import swiftclient
import sys
import tempfile
import time
import yaml
import zipfile
from datetime import datetime, timezone
from fnmatch import fnmatchcase

import requests
import swiftclient
import yaml

if __name__ == "__main__":
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
Expand Down Expand Up @@ -103,11 +104,10 @@ def find_released_revisions(releases_json: dict) -> list:
)

# This is the metadata file we want to get from Swift
build_metadata_file = "build_metadata.json"
# match objects with name <IMAGE_NAME>/<TRACK>/<REVISION>/build_metadata.json
img_objs = list(
filter(
lambda o: o["name"].startswith(image)
and o["name"].endswith(build_metadata_file),
lambda o: fnmatchcase(o["name"], f"{image}/*/*/build_metadata.json"),
swift_oci_factory_objs,
)
)
Expand Down

0 comments on commit 1063f6f

Please sign in to comment.