You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the hackathon I created a small snippet that compares published Infrahub Docker images against the json schema versions we've published for each release. The script only prints output to the screen, currently it would list major and minor versions above version 1.0 and indicate if the schema is published or not.
The script looks like this:
importhttpxfrompackaging.versionimportInvalidVersion, Versionpage=1page_size=10site="https://registry.opsmill.io"endpoint="/api/v2.0/projects/opsmill/repositories/infrahub/artifacts"query_string="?with_tag=true&with_label=false&with_scan_overview=false&with_signature=false&with_immutable_status=false&with_accessory=false"client=httpx.Client()
all_entries= []
missing_results=Truewhilemissing_results:
pagination=f"&page={page}&page_size={page_size}"url=f"{site}{endpoint}{query_string}{pagination}"res=client.get(url)
assertres.status_code==200ifentries:=res.json():
all_entries.extend(entries)
else:
missing_results=Falsepage+=1artifact_tags= [entry["tags"] forentryinall_entries]
all_tags= []
forartifactinartifact_tags:
fortaginartifact:
all_tags.append(tag)
tag_names= [tag["name"] fortaginall_tags]
valid_semver= []
forentryintag_names:
try:
version=Version(entry)
ifversion.major>=1andnotversion.preandnotversion.devandnotversion.localandversion.micro==0:
valid_semver.append(entry)
exceptInvalidVersion:
passexisting_versions= []
missing_versions= []
forversioninvalid_semver:
result=client.get(f"https://schema.infrahub.app/infrahub/schema/{version}.json")
ifresult.status_code==200:
existing_versions.append(f"{version} exists")
elifresult.status_code==404:
missing_versions.append(f"{version} is missing")
print("Versions where the schema exists")
forexistinginexisting_versions:
print(existing)
print("Versions where the schema is missing")
formissinginmissing_versions:
print(missing)
We could have a scheduled task that runs this that would create issues in this repository if we are missing any of the schemas. Alternatively trigger the execution of a pipeline in this repo to run whenever we publish a new docker image.
Running this script today gives this output:
Versions where the schema exists
1.0.0 exists
Versions where the schema is missing
1.0 is missing
1.1 is missing
1.1.0 is missing
Here we can choose if we should publish a schema both for 1.0.0 and 1.0 or simply ignore the 1.0 version. I also note that we have created images for 1.1.0 even though that version has yet to be released.
The text was updated successfully, but these errors were encountered:
During the hackathon I created a small snippet that compares published Infrahub Docker images against the json schema versions we've published for each release. The script only prints output to the screen, currently it would list major and minor versions above version 1.0 and indicate if the schema is published or not.
The script looks like this:
We could have a scheduled task that runs this that would create issues in this repository if we are missing any of the schemas. Alternatively trigger the execution of a pipeline in this repo to run whenever we publish a new docker image.
Running this script today gives this output:
Here we can choose if we should publish a schema both for
1.0.0
and1.0
or simply ignore the1.0
version. I also note that we have created images for 1.1.0 even though that version has yet to be released.The text was updated successfully, but these errors were encountered: