-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile * add Jenkinsfile
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
@Library('pipelinex@development') | ||
import com.iguazio.pipelinex.JobException | ||
|
||
def node_label = 'ubuntu-ui-runner' | ||
|
||
common.set_current_display_name("UI_CI_Test") | ||
|
||
common.main { | ||
timestamps { | ||
nodes.runner(node_label) { | ||
stage('UI CI Test') { | ||
|
||
common.conditional_stage('Pull Latest Changes', true) { | ||
checkout scm | ||
} | ||
|
||
common.conditional_stage('Set up Environment', true) { | ||
|
||
sh 'npm install' | ||
} | ||
|
||
common.conditional_stage('Start Services', true) { | ||
sh ''' | ||
npm run mock-server & | ||
npm start & | ||
''' | ||
} | ||
|
||
common.conditional_stage('Run Regression Tests', true) { | ||
// Run cucumber-js tests | ||
sh './node_modules/.bin/cucumber-js --require-module @babel/register --require-module @babel/polyfill -f json:tests/reports/cucumber_report.json -f html:tests/reports/cucumber_report_default.html tests -t \'@smoke\'' | ||
} | ||
|
||
common.conditional_stage('Post-Test Cleanup', true) { | ||
sh ''' | ||
kill %1 || true | ||
kill %2 || true | ||
# Ensure any remaining background processes are terminated | ||
pkill -f npm || true | ||
''' | ||
} | ||
|
||
common.conditional_stage('Upload Artifacts', true) { | ||
sh ''' | ||
# touch tests/reports/cucumber_report_default.html | ||
# Environment variables | ||
ART_URL="http://artifactory.iguazeng.com:8082/artifactory/ui-ci-reports" | ||
AUTH="${ARTIFACTORY_CRED}" | ||
LOCAL_FILE="tests/reports/cucumber_report_default.html" | ||
# Generate the Artifactory path with the build number | ||
ARTIFACTORY_PATH="cucumber_report_default_${BUILD_NUMBER}.html" | ||
# Construct the full URL | ||
URL="${ART_URL}/${ARTIFACTORY_PATH}" | ||
# Upload the file to Artifactory | ||
curl -X PUT -u ${AUTH} "${URL}" --data-binary @"${LOCAL_FILE}" | ||
''' | ||
} | ||
|
||
common.conditional_stage('Cleaning up', true) { | ||
sh ''' | ||
pkill -f npm || true | ||
''' | ||
} | ||
|
||
common.conditional_stage('Build Status', true) { | ||
script { | ||
if (currentBuild.currentResult == 'SUCCESS') { | ||
echo 'Build was successful!' | ||
} else { | ||
echo 'Build failed!' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |