Adding auto deploy to staging in kube (#219)

This commit is contained in:
Philip Hutchins 2018-08-14 10:00:39 -05:00 committed by GitHub
parent c7adc1dfb8
commit 0440d5fbe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

19
Jenkinsfile vendored
View File

@ -9,14 +9,23 @@ node('node') {
sh 'make test-docker images'
}
stage('Deploy') {
if (env.BRANCH_NAME != 'master') {
echo 'Skipping deploy stage'
return
}
stage('Push Images') {
echo 'Push to Repo'
sh 'make push-images'
}
stage('Deploy') {
/* This should only deploy to staging if the branch is master */
if (env.BRANCH_NAME == "master") {
sh "./scripts/deploy.staging.sh satellite storjlabs/storj-satellite:${commit_id}"
for (int i = 1; i < 60; i++) {
sh "./scripts/deploy.staging.sh storage-node-${i} storjlabs/storj-storage-node:${commit_id}"
}
}
return
}
}
catch (err) {
currentBuild.result = "FAILURE"

7
scripts/deploy.staging.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
PROJECT_NAME=$1
CONTAINER=$2
kubectl config set-cluster storj-nonprod
kubectl --namespace storj-staging patch deployment $PROJECT_NAME -p"{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"$PROJECT_NAME\",\"image\":\"$CONTAINER\"}]}}}}"