Created
November 12, 2019 17:22
-
-
Save ferblape/e5ceb60c85da745331c60106a338f8a4 to your computer and use it in GitHub Desktop.
Pipeline example
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
email = "[email protected]" | |
pipeline { | |
agent any | |
environment { | |
PATH = "/home/ubuntu/.rbenv/shims:$PATH" | |
GOBIERTO_ETL_UTILS = "/var/www/gobierto-etl-utils/current/" | |
ETL = "/var/www/gobierto-etl/current/" | |
GOBIERTO = "/var/www/gobierto/current/" | |
} | |
stages { | |
stage('Extract > Download data sources') { | |
steps { | |
sh "cd ${GOBIERTO_ETL_UTILS}; ruby operations/download/run.rb 'http://data-portal.example.com/data' /tmp/gbudgets-planned-2017.json" | |
} | |
} | |
stage('Extract > Check valid JSON') { | |
steps { | |
sh "cd ${GOBIERTO_ETL_UTILS}; ruby operations/check-json/run.rb /tmp/gbudgets-planned-2017.json" | |
} | |
} | |
stage('Extract > Check data source columns') { | |
steps { | |
sh "cd ${ETL}; ruby operations/gobierto_budgets/check-json-columns/run.rb /tmp/gbudgets-planned-2017.json" | |
} | |
} | |
stage('Transform > Transform planned budgets data files') { | |
steps { | |
sh "cd ${ETL}; ruby operations/gobierto_budgets/transform-planned/run.rb /tmp/gbudgets-planned-2017.json /tmp/budgets-planned-2017-transformed.json 2017" | |
} | |
} | |
stage('Load > Import planned budgets') { | |
steps { | |
sh "cd ${ETL}; ruby operations/gobierto_budgets/import-planned-budgets/run.rb /tmp/gbudgets-planned-2017-transformed.json 2017" | |
} | |
} | |
stage('Load > Calculate totals') { | |
steps { | |
sh "echo '8211' > /tmp/gorganization.id.txt" | |
sh "cd ${GOBIERTO_ETL_UTILS}; ruby operations/gobierto_budgets/update_total_budget/run.rb '2017 2018' /tmp/gorganization.id.txt" | |
} | |
} | |
} | |
post { | |
failure { | |
echo 'This will run only if failed' | |
mail body: "Project: ${env.JOB_NAME} - Build Number: ${env.BUILD_NUMBER} - URL de build: ${env.BUILD_URL}", | |
charset: 'UTF-8', | |
subject: "ERROR CI: Project name -> ${env.JOB_NAME}", | |
to: email | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment