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

[Backport master] Fix publish if there is no SECURITY.md file #1279

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions c2cciutils/scripts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,31 +206,31 @@ def main() -> None:
headers=c2cciutils.add_authorization_header({}),
timeout=int(os.environ.get("C2CCIUTILS_TIMEOUT", "30")),
)
if (
security_response.ok
and docker_config.get("latest", c2cciutils.configuration.PUBLISH_DOCKER_LATEST_DEFAULT)
is True
):
if security_response.ok:
security_text = security_response.text
elif security_response.status_code != 404:
print(f"::error:: {security_response.status_code} {security_response.text}")
sys.exit(1)

security = c2cciutils.security.Security(security_text)
version_index = security.headers.index("Version")
version_index = security.headers.index("Version") if "Version" in security.headers else -1
alternate_tag_index = (
security.headers.index("Alternate Tag") if "Alternate Tag" in security.headers else -1
)

row_index = -1
for index, row in enumerate(security.data):
if row[version_index] == version:
row_index = index
break
if version_index >= 0:
for index, row in enumerate(security.data):
if row[version_index] == version:
row_index = index
break

alt_tags = set()
if alternate_tag_index >= 0 and row_index >= 0:
alt_tags = {
t.strip() for t in security.data[row_index][alternate_tag_index].split(",") if t.strip()
}
if security.data[-1][version_index] == version:
if version_index >= 0 and security.data[-1][version_index] == version:
add_latest = True
for data in security.data:
row_tags = {t.strip() for t in data[alternate_tag_index].split(",") if t.strip()}
Expand Down
Loading