Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.
Closed
Changes from all 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
22 changes: 20 additions & 2 deletions openshift/ci-operator/generate-ci-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ EOF
done
}

function generate_cron_expression {
if [[ "$branch" == "knative-v0.25.3" ]]; then
echo '0 1 * * 1-5'
elif [[ "$branch" == "knative-v0.26" ]]; then
echo '0 3 * * 1-5'
elif [[ "$branch" == "knative-v1.0" ]]; then
echo '0 5 * * 1-5'
elif [[ "$branch" == "knative-v1.1" ]]; then
echo '0 7 * * 1-5'
elif [[ "$branch" == "knative-v1.2" ]]; then
echo '0 9 * * 1-5'
fi
}
Comment on lines +44 to +56
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering if we can avoid hard-coding these branches here? 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, I know what you mean. Alternative is maybe create a file in each branch that has the Cron expression. Then we can read the file in the script.

I thought about that but this hardcoding is at least making things more central and I don't have to look at 5 different branches for the cron expression when I want to see when jobs are running.

I am ok with both if you have a strong opinion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Or, any other ideas?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm fine with starting with this to validate the idea and not spend much effort in crappy shell until it's proven, then move to a more dynamic random distribution using modulo
https://stackoverflow.com/questions/13104478/uniformity-of-random-numbers-taken-modulo-n

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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


function print_single_test {
local name=${1}
local commands=${2}
Expand Down Expand Up @@ -115,22 +129,26 @@ EOF
}

function print_openshift_47_tests {
cron=$(generate_cron_expression)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
cron=$(generate_cron_expression)
cron="$(generate_cron_expression)"


print_single_test "e2e-aws-ocp-${openshift//./}" "make test-e2e" "aws" "false" "ipi-aws" ""
print_single_test "conformance-aws-ocp-${openshift//./}" "make test-conformance" "aws" "false" "ipi-aws" ""
print_single_test "reconciler-aws-ocp-${openshift//./}" "make test-reconciler" "aws" "false" "ipi-aws" ""

if [[ "$generate_continuous" == true ]]; then
print_single_test "e2e-aws-ocp-${openshift//./}-continuous" "make test-e2e" "aws" "false" "ipi-aws" "0 */12 * * 1-5"
print_single_test "e2e-aws-ocp-${openshift//./}-continuous" "make test-e2e" "aws" "false" "ipi-aws" "${cron}"
fi
}

function print_non_openshift_47_tests {
cron=$(generate_cron_expression)

print_single_test "e2e-aws-ocp-${openshift//./}" "make test-e2e" "" "true" "generic-claim" ""
print_single_test "conformance-aws-ocp-${openshift//./}" "make test-conformance" "" "true" "generic-claim" ""
print_single_test "reconciler-aws-ocp-${openshift//./}" "make test-reconciler" "" "true" "generic-claim" ""

if [[ "$generate_continuous" == true ]]; then
print_single_test "e2e-aws-ocp-${openshift//./}-continuous" "make test-e2e" "" "true" "generic-claim" "0 */12 * * 1-5"
print_single_test "e2e-aws-ocp-${openshift//./}-continuous" "make test-e2e" "" "true" "generic-claim" "${cron}"
fi
}

Expand Down