2019-08-15 02:43:09 +08:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 - present Instructure, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of Canvas.
|
|
|
|
*
|
|
|
|
* Canvas is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU Affero General Public License as published by the Free
|
|
|
|
* Software Foundation, version 3 of the License.
|
|
|
|
*
|
|
|
|
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-11-02 23:39:02 +08:00
|
|
|
library "canvas-builds-library@${env.CANVAS_BUILDS_REFSPEC}"
|
2021-06-12 04:34:56 +08:00
|
|
|
loadLocalLibrary('local-lib', 'build/new-jenkins/library')
|
2020-08-26 21:41:23 +08:00
|
|
|
|
2019-08-15 02:43:09 +08:00
|
|
|
pipeline {
|
2020-07-23 07:16:24 +08:00
|
|
|
agent none
|
2020-05-09 02:23:07 +08:00
|
|
|
options {
|
|
|
|
ansiColor('xterm')
|
2021-05-19 01:03:16 +08:00
|
|
|
timeout(15)
|
2020-05-09 02:23:07 +08:00
|
|
|
timestamps()
|
|
|
|
}
|
2019-08-15 02:43:09 +08:00
|
|
|
|
|
|
|
environment {
|
2021-04-21 01:15:44 +08:00
|
|
|
BUILD_REGISTRY_FQDN = configuration.buildRegistryFQDN()
|
2020-08-28 04:00:12 +08:00
|
|
|
COMPOSE_FILE = 'docker-compose.new-jenkins.yml:docker-compose.new-jenkins-contract-tests.yml'
|
2020-04-16 02:52:10 +08:00
|
|
|
POSTGRES_PASSWORD = 'sekret'
|
2020-04-27 23:03:34 +08:00
|
|
|
PACT_BROKER = credentials('PACT_BROKER')
|
2021-05-19 00:33:13 +08:00
|
|
|
PACT_BROKER_USERNAME = "${env.PACT_BROKER_USR}"
|
|
|
|
PACT_BROKER_PASSWORD = "${env.PACT_BROKER_PSW}"
|
2021-05-06 04:51:25 +08:00
|
|
|
RSPEC_PROCESSES = '7'
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
2019-09-12 03:12:40 +08:00
|
|
|
|
2019-08-15 02:43:09 +08:00
|
|
|
stages {
|
2020-07-23 07:16:24 +08:00
|
|
|
stage('Environment') {
|
2019-08-15 02:43:09 +08:00
|
|
|
steps {
|
2020-07-23 07:16:24 +08:00
|
|
|
script {
|
2023-03-17 02:46:17 +08:00
|
|
|
extendedStage('Runner').nodeRequirements(label: nodeLabel(), podTemplate: contractTestsStage.nodeRequirementsTemplate()).obeysAllowStages(false).execute {
|
2021-06-12 04:34:56 +08:00
|
|
|
def stages = [:]
|
|
|
|
|
2021-06-14 03:04:03 +08:00
|
|
|
def consumerEnvVars = [
|
|
|
|
'DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true',
|
|
|
|
'RUN_API_CONTRACT_TESTS=1',
|
|
|
|
]
|
|
|
|
|
2021-06-12 04:34:56 +08:00
|
|
|
callableWithDelegate(contractTestsStage.queueTestStage('Android'))(stages,
|
|
|
|
databaseName: 'pact_test1',
|
|
|
|
consumerName: 'android',
|
2021-06-14 03:04:03 +08:00
|
|
|
envVars: consumerEnvVars,
|
|
|
|
command: 'cd /usr/src/app && bundle exec rake pact:verify'
|
2021-06-12 04:34:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
callableWithDelegate(contractTestsStage.queueTestStage('Canvas iOS'))(stages,
|
|
|
|
databaseName: 'pact_test2',
|
|
|
|
consumerName: 'canvas-ios',
|
2021-06-14 03:04:03 +08:00
|
|
|
envVars: consumerEnvVars,
|
|
|
|
command: 'cd /usr/src/app && bundle exec rake pact:verify'
|
2021-06-12 04:34:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
callableWithDelegate(contractTestsStage.queueTestStage('Sistemic'))(stages,
|
|
|
|
databaseName: 'pact_test4',
|
|
|
|
consumerName: 'Sistemic',
|
2021-06-14 03:04:03 +08:00
|
|
|
envVars: consumerEnvVars,
|
|
|
|
command: 'cd /usr/src/app && bundle exec rake pact:verify'
|
2021-06-12 04:34:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
callableWithDelegate(contractTestsStage.queueTestStage('Live Events'))(stages,
|
2021-06-14 03:04:03 +08:00
|
|
|
databaseName: 'pact_test5',
|
|
|
|
command: 'cd /usr/src/app && bin/rspec spec/contracts/service_consumers/live_events --tag pact_live_events --format doc'
|
2021-06-12 04:34:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
callableWithDelegate(contractTestsStage.queueTestStage('Outcomes'))(stages,
|
|
|
|
databaseName: 'pact_test6',
|
|
|
|
envVars: [
|
2021-06-14 03:04:03 +08:00
|
|
|
"PUBLISH_API=${configuration.isChangeMerged() ? '1' : '0'}",
|
|
|
|
"SHA=${env.GERRIT_PATCHSET_REVISION}"
|
2021-06-12 04:34:56 +08:00
|
|
|
],
|
2021-06-14 03:04:03 +08:00
|
|
|
command: 'cd /usr/src/app && build/new-jenkins/pact/contracts-generate-api.sh'
|
2021-06-12 04:34:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
parallel(stages)
|
2020-04-27 23:03:34 +08:00
|
|
|
}
|
|
|
|
}
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|