Skip to content

Commit

Permalink
[#682] add verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-semenets committed Dec 22, 2018
1 parent d488afe commit 938ea47
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions deploy/legionPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ def buildDescription(){
currentBuild.description = "${env.param_profile} ${env.param_git_branch}"
}

def ansibleContainerMount() {
("${param_debug_run}" == "true" ) ? "${WORKSPACE}/deploy:/opt/legion/deploy" : "${WORKSPACE}/deploy/profiles:/opt/legion/deploy/profiles"
}

def createCluster() {
def verbose = ("${param_debug_run}" == 'true') ? '-vvvv' : ''
withCredentials([
file(credentialsId: "vault-${env.param_profile}", variable: 'vault')]) {
withAWS(credentials: 'kops') {
Expand All @@ -35,8 +32,8 @@ def createCluster() {
else
cd /opt/legion/deploy/ansible
fi
pwd
#ansible-playbook create-cluster.yml \
ansible-playbook create-cluster.yml \
${verbose} \
--vault-password-file=${vault} \
--extra-vars "profile=${env.param_profile} \
legion_version=${env.param_legion_version} \
Expand All @@ -58,7 +55,15 @@ def terminateCluster() {
docker.image("${env.param_docker_repo}/k8s-ansible:${env.param_legion_version}").inside("-e HOME=/opt/deploy/legion -v ${WORKSPACE}/deploy/profiles:/opt/legion/deploy/profiles -u root") {
stage('Create cluster') {
sh """
cd /opt/legion/deploy/ansible && ansible-playbook terminate-cluster.yml \
set -e
# Run ansible from workspace for debug or from baked code inside container
if [ ${param_debug_run} = 'true' ]; then
cd ${WORKSPACE}/deploy/ansible
else
cd /opt/legion/deploy/ansible
fi
ansible-playbook terminate-cluster.yml \
${param_debug_run} ? "-vvvv" : "" \
--vault-password-file=${vault} \
--extra-vars "profile=${env.param_profile} \
keep_jenkins_volume=${env.param_keep_jenkins_volume}"
Expand All @@ -78,7 +83,15 @@ def deployLegion() {
docker.image("${env.param_docker_repo}/k8s-ansible:${env.param_legion_version}").inside("-e HOME=/opt/deploy/legion -v ${param_debug_run} ? ${WORKSPACE}/deploy:/opt/legion/deploy : ${WORKSPACE}/deploy/profiles:/opt/legion/deploy/profiles -u root") {
stage('Deploy Legion') {
sh """
cd /opt/legion/deploy/ansible && ansible-playbook deploy-legion.yml \
set -e
# Run ansible from workspace for debug or from baked code inside container
if [ ${param_debug_run} = 'true' ]; then
cd ${WORKSPACE}/deploy/ansible
else
cd /opt/legion/deploy/ansible
fi
ansible-playbook deploy-legion.yml \
${param_debug_run} ? "-vvvv" : "" \
--vault-password-file=${vault} \
--extra-vars "profile=${env.param_profile} \
legion_version=${env.param_legion_version} \
Expand Down Expand Up @@ -260,7 +273,15 @@ def deployLegionEnclave() {
docker.image("${env.param_docker_repo}/k8s-ansible:${env.param_legion_version}").inside("-e HOME=/opt/deploy/legion -v ${WORKSPACE}/deploy/profiles:/opt/legion/deploy/profiles -u root") {
stage('Deploy Legion') {
sh """
cd /opt/legion/deploy/ansible && ansible-playbook deploy-legion.yml \
set -e
# Run ansible from workspace for debug or from baked code inside container
if [ ${param_debug_run} = 'true' ]; then
cd ${WORKSPACE}/deploy/ansible
else
cd /opt/legion/deploy/ansible
fi
ansible-playbook deploy-legion.yml \
--vault-password-file=${vault} \
--extra-vars "profile=${env.param_profile} \
legion_version=${env.param_legion_version} \
Expand All @@ -285,7 +306,15 @@ def terminateLegionEnclave() {
docker.image("${env.param_docker_repo}/k8s-ansible:${env.param_legion_version}").inside("-e HOME=/opt/deploy/legion -v ${WORKSPACE}/deploy/profiles:/opt/legion/deploy/profiles -u root") {
stage('Terminate Legion Enclave') {
sh """
cd /opt/legion/deploy/ansible && ansible-playbook terminate-legion-enclave.yml \
set -e
# Run ansible from workspace for debug or from baked code inside container
if [ ${param_debug_run} = 'true' ]; then
cd ${WORKSPACE}/deploy/ansible
else
cd /opt/legion/deploy/ansible
fi
ansible-playbook terminate-legion-enclave.yml \
${param_debug_run} ? "-vvvv" : "" \
--vault-password-file=${vault} \
--extra-vars "profile=${env.param_profile} \
enclave_name=${env.param_enclave_name}"
Expand Down

0 comments on commit 938ea47

Please sign in to comment.