Skip to content

Commit

Permalink
Use dependencies instead of IMAGE_FORMAT and switch to cluster pool
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Abdalla <aabdelre@redhat.com>
  • Loading branch information
devguyio committed Sep 23, 2021
1 parent 372cf16 commit 7add101
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 13 deletions.
103 changes: 97 additions & 6 deletions openshift/ci-operator/generate-ci-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,55 @@ if [[ "$branch" == "knative-next" ]]; then
branch="knative-nightly"
fi

core_images=$(find ./openshift/ci-operator/knative-images -mindepth 1 -maxdepth 1 -type d | LC_COLLATE=posix sort)
test_images=$(find ./openshift/ci-operator/knative-test-images -mindepth 1 -maxdepth 1 -type d | LC_COLLATE=posix sort)
function print_image_dependencies {
for img in $core_images; do
image_base=knative-eventing-kafka-$(basename $img)
to_image=$(echo ${image_base//[_.]/-})
to_image=$(echo ${to_image//v0/upgrade-v0})
to_image=$(echo ${to_image//migrate/storage-version-migration})
to_image=$(echo ${to_image//kafka-kafka-/kafka-})
image_env=$(echo ${to_image//-/_})
image_env=$(echo ${image_env^^})
cat <<EOF
- env: $image_env
name: $to_image
EOF
done

for img in $test_images; do
image_base=knative-eventing-kafka-test-$(basename $img)
to_image=$(echo ${image_base//_/-})
image_env=$(echo ${to_image//-/_})
image_env=$(echo ${image_env^^})
cat <<EOF
- env: $image_env
name: $to_image
EOF
done
}

image_deps=$(print_image_dependencies)

cat <<EOF
tag_specification:
cluster: https://api.ci.openshift.org
name: '$openshift'
namespace: ocp
promotion:
additional_images:
knative-eventing-kafka-src: src
disabled: $promotion_disabled
cluster: https://api.ci.openshift.org
namespace: openshift
name: $branch.0
releases:
initial:
integration:
name: "$openshift"
namespace: ocp
latest:
integration:
include_built_images: true
name: "$openshift"
namespace: ocp
base_images:
base:
name: '$openshift'
Expand All @@ -32,13 +69,64 @@ canonical_go_repository: knative.dev/eventing-kafka
binary_build_commands: make install
test_binary_build_commands: make test-install
tests:
EOF
if [[ "$openshift" == "4.8" ]]; then
cat <<EOF
- as: e2e-aws-ocp-${openshift//./}
cluster_claim:
architecture: amd64
cloud: aws
owner: openshift-ci
product: ocp
timeout: 1h0m0s
version: "4.8"
steps:
test:
- as: test
cli: latest
commands: make test-e2e
dependencies:
$image_deps
from: src
resources:
requests:
cpu: 100m
timeout: 4h0m0s
workflow: generic-claim
- as: e2e-aws-ocp-${openshift//./}-continuous
cluster_claim:
architecture: amd64
cloud: aws
owner: openshift-ci
product: ocp
timeout: 1h0m0s
version: "4.8"
cron: 0 */12 * * 1-5
steps:
test:
- as: test
cli: latest
commands: make test-e2e
dependencies:
$image_deps
from: src
resources:
requests:
cpu: 100m
timeout: 4h0m0s
workflow: generic-claim
EOF
else
cat <<EOF
- as: e2e-aws-ocp-${openshift//./}
steps:
cluster_profile: aws
test:
- as: test
cli: latest
commands: make test-e2e
dependencies:
$image_deps
from: src
resources:
requests:
Expand All @@ -52,11 +140,16 @@ tests:
- as: test
cli: latest
commands: make test-e2e
dependencies:
$image_deps
from: src
resources:
requests:
cpu: 100m
workflow: ipi-aws
EOF
fi
cat <<EOF
resources:
'*':
limits:
Expand All @@ -73,7 +166,6 @@ resources:
images:
EOF

core_images=$(find ./openshift/ci-operator/knative-images -mindepth 1 -maxdepth 1 -type d | LC_COLLATE=posix sort)
for img in $core_images; do
image_base=$(basename $img)
to_image=$(echo ${image_base//[_.]/-})
Expand All @@ -92,7 +184,6 @@ for img in $core_images; do
EOF
done

test_images=$(find ./openshift/ci-operator/knative-test-images -mindepth 1 -maxdepth 1 -type d | LC_COLLATE=posix sort)
for img in $test_images; do
image_base=$(basename $img)
to_image=$(echo ${image_base//_/-})
Expand Down
30 changes: 24 additions & 6 deletions openshift/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ export KAFKA_USERS_CONFIG="test/config/100-strimzi-users-0.23.0.yaml"
export KAFKA_PLAIN_CLUSTER_URL="my-cluster-kafka-bootstrap.kafka.svc.cluster.local:9092"
readonly KNATIVE_EVENTING_MONITORING_YAML="test/config/monitoring.yaml"
KAFKA_CLUSTER_URL=${KAFKA_PLAIN_CLUSTER_URL}
export EVENTING_KAFKA_TEST_IMAGE_TEMPLATE=$(cat <<-END
{{- with .Name }}
{{- if eq . "event-sender"}}$KNATIVE_EVENTING_KAFKA_TEST_EVENT_SENDER{{end -}}
{{- if eq . "heartbeats"}}$KNATIVE_EVENTING_KAFKA_TEST_HEARTBEATS{{end -}}
{{- if eq . "kafka-publisher"}}$KNATIVE_EVENTING_KAFKA_TEST_KAFKA_PUBLISHER{{end -}}
{{- if eq . "kafka_performance"}}$KNATIVE_EVENTING_KAFKA_TEST_KAFKA_PERFORMANCE{{end -}}
{{- if eq . "performance"}}$KNATIVE_EVENTING_KAFKA_TEST_PERFORMANCE{{end -}}
{{- if eq . "print"}}$KNATIVE_EVENTING_KAFKA_TEST_PRINT{{end -}}
{{- if eq . "recordevents"}}$KNATIVE_EVENTING_KAFKA_TEST_RECORDEVENTS{{end -}}
{{- if eq . "wathola-fetcher"}}$KNATIVE_EVENTING_KAFKA_TEST_WATHOLA_FETCHER{{end -}}
{{- if eq . "wathola-forwarder"}}$KNATIVE_EVENTING_KAFKA_TEST_WATHOLA_FORWARDER{{end -}}
{{- if eq . "wathola-kafka-sender"}}$KNATIVE_EVENTING_KAFKA_TEST_WATHOLA_KAFKA_SENDER{{end -}}
{{- if eq . "wathola-receiver"}}$KNATIVE_EVENTING_KAFKA_TEST_WATHOLA_RECEIVER{{end -}}
{{- if eq . "wathola-sender"}}$KNATIVE_EVENTING_KAFKA_TEST_WATHOLA_SENDER{{end -}}
{{end -}}
END
)

function scale_up_workers(){
local cluster_api_ns="openshift-machine-api"
Expand Down Expand Up @@ -105,9 +122,9 @@ function install_consolidated_knative_kafka_channel(){

RELEASE_YAML="openshift/release/knative-eventing-kafka-channel-ci.yaml"

sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-consolidated-controller|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-consolidated-controller}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-consolidated-dispatcher|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-consolidated-dispatcher}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-webhook|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-webhook}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-consolidated-controller|${KNATIVE_EVENTING_KAFKA_CONSOLIDATED_CONTROLLER}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-consolidated-dispatcher|${KNATIVE_EVENTING_KAFKA_CONSOLIDATED_DISPATCHER}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-webhook|${KNATIVE_EVENTING_KAFKA_WEBHOOK}|g" ${RELEASE_YAML}

cat ${RELEASE_YAML} \
| sed "s/REPLACE_WITH_CLUSTER_URL/${KAFKA_CLUSTER_URL}/" \
Expand All @@ -121,8 +138,8 @@ function install_knative_kafka_source(){

RELEASE_YAML="openshift/release/knative-eventing-kafka-source-ci.yaml"

sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-source-controller|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-source-controller}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-receive-adapter|${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-receive-adapter}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-source-controller|${KNATIVE_EVENTING_KAFKA_SOURCE_CONTROLLER}|g" ${RELEASE_YAML}
sed -i -e "s|registry.ci.openshift.org/openshift/knative-.*:knative-eventing-kafka-receive-adapter|${KNATIVE_EVENTING_KAFKA_RECEIVE_ADAPTER}|g" ${RELEASE_YAML}

cat ${RELEASE_YAML} \
| oc apply --filename -
Expand Down Expand Up @@ -177,13 +194,14 @@ function run_e2e_tests(){
local failed=0
local channels=messaging.knative.dev/v1beta1:KafkaChannel

local common_opts=" -channels=$channels --kubeconfig $KUBECONFIG --imagetemplate $TEST_IMAGE_TEMPLATE"
local common_opts=" -channels=$channels --kubeconfig $KUBECONFIG"
if [ -n "$test_name" ]; then
local run_command="-run ^(${test_name})$"
fi

go_test_e2e -tags=e2e,source -timeout=90m -parallel=12 ./test/e2e \
"$run_command" \
--imagetemplate "${TEST_IMAGE_TEMPLATE}" \
$common_opts || failed=$?

return $failed
Expand Down
2 changes: 1 addition & 1 deletion openshift/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source "$(dirname "$0")/e2e-common.sh"

set -Eeuox pipefail

export TEST_IMAGE_TEMPLATE="${IMAGE_FORMAT//\$\{component\}/knative-eventing-kafka-test-{{.Name}}}"
export TEST_IMAGE_TEMPLATE="${EVENTING_KAFKA_TEST_IMAGE_TEMPLATE}"

env

Expand Down

0 comments on commit 7add101

Please sign in to comment.