Skip to content

Commit

Permalink
[#682] move condition to bash
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-semenets committed Dec 22, 2018
1 parent 4a51e7a commit 4b44bc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 1 addition & 2 deletions deploy/create-cluster.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ pipeline {
stage('Create Kubernetes Cluster') {
steps {
script {
mounts = legion.ansibleContainerMount()
legion.createCluster(mounts)
legion.createCluster()
}
}
}
Expand Down
17 changes: 13 additions & 4 deletions deploy/legionPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,25 @@ def ansibleContainerMount() {
("${param_debug_run}" == "true" ) ? "${WORKSPACE}/deploy:/opt/legion/deploy" : "${WORKSPACE}/deploy/profiles:/opt/legion/deploy/profiles"
}

def createCluster(mounts) {
print(mounts)
def createCluster() {
withCredentials([
file(credentialsId: "vault-${env.param_profile}", variable: 'vault')]) {
withAWS(credentials: 'kops') {
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: "xterm"]) {
docker.image("${env.param_docker_repo}/k8s-ansible:${env.param_legion_version}").inside("-e HOME=/opt/deploy/legion -v ${mounts} -v /etc/ssl:/etc/ssl -u root") {
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 -v /etc/ssl:/etc/ssl -u root") {
stage('Create cluster') {
sh """
cd /opt/legion/deploy/ansible && ansible-playbook create-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
pwd
#ansible-playbook create-cluster.yml \
--vault-password-file=${vault} \
--extra-vars "profile=${env.param_profile} \
legion_version=${env.param_legion_version} \
Expand Down

0 comments on commit 4b44bc7

Please sign in to comment.