diff --git a/Gemfile b/Gemfile index 2c1835df..be8ca707 100644 --- a/Gemfile +++ b/Gemfile @@ -87,7 +87,6 @@ gem 'sidekiq' gem 'inline_svg' gem 'marc' gem 'rexml' # see https://github.com/ruby-marc/ruby-marc/issues/67... -gem 'sidekiq' gem 'whenever' gem 'rack-attack' diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..e937e3ca --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,51 @@ +pipeline { + agent any + + environment { + SIDEKIQ_PRO_SECRET = credentials("sidekiq_pro_secret") + SLACK_WEBHOOK_URL = credentials("access_slack_webhook") + } + + stages { + stage('Deploy on release') { + + when { + tag "v*" + } + + steps { + checkout scm + + sshagent (['sul-devops-team', 'sul-continuous-deployment']){ + sh '''#!/bin/bash -l + export DEPLOY=1 + export REVISION=$TAG_NAME + + # Load RVM + rvm use 3.0.1@pod --create + gem install bundler + + bundle install --without production + + # Deploy it + bundle exec cap prod deploy + ''' + } + } + + post { + success { + sh '''#!/bin/bash -l + curl -X POST -H 'Content-type: application/json' --data '{"text":"The deploy to prod was successful"}' $SLACK_WEBHOOK_URL + ''' + } + + failure { + sh '''#!/bin/bash -l + curl -X POST -H 'Content-type: application/json' --data '{"text":"The deploy to prod was unsuccessful"}' $SLACK_WEBHOOK_URL + ''' + } + } + } + } +}