Skip to content

Commit

Permalink
update fsc to go into the plugin directory to do tests
Browse files Browse the repository at this point in the history
[skip-docker-build]

fixes: CCI-402
flag = none

Test-Plan:
execute the plugin build with this PS

Change-Id: Id8c85ef80671a5cd055e2aafd15cfb98d8251045
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239678
Reviewed-by: James Butters <[email protected]>
Reviewed-by: Derek Bender <[email protected]>
Tested-by: Service Cloud Jenkins <[email protected]>
QA-Review: Ryan Norton <[email protected]>
Product-Review: Rex Fleischer <[email protected]>
  • Loading branch information
Rex Fleischer committed Jun 17, 2020
1 parent 1ac5fd4 commit 03bcc04
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 15 deletions.
59 changes: 49 additions & 10 deletions Jenkinsfile.selenium.flakey_spec_catcher
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,49 @@ def getForceFailureFSC() {
return flags.isForceFailureFSC() ? '1' : '0'
}

def isPlugin() {
return env.GERRIT_PROJECT == "canvas-lms" ? "0" : "1"
}

def getDockerWorkDir() {
return env.GERRIT_PROJECT == "canvas-lms" ? "/usr/src/app" : "/usr/src/app/gems/plugins/${env.GERRIT_PROJECT}"
}

def getLocalWorkDir() {
return env.GERRIT_PROJECT == "canvas-lms" ? "." : "gems/plugins/${env.GERRIT_PROJECT}"
}

def computeTestCount() {
if (env.IS_PLUGIN == "1") {
dir(env.LOCAL_WORKDIR) {
checkout([
$class: 'GitSCM',
branches: [[name: 'FETCH_HEAD']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[
credentialsId: '44aa91d6-ab24-498a-b2b4-911bcb17cc35',
name: 'origin',
refspec: "$env.GERRIT_REFSPEC",
url: "ssh://$GERRIT_URL/${GERRIT_PROJECT}.git"
]]
])
}
}
// oops, probably should have added an easier way to _count_ tests...
sh 'rm -vrf tmp'
sh 'mkdir -v tmp'
sh 'chmod -vv 777 tmp'
sh """
docker run --volume \$(pwd)/.git:/usr/src/app/.git \
--volume \$(pwd)/tmp:/usr/src/app/tmp \
sh 'rm -vrf $LOCAL_WORKDIR/tmp'
sh 'mkdir -v $LOCAL_WORKDIR/tmp'
sh 'chmod -vv 777 $LOCAL_WORKDIR/tmp'
sh '''
docker run --volume $(pwd)/$LOCAL_WORKDIR/.git:$DOCKER_WORKDIR/.git \
--volume $(pwd)/$LOCAL_WORKDIR/tmp:$DOCKER_WORKDIR/tmp \
--env FSC_IGNORE_FILES \
\$PATCHSET_TAG \
bundle exec flakey_spec_catcher --use-parent --dry-run-quiet > tmp/test_list
"""
changed_tests = readFile('tmp/test_list').trim()
-w=$DOCKER_WORKDIR \
$PATCHSET_TAG \
bash -c "flakey_spec_catcher --use-parent --dry-run-quiet > $DOCKER_WORKDIR/tmp/test_list"
'''
changed_tests = readFile("$env.LOCAL_WORKDIR/tmp/test_list").trim()
echo "raw result from catcher: \n====\n$changed_tests\n===="
def test_count = 0
if (changed_tests) {
Expand All @@ -68,6 +98,10 @@ def computeDistributedCount() {
if (result_test_count == 0) {
result_node_count = 0
}
else if (env.IS_PLUGIN == "1") {
// lets not deal with distributing fsc for plugins unless we have to
result_node_count = 1
}
else {
// force a round down
// this will have the following node counts.
Expand Down Expand Up @@ -130,7 +164,12 @@ pipeline {
}

environment {
GERRIT_PORT = '29418'
GERRIT_URL = "$GERRIT_HOST:$GERRIT_PORT"
COMPOSE_FILE = 'docker-compose.new-jenkins.yml:docker-compose.new-jenkins-selenium.yml:docker-compose.new-jenkins-flakey-spec-catcher.yml'
IS_PLUGIN = isPlugin()
DOCKER_WORKDIR = getDockerWorkDir()
LOCAL_WORKDIR = getLocalWorkDir()
FORCE_FAILURE = getForceFailureFSC()
// there will be a node for every 10 tests
DISTRIBUTED_FACTOR = '10'
Expand Down
5 changes: 1 addition & 4 deletions build/new-jenkins/rspec-flakey-spec-catcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ if [ "${FORCE_FAILURE:-}" == '1' ]; then
--test=spec/force_failure_spec.rb
else
docker-compose --project-name canvas-lms0 exec -T -e FSC_IGNORE_FILES -e FSC_NODE_TOTAL -e FSC_NODE_INDEX canvas \
bundle exec flakey_spec_catcher \
--repeat=$FSC_REPEAT_FACTOR \
--output=/usr/src/app/tmp/fsc.out \
--use-parent
bash -c "cd $DOCKER_WORKDIR && flakey_spec_catcher --repeat=$FSC_REPEAT_FACTOR --output=/usr/src/app/tmp/fsc.out --use-parent"
fi
2 changes: 1 addition & 1 deletion docker-compose.new-jenkins-flakey-spec-catcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ version: "2.3"
services:
canvas:
volumes:
- "./.git:/usr/src/app/.git"
- "${PWD}/${LOCAL_WORKDIR}/.git:${DOCKER_WORKDIR}/.git"
init: true

0 comments on commit 03bcc04

Please sign in to comment.