Skip to content
Merged
Changes from 1 commit
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
16 changes: 7 additions & 9 deletions test/test-lib-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,14 @@ function ct_pull_or_import_postgresql() {

# Check the imagestream
function test_python_imagestream() {
local tag="-ubi7"
if [ "${OS}" == "rhel8" ]; then
tag="-ubi8"
elif [ "${OS}" == "rhel9" ]; then
local tag="-ubi8"
if [ "${OS}" == "rhel9" ]; then
tag="-ubi9"
elif [ "${OS}" == "rhel10" ]; then
tag="-ubi10"
fi
if [[ "${VERSION}" == *"minimal"* ]]; then
VERSION=$(echo "${VERSION}" | cut -d "-" -f 1)
fi
if [[ "${VERSION}" == "3.11" ]] || [[ "${VERSION}" == "3.12" ]]; then
# On RHEL10 we have only 3.12-minimal image
if [[ "${VERSION}" == "3.11" ]] || [[ "${VERSION}" == "3.12" ]] && [[ "${VERSION}" == "3.12-minimal" ]]; then
branch="4.2.x"
postgresql_image="quay.io/sclorg/postgresql-12-c8s|postgresql:12"
postgresql_version="12"
Expand All @@ -62,7 +60,7 @@ function test_python_imagestream() {
django-postgresql.json \
django-postgresql-persistent.json"
for template in $TEMPLATES; do
ct_os_test_image_stream_quickstart "${THISDIR}/imagestreams/python-${OS%[0-9]*}.json" \
ct_os_test_image_stream_quickstart "${THISDIR}/imagestreams/python-${OS//[0-9]/}.json" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change, could you please explain?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in case OS=rhel8 or rhel9, then the expression ${OS%[0-9]*} converts to rhel and result file is python-rhel.json, that exists.
But in case OS=rhel10 then the origin expression convers to rhel1 and the file python-rhel1.json does not exist.

Copy link
Member

@befeleme befeleme Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aach, I see. // replaces all matches of digits with nothing (after /). % removes the suffix from the end. The same effect would have an expression ${OS%%[0-9]*} with double % sign to indicate the removal of the longest match from the end of the string. I have no opinion on what's better, but I learned something new today :)

"https://raw.githubusercontent.com/sclorg/django-ex/${branch}/openshift/templates/${template}" \
"${IMAGE_NAME}" \
'python' \
Expand Down