Skip to content

Commit

Permalink
add pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
rawlingsj committed Jan 18, 2018
1 parent d4a0d51 commit 66366e5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bin
.idea

release/
58 changes: 32 additions & 26 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
#!/usr/bin/groovy
@Library('github.com/fabric8io/fabric8-pipeline-library@master')
def dummy
goNode{
dockerNode{
ws{
if (env.BRANCH_NAME.startsWith('PR-')) {
def buildPath = "/home/jenkins/go/src/github.com/jenkins-x/jx-release-version"
sh "mkdir -p ${buildPath}"

dir(buildPath) {
container(name: 'go') {
stage ('build binary'){
// it looks like using checkout scm looses the tags
sh "git clone https://github.com/jenkins-x/jx-release-version ."
sh "git fetch origin pull/${env.CHANGE_ID}/head:test"
sh "git checkout test"
sh "make"
pipeline {
agent {
label "jenkins-go"
}
stages {
stage('CI Build and Test') {
when {
branch 'PR-*'
}
steps {
dir ('/home/jenkins/go/src/github.com/jenkins-x/jx-release-version') {
checkout scm
container('go') {
sh "make"
sh "./bin/jx-release-version-linux"
}
}
}
}
} else if (env.BRANCH_NAME.equals('master')) {
def v = goRelease{
githubOrganisation = 'rawlingsj'
dockerOrganisation = 'fabric8'
project = 'jx-release-version'

stage('Build and Release') {
environment {
GH_CREDS = credentials('jenkins-x-github')
}
when {
branch 'master'
}
steps {
dir ('/home/jenkins/go/src/github.com/jenkins-x/jx-release-version') {
checkout scm
container('go') {
sh "GITHUB_ACCESS_TOKEN=$GH_CREDS_PSW make release"
}
}
}
}
}
}
}
}

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME := jx-release-version
ORG := jenkins-x
ROOT_PACKAGE := main.go
VERSION := 1.0.4
VERSION := $(shell jx-release-version)

GO := GO15VENDOREXPERIMENT=1 go
REVISION := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown')
Expand Down

0 comments on commit 66366e5

Please sign in to comment.