From 7e49129254eca9b6b995c2765d1941f4e088c14d Mon Sep 17 00:00:00 2001 From: Arun Date: Wed, 5 Dec 2018 13:41:44 +0530 Subject: [PATCH] Arun: Added jenkins file --- Jenkinsfile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3c78854 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,46 @@ +pipeline { + agent any + environment { + GITHUB_API_TOKEN = credentials('repo:status:deployment') + RUN_DISPLAY_URL = "${env.RUN_DISPLAY_URL}" + } + stages { + stage('Security testing') { + steps { + + } + post { + success{ + sh ''' + curl -XPOST -H "Authorization: token $GITHUB_API_TOKEN" https://api.github.com/repos/aruncsengr/name_directory/statuses/$GIT_COMMIT -d '{"state": "success","target_url": "'"$RUN_DISPLAY_URL"'","description": "Good to go!","context": "Jiffle CI/Security"}' + ''' + } + failure{ + sh ''' + curl -XPOST -H "Authorization: token $GITHUB_API_TOKEN" https://api.github.com/repos/aruncsengr/name_directory/statuses/$GIT_COMMIT -d '{"state": "failure","target_url": "'"$RUN_DISPLAY_URL"'","description": "Something went wrong!","context": "Jiffle CI/Security"}' + ''' + } + } + } + stage('Unit testing') { + steps { + + } + post{ + always{ + junit 'spec/reports/*.xml' + } + success{ + sh ''' + curl -XPOST -H "Authorization: token $GITHUB_API_TOKEN" https://api.github.com/repos/aruncsengr/name_directory/statuses/$GIT_COMMIT -d '{"state": "success","target_url": "'"$RUN_DISPLAY_URL"'","description": "Good to go!","context": "Jiffle CI/Unit testing"}' + ''' + } + failure{ + sh ''' + curl -XPOST -H "Authorization: token $GITHUB_API_TOKEN" https://api.github.com/repos/aruncsengr/name_directory/statuses/$GIT_COMMIT -d '{"state": "failure","target_url": "'"$RUN_DISPLAY_URL"'","description": "Something went wrong!","context": "Jiffle CI/Unit testing"}' + ''' + } + } + } + } +}