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

Add build_args also to ct_s2i_build_as_df function. #368

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
24 changes: 22 additions & 2 deletions test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ ct_get_public_image_name() {
elif [ "$os" == "rhel9" ]; then
public_image_name=$registry/rhel9/$base_image_name-${version//./}
elif [ "$os" == "centos7" ]; then
public_image_name=$registry/centos7/$base_image_name-${version//./}-centos7
public_image_name=$registry/centos7/$base_image_name-${version//./}-centos7:centos7
elif [ "$os" == "c8s" ]; then
public_image_name=$registry/sclorg/$base_image_name-${version//./}-c8s
elif [ "$os" == "c9s" ]; then
Expand Down Expand Up @@ -894,6 +894,26 @@ ct_s2i_build_as_df()
local src_image=$1; shift
local dst_image=$1; shift
local s2i_args="$*";

ct_s2i_build_as_df_build_args "$app_path" "$src_image" "$dst_image" "" "$s2i_args"
}

# ct_s2i_build_as_df_build_args APP_PATH SRC_IMAGE DST_IMAGE [S2I_ARGS]
zmiklank marked this conversation as resolved.
Show resolved Hide resolved
# ----------------------------
# Create a new s2i app image from local sources in a similar way as source-to-image would have used.
# Argument: APP_PATH - local path to the app sources to be used in the test
# Argument: SRC_IMAGE - image to be used as a base for the s2i build
# Argument: DST_IMAGE - image name to be used during the tagging of the s2i build result
# Argument: BUILD_ARGS - Build arguments to be used in the s2i build
# Argument: S2I_ARGS - Additional list of source-to-image arguments.
# Only used to check for pull-policy=never and environment variable definitions.
ct_s2i_build_as_df_build_args()
{
local app_path=$1; shift
local src_image=$1; shift
local dst_image=$1; shift
local build_args=$1; shift
local s2i_args="$*";
local local_app=upload/src/
local local_scripts=upload/scripts/
local user_id=
Expand Down Expand Up @@ -989,7 +1009,7 @@ EOF
read -ra mount_options <<< "$(echo "$s2i_args" | grep -o -e '\(-v\)[[:space:]]\.*\S*' || true)"

# Run the build and tag the result
ct_build_image_and_parse_id "$df_name" "${mount_options[*]+${mount_options[*]}} -t $dst_image ."
ct_build_image_and_parse_id "$df_name" "${mount_options[*]+${mount_options[*]}} -t $dst_image . $build_args"
#shellcheck disable=SC2181
if [ "$?" -ne 0 ]; then
echo " ERROR: Failed to to build $df_name" >&2
Expand Down
2 changes: 1 addition & 1 deletion tests/failures/check/v0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM quay.io/centos7/s2i-core-centos7
FROM quay.io/centos7/s2i-core-centos7:centos7
LABEL name=test-image
8 changes: 4 additions & 4 deletions tests/test-lib/image_availability
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ set -e
. test-lib.sh

# This should succeed
if ! ct_pull_image quay.io/centos7/ruby-27-centos7; then
if ! ct_pull_image quay.io/centos7/ruby-27-centos7:centos7; then
echo "image_availability test failed"
false
fi

# This should fail
if ct_pull_image quay.io/centos7/ruby-24-centos7 false 1; then
if ct_pull_image quay.io/centos7/ruby-24-centos7:centos7 false 1; then
echo "image_availability test failed"
false
fi

# This should succeed
if ! ct_check_image_availability quay.io/centos7/ruby-27-centos7; then
if ! ct_check_image_availability quay.io/centos7/ruby-27-centos7:centos7; then
echo "check_image_availability test failed"
false
fi

# This should fail
if ct_check_image_availability quay.io/centos7/ruby-24-centos7; then
if ct_check_image_availability quay.io/centos7/ruby-24-centos7:centos7; then
echo "check_image_availability test failed"
false
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/test-lib/public_image_name
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
. test-lib.sh

combinations="rhel7:registry.redhat.io/rhscl/postgresql-10-rhel7
centos7:quay.io/centos7/postgresql-10-centos7
centos7:quay.io/centos7/postgresql-10-centos7:centos7
rhel8:registry.redhat.io/rhel8/postgresql-10
"

Expand Down
Loading