Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
pipeline { agent any stages { stage('Synch (update) recent tests to Xray'){ steps { checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'a3285253-a867-4ea7-a843-da349fd36490', url: 'ssh://git@localhost/home/git/repos/automation-samples.git']]]) step([$class: 'XrayImportFeatureBuilder', folderPath: 'cucumber_xray_tests/features', lastModified: '10', projectKey: 'CALC', serverInstance: '552d0cb6-6f8d-48ba-bbad-50e94f39b722']) } } stage('Export features from Xray'){ steps { checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'a3285253-a867-4ea7-a843-da349fd36490', url: 'ssh://git@localhost/home/git/repos/automation-samples.git']]]) sh "rm -rf cucumber_xray_tests/features" step([$class: 'XrayExportBuilder', filePath: 'cucumber_xray_tests/features', filter: '11400', serverInstance: '552d0cb6-6f8d-48ba-bbad-50e94f39b722']) } } stage('Test'){ steps{ sh "cd cucumber_xray_tests && cucumber -x -f json -o data.json" } } stage('Import results to Xray') { steps { step([$class: 'XrayImportBuilder', endpointName: '/cucumber', importFilePath: 'cucumber_xray_tests/data.json', serverInstance: '552d0cb6-6f8d-48ba-bbad-50e94f39b722']) } } } } |
Using parameters
You can ask for human input in you pipeline builds by passing parameters
Code Block | ||||
---|---|---|---|---|
| ||||
pipeline{
agent any
parameters {
string(defaultValue: "NTP", description: '', name: 'projectKey')
string(defaultValue: "Android", description: '', name: 'env')
}
stages {
stage ('Import Results') {
steps {
step([$class: 'XrayImportBuilder',
endpointName: '/junit',
importFilePath: 'java-junit-calc/target/surefire-reports/*.xml',
importToSameExecution: 'true',
projectKey: params.projectKey,
revision: params.projectKey + env.BUILD_NUMBER,
serverInstance: '552d0cb6-6f8d-48ba-bbad-50e94f39b722',
testEnvironments: params.env])
}
}
}
} |
Recommendations
You can automatically generate your step scripts using the Jenkins Snippet Generator.
...