Unverified Commit 7641721c authored by Carlos Eduardo Ribas's avatar Carlos Eduardo Ribas Committed by GitHub
Browse files

Merge branch 'master' into master-python3

parents 4567441a 8103aca9
pipeline {
agent any
environment {
SLACK = credentials('slack-notification')
}
parameters {
choice(
name: 'EBI_SEARCH_ENDPOINT',
choices: ['DEV', 'PRO'],
description: 'Which ebi search index to use?'
)
choice(
name: 'DATABASE',
choices: ['PRO', 'DEV', 'TEST', 'HH', 'FB'],
description: 'Which database instance to use?'
)
gitParameter(
branchFilter: 'origin/(.*)',
defaultValue: 'master',
name: 'BRANCH',
type: 'PT_BRANCH',
description: 'Name of the branch to test and deploy'
)
}
stages {
stage("deploy") {
steps {
script {
// set DB with the corresponding Secret file (from K8)
switch(params.DATABASE) {
case 'PRO':
env.DB = 'db-pro'
break
case 'DEV':
env.DB = 'db-dev'
break
case 'TEST':
env.DB = 'db-test'
break
case 'FB':
env.DB = 'db-fb'
break
case 'HH':
env.DB = 'db-hh'
break
}
// set SEARCH_INDEX
switch(params.EBI_SEARCH_ENDPOINT) {
case 'PRO':
env.SEARCH_INDEX = 'search-index-prod'
break
case 'DEV':
env.SEARCH_INDEX = 'search-index-dev'
break
}
withCredentials([file(credentialsId: 'HX-WP-Config', variable: 'config')]) {
sh """
# update repository
git reset --hard
git fetch --all
git checkout ${params.BRANCH}
git pull
# send start message on Slack
curl -X POST -H 'Content-type: application/json' --data '{"text":"Starting deployment of ${params.BRANCH} in the development namespace - HX cluster"}' $SLACK
# clear the cache
POD=`/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config} get pod -l app=memcached -o jsonpath="{.items[0].metadata.name}"`
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config} exec -it \$POD -- sh -c "echo flush_all | nc localhost 11211"
# reinstall everything
cd kubernetes/helm
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm uninstall full-dev --kubeconfig ${config} --namespace dev
sleep 10
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm upgrade --install full-dev --kubeconfig ${config} --namespace dev --set proxy=proxy-hx,database=${DB},searchIndex=${SEARCH_INDEX},rnacentralBranch=${params.BRANCH} .
sleep 10
# send final message on Slack
curl -X POST -H 'Content-type: application/json' --data '{"text":"Deployed ${params.BRANCH} in the development namespace - HX cluster. This may take a few more seconds."}' $SLACK
"""
}
}
}
}
}
}
......@@ -83,7 +83,7 @@ pipeline {
}
if ("${CLUSTER}" == "HX") {
withCredentials([file(credentialsId: 'HX-WP-Config', variable: 'config')]) {
withCredentials([file(credentialsId: 'HX-WP-Config', variable: 'config-hx')]) {
sh """
# update repository
git reset --hard
......@@ -92,25 +92,25 @@ pipeline {
git pull
# send start message on Slack
curl -X POST -H 'Content-type: application/json' --data '{"text":"Starting deployment of ${params.BRANCH} in ${params.WEB} - ${CLUSTER} cluster"}' $SLACK
curl -X POST -H 'Content-type: application/json' --data '{"text":"Starting deployment of ${params.BRANCH} in ${params.WEB}"}' $SLACK
# clear the cache
POD=`/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config} get pod -l app=memcached -o jsonpath="{.items[0].metadata.name}"`
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config} exec -it \$POD -- sh -c "echo flush_all | nc localhost 11211"
POD=`/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config-hx} get pod -l app=memcached -o jsonpath="{.items[0].metadata.name}"`
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config-hx} exec -it \$POD -- sh -c "echo flush_all | nc localhost 11211"
# reinstall everything
cd kubernetes/helm
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm uninstall ${RELEASE} --kubeconfig ${config} --namespace ${NAMESPACE}
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm uninstall ${RELEASE} --kubeconfig ${config-hx} --namespace ${NAMESPACE}
sleep 10
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm upgrade --install ${RELEASE} --kubeconfig ${config} --namespace ${NAMESPACE} ${VALUES} --set proxy=proxy-hx,database=${DB},searchIndex=${SEARCH_INDEX},rnacentralBranch=${params.BRANCH} .
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm upgrade --install ${RELEASE} --kubeconfig ${config-hx} --namespace ${NAMESPACE} ${VALUES} --set proxy=proxy-hx,database=${DB},searchIndex=${SEARCH_INDEX},rnacentralBranch=${params.BRANCH} .
sleep 10
# send final message on Slack
curl -X POST -H 'Content-type: application/json' --data '{"text":"Deployed ${params.BRANCH} in ${params.WEB} - ${CLUSTER} cluster. This may take a few more seconds."}' $SLACK
curl -X POST -H 'Content-type: application/json' --data '{"text":"Deployed ${params.BRANCH} in ${params.WEB}. This may take a few more seconds."}' $SLACK
"""
}
} else if ("${CLUSTER}" == "HH") {
withCredentials([file(credentialsId: 'HH-WP-Config', variable: 'config')]) {
withCredentials([file(credentialsId: 'HH-WP-Config', variable: 'config-hh')]) {
sh """
# update repository
git reset --hard
......@@ -119,21 +119,21 @@ pipeline {
git pull
# send start message on Slack
curl -X POST -H 'Content-type: application/json' --data '{"text":"Starting deployment of ${params.BRANCH} in ${params.WEB} - ${CLUSTER} cluster"}' $SLACK
curl -X POST -H 'Content-type: application/json' --data '{"text":"Starting deployment of ${params.BRANCH} in ${params.WEB}"}' $SLACK
# clear the cache
POD=`/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config} get pod -l app=memcached -o jsonpath="{.items[0].metadata.name}"`
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config} exec -it \$POD -- sh -c "echo flush_all | nc localhost 11211"
POD=`/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config-hh} get pod -l app=memcached -o jsonpath="{.items[0].metadata.name}"`
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/kubectl --kubeconfig=${config-hh} exec -it \$POD -- sh -c "echo flush_all | nc localhost 11211"
# reinstall everything
cd kubernetes/helm
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm uninstall ${RELEASE} --kubeconfig ${config} --namespace ${NAMESPACE}
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm uninstall ${RELEASE} --kubeconfig ${config-hh} --namespace ${NAMESPACE}
sleep 10
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm upgrade --install ${RELEASE} --kubeconfig ${config} --namespace ${NAMESPACE} ${VALUES} --set proxy=proxy-hh,database=${DB},searchIndex=${SEARCH_INDEX},rnacentralBranch=${params.BRANCH} .
/net/isilonP/public/rw/homes/xfm_adm/.jenkins/helm upgrade --install ${RELEASE} --kubeconfig ${config-hh} --namespace ${NAMESPACE} ${VALUES} --set proxy=proxy-hh,database=${DB},searchIndex=${SEARCH_INDEX},rnacentralBranch=${params.BRANCH} .
sleep 10
# send final message on Slack
curl -X POST -H 'Content-type: application/json' --data '{"text":"Deployed ${params.BRANCH} in ${params.WEB} - ${CLUSTER} cluster. This may take a few more seconds."}' $SLACK
curl -X POST -H 'Content-type: application/json' --data '{"text":"Deployed ${params.BRANCH} in ${params.WEB}. This may take a few more seconds."}' $SLACK
"""
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment