Added workflow to update Red Hat Container Catalog

This commit is contained in:
Alexey Pustovalov 2024-02-20 00:58:59 +09:00
parent 85e5ea0c43
commit 33e3dfaf44
2 changed files with 13 additions and 9 deletions

View File

@ -6,16 +6,16 @@ import os
repository_description = None
if ("DESCRIPTION_FILE" not in os.environ):
if ("DESCRIPTION_FILE" not in os.environ or len(os.environ["DESCRIPTION_FILE"]) == 0):
print("Description file environment variable is not specified")
sys.exit(1)
if ("PYXIS_API_TOKEN" not in os.environ):
if ("PYXIS_API_TOKEN" not in os.environ or len(os.environ["PYXIS_API_TOKEN"]) == 0):
print("API token environment variable is not specified")
sys.exit(1)
if ("API_URL" not in os.environ):
if ("API_URL" not in os.environ or len(os.environ["API_URL"]) == 0):
print("API URL environment variable is not specified")
sys.exit(1)
if ("PROJECT_ID" not in os.environ):
if ("PROJECT_ID" not in os.environ or len(os.environ["PROJECT_ID"]) == 0):
print("RedHat project ID environment variable is not specified")
sys.exit(1)
@ -38,6 +38,11 @@ data['container'] = dict()
data['container']['repository_description'] = repository_description[:32768]
headers = {'accept' : 'application/json', 'X-API-KEY' : os.environ["PYXIS_API_TOKEN"], 'Content-Type' : 'application/json'}
result = requests.patch(os.environ["API_URL"] + os.environ["PROJECT_ID"], headers = headers, data = json.dumps(data))
print(result)
print(json.loads(result.content)['last_update_date'])
result = requests.patch(os.environ["API_URL"] + os.environ["PROJECT_ID"],
headers = headers,
data = json.dumps(data))
print("::group::Result")
print("Response code: " + result)
print("Last update date: " + json.loads(result.content)['last_update_date'])
print("::endgroup::")

View File

@ -65,13 +65,12 @@ jobs:
sha_short=$(git rev-parse --short HEAD)
github_ref=${github_ref##*/}
github_ref="6.4"
echo "::group::Branch metadata"
echo "secret_prefix=RHEL_${github_ref//.}"
echo "::endgroup::"
echo "zabbix_release=64" >> $GITHUB_OUTPUT
echo "zabbix_release=${github_ref//.}" >> $GITHUB_OUTPUT
echo "secret_prefix=RHEL_${github_ref//.}" >> $GITHUB_OUTPUT
- name: Check ${{ env.MATRIX_FILE }} file