mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-06-15 22:37:33 +02:00
Added workflow to update Red Hat Container Catalog
This commit is contained in:
parent
924691eb48
commit
d70750efb6
18
.github/scripts/rhel_description.py
vendored
18
.github/scripts/rhel_description.py
vendored
@ -4,20 +4,32 @@ import json
|
|||||||
import markdown
|
import markdown
|
||||||
import os
|
import os
|
||||||
|
|
||||||
repository_description = ''
|
repository_description = None
|
||||||
|
|
||||||
if ("DESCRIPTION_FILE" not in os.environ):
|
if ("DESCRIPTION_FILE" not in os.environ):
|
||||||
print("Description file environment variable is not specified")
|
print("Description file environment variable is not specified")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if ("PYXIS_API_TOKEN" not in os.environ):
|
||||||
|
print("API token environment variable is not specified")
|
||||||
|
sys.exit(1)
|
||||||
|
if ("API_URL" not in os.environ):
|
||||||
|
print("API URL environment variable is not specified")
|
||||||
|
sys.exit(1)
|
||||||
|
if ("PROJECT_ID" not in os.environ):
|
||||||
|
print("RedHat project ID environment variable is not specified")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if (os.path.isfile(os.environ["DESCRIPTION_FILE"] + '.md')):
|
if (os.path.isfile(os.environ["DESCRIPTION_FILE"] + '.md')):
|
||||||
repository_description=markdown.markdownFromFile(input=os.environ["DESCRIPTION_FILE"] + '.md')
|
file = open(os.environ["DESCRIPTION_FILE"] + '.md', mode='r')
|
||||||
|
markdown_data = file.read()
|
||||||
|
file.close()
|
||||||
|
repository_description=markdown.markdown(markdown_data)
|
||||||
elif (os.path.isfile(os.environ["DESCRIPTION_FILE"] + '.html')):
|
elif (os.path.isfile(os.environ["DESCRIPTION_FILE"] + '.html')):
|
||||||
file = open(os.environ["DESCRIPTION_FILE"] + '.html', mode='r')
|
file = open(os.environ["DESCRIPTION_FILE"] + '.html', mode='r')
|
||||||
repository_description = file.read()
|
repository_description = file.read()
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
if (len(repository_description)) == 0:
|
if (repository_description is None or len(repository_description) == 0):
|
||||||
print("No description")
|
print("No description")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user