Skip to content

Commit

Permalink
testing multi-branch pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jredbeard committed Feb 3, 2017
1 parent 99a0ee0 commit b3f848b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
20 changes: 20 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pipeline {
agent any

stages {
stage('Build') {
steps {
checkout scm
sh 'ciscripts/triggerbuild.sh'
}
}
}
post {
success {
sh 'ciscripts/buildsuccess.sh'
}
failure {
sh 'ciscripts/buildfailure.sh'
}
}
}
3 changes: 1 addition & 2 deletions ciscripts/buildfailure.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/bash
cd $BUILD_SPACE
curl -XPOST -H "Authorization: token $GITHUB_SECRET" https://api.github.com/repos/steemit/steem/statuses/$(git rev-parse HEAD) -d "{
\"state\": \"failure\",
\"target_url\": \"${BUILD_URL}\",
\"description\": \"JenkinsCI reports the build has failed!\",
\"context\": \"jenkins-ci-steemit\"
}"
rm -rf $WORKSPACE/$BUILD_SPACE
#rm -rf $WORKSPACE/*
# make docker cleanup after itself and delete all exited containers
sudo docker rm -v $(docker ps -a -q -f status=exited) || true
7 changes: 7 additions & 0 deletions ciscripts/buildpending.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
curl -XPOST -H "Authorization: token $GITHUB_SECRET" https://api.github.com/repos/steemit/steem/statuses/$(git rev-parse HEAD) -d "{
\"state\": \"pending\",
\"target_url\": \"${BUILD_URL}\",
\"description\": \"The build is now pending in jenkinsci!\",
\"context\": \"jenkins-ci-steemit\"
}"
11 changes: 0 additions & 11 deletions ciscripts/buildscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ export IMAGE_NAME="steemit/steem:${GIT_BRANCH#*/}"
if [[ $IMAGE_NAME == "steemit/steem:stable" ]] ; then
IMAGE_NAME="steemit/steem:latest"
fi
# switch workspace into directory used for branch
export BUILD_SPACE=`mktemp -d`
cp -a temp-repo-folder/. $BUILD_SPACE
rm -rf temp-repo-folder/*
cd $BUILD_SPACE
curl -XPOST -H "Authorization: token $GITHUB_SECRET" https://api.github.com/repos/steemit/steem/statuses/$(git rev-parse HEAD) -d "{
\"state\": \"pending\",
\"target_url\": \"${BUILD_URL}\",
\"description\": \"The build is now pending in jenkinsci!\",
\"context\": \"jenkins-ci-steemit\"
}"
sudo docker build -t=$IMAGE_NAME .
sudo docker login --username=$DOCKER_USER --password=$DOCKER_PASS
sudo docker push $IMAGE_NAME
Expand Down
4 changes: 2 additions & 2 deletions ciscripts/buildsuccess.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#/bin/bash
cd $BUILD_SPACE
#testcommit
curl -XPOST -H "Authorization: token $GITHUB_SECRET" https://api.github.com/repos/steemit/steem/statuses/$(git rev-parse HEAD) -d "{
\"state\": \"success\",
\"target_url\": \"${BUILD_URL}\",
\"description\": \"Jenkins-CI reports build succeeded!!\",
\"context\": \"jenkins-ci-steemit\"
}"
rm -rf $WORKSPACE/$BUILD_SPACE
#rm -rf $WORKSPACE/*
# make docker cleanup after itself and delete all exited containers
sudo docker rm -v $(docker ps -a -q -f status=exited) || true

0 comments on commit b3f848b

Please sign in to comment.