make amount of nodes used in tests parameterized

fixes: CCI-278
flag = none

Test-Plan:
- the build works with expected amount of nodes

Change-Id: If3ef094d3f0e8cce955a1f9af0f9faa5890a79b1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229340
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Rex Fleischer <rfleischer@instructure.com>
Product-Review: Rex Fleischer <rfleischer@instructure.com>
This commit is contained in:
Rex Fleischer 2020-03-09 12:07:52 -07:00
parent ff55bcb9c4
commit 4c9586960c
3 changed files with 10 additions and 10 deletions

4
Jenkinsfile vendored
View File

@ -253,7 +253,7 @@ pipeline {
skipIfPreviouslySuccessful("selenium-chrome") {
build(
job: 'test-suites/selenium-chrome',
parameters: build_parameters
parameters: build_parameters + string(name: 'CI_NODE_TOTAL', value: env.SELENIUM_CI_NODE_TOTAL)
)
}
}
@ -264,7 +264,7 @@ pipeline {
skipIfPreviouslySuccessful("rspec") {
build(
job: 'test-suites/rspec',
parameters: build_parameters
parameters: build_parameters + string(name: 'CI_NODE_TOTAL', value: env.RSPEC_CI_NODE_TOTAL)
)
}
}

View File

@ -28,7 +28,6 @@ def getImageTagVersion() {
return env.RUN_COVERAGE == '1' ? 'master' : flags.getImageTagVersion()
}
def ci_node_total = 15; // how many nodes to run on
pipeline {
agent { label 'canvas-docker' }
options {
@ -53,10 +52,11 @@ pipeline {
steps {
script {
def nodes = [:];
def ci_node_total = env.CI_NODE_TOTAL as Integer
for(int i = 0; i < ci_node_total; i++) {
def index = i;
nodes["rspec set ${(i).toString().padLeft(2, '0')}"] = {
withEnv(["TEST_ENV_NUMBER=$index", "CI_NODE_INDEX=$index", "CI_NODE_TOTAL=$ci_node_total"]) {
withEnv(["TEST_ENV_NUMBER=$index", "CI_NODE_INDEX=$index"]) {
node('canvas-docker') {
stage("Running RSpec Set ${index}") {
try {
@ -102,7 +102,7 @@ pipeline {
steps {
script {
def reports = load 'build/new-jenkins/groovy/reports.groovy'
reports.publishSpecCoverageToS3(ci_node_total, "canvas-lms-rspec")
reports.publishSpecCoverageToS3(env.CI_NODE_TOTAL, "canvas-lms-rspec")
}
}
}
@ -111,7 +111,7 @@ pipeline {
failure {
script {
def reports = load 'build/new-jenkins/groovy/reports.groovy'
reports.publishSpecFailuresAsHTML(ci_node_total)
reports.publishSpecFailuresAsHTML(env.CI_NODE_TOTAL as Integer)
}
}
}

View File

@ -28,7 +28,6 @@ def getImageTagVersion() {
return env.RUN_COVERAGE == '1' ? 'master' : flags.getImageTagVersion()
}
def ci_node_total = 25; // how many nodes to run on
pipeline {
agent { label 'canvas-docker' }
options {
@ -55,10 +54,11 @@ pipeline {
steps {
script {
def nodes = [:];
def ci_node_total = env.CI_NODE_TOTAL as Integer
for(int i = 0; i < ci_node_total; i++) {
def index = i;
nodes["selenium set ${(i).toString().padLeft(2, '0')}"] = {
withEnv(["TEST_ENV_NUMBER=$index", "CI_NODE_INDEX=$index", "CI_NODE_TOTAL=$ci_node_total"]) {
withEnv(["TEST_ENV_NUMBER=$index", "CI_NODE_INDEX=$index"]) {
node('canvas-docker') {
stage("Running Selenium Set ${index}") {
try {
@ -107,7 +107,7 @@ pipeline {
steps {
script {
def reports = load 'build/new-jenkins/groovy/reports.groovy'
reports.publishSpecCoverageToS3(ci_node_total, "canvas-lms-selenium")
reports.publishSpecCoverageToS3(env.CI_NODE_TOTAL, "canvas-lms-selenium")
}
}
}
@ -117,7 +117,7 @@ pipeline {
always {
script {
def reports = load 'build/new-jenkins/groovy/reports.groovy'
reports.publishSpecFailuresAsHTML(ci_node_total)
reports.publishSpecFailuresAsHTML(env.CI_NODE_TOTAL as Integer)
}
}
}