-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook up continuous deployment via jenkins
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
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
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,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 | ||
''' | ||
} | ||
} | ||
} | ||
} | ||
} |