forked from openprivacy/buildfiles
cleanup junk
This commit is contained in:
parent
b47768daa3
commit
229022a7e5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,110 +0,0 @@
|
|||
node {
|
||||
try{
|
||||
notifyBuild('STARTED')
|
||||
|
||||
// ws
|
||||
dir("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/") {
|
||||
withEnv(["GOROOT=/opt/go", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}", "PATH=$PATH:/opt/go/bin"]) {
|
||||
withEnv(["PATH=${GOPATH}/bin:$PATH"]) {
|
||||
|
||||
stage('Checkout'){
|
||||
echo 'Checking out code from git'
|
||||
|
||||
//checkout scm
|
||||
//git url: 'https://github.com/jfrogdev/project-examples.git'
|
||||
checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://git.openprivacy.ca/cwtch.im/cwtch.git']]])
|
||||
}
|
||||
|
||||
stage('Fetching Dependancies'){
|
||||
echo 'Pulling Dependencies'
|
||||
echo "GOPATH: $GOPATH"
|
||||
echo "PATH: $PATH"
|
||||
|
||||
sh 'go version'
|
||||
sh 'go get -u github.com/golang/lint/golint'
|
||||
|
||||
dir("${GOPATH}") {
|
||||
sh 'mkdir -p src/cwtch.im'
|
||||
sh 'ln -sf ${GOPATH} src/cwtch.im/cwtch'
|
||||
|
||||
sh """go list ./... | grep _/var | sed -e 's/^.*${BUILD_ID}//' | awk '\$0="./src/cwtch.im/cwtch"\$0' > projectPaths"""
|
||||
|
||||
sh 'cat projectPaths | xargs go get'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Code Quality'){
|
||||
|
||||
dir("${GOPATH}") {
|
||||
|
||||
echo 'Vetting'
|
||||
sh """cat projectPaths | xargs go vet"""
|
||||
|
||||
echo 'Linting'
|
||||
sh """cat projectPaths | xargs golint -set_exit_status"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Unit Tests'){
|
||||
dir("${GOPATH}") {
|
||||
echo 'Unit Testing'
|
||||
// -race - removed until passing
|
||||
sh """cat projectPaths | grep -v testing | xargs go test -cover"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Integration Test'){
|
||||
dir("${GOPATH}") {
|
||||
echo 'Integration Testing'
|
||||
// -race - removed until passing
|
||||
sh """go test cwtch.im/cwtch/testing"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// If there was an exception thrown, the build failed
|
||||
currentBuild.result = "FAILED"
|
||||
echo(e)
|
||||
} finally {
|
||||
// Success or failure, always send notifications
|
||||
notifyBuild(currentBuild.result)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use for cwtch notifications
|
||||
def notifyBuild(String buildStatus = 'STARTED') {
|
||||
// build status of null means successful
|
||||
buildStatus = buildStatus ?: 'SUCCESSFUL'
|
||||
|
||||
// Default values
|
||||
def colorName = 'RED'
|
||||
def colorCode = '#FF0000'
|
||||
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
|
||||
def summary = """${subject}
|
||||
${env.JOB_NAME}: ${env.JOB_URL}
|
||||
Build: ${env.BUILD_URL}/flowGraphTable"""
|
||||
|
||||
// Override default values based on build status
|
||||
if (buildStatus == 'STARTED') {
|
||||
color = 'YELLOW'
|
||||
colorCode = '#FFFF00'
|
||||
} else if (buildStatus == 'SUCCESSFUL') {
|
||||
color = 'GREEN'
|
||||
colorCode = '#00FF00'
|
||||
} else {
|
||||
color = 'RED'
|
||||
colorCode = '#FF0000'
|
||||
}
|
||||
|
||||
// Send notifications
|
||||
//slackSend (color: colorCode, message: summary)
|
||||
emailext (
|
||||
subject: "[JENKINS] ${subject}",
|
||||
to: 'dan@openprivacy.ca',
|
||||
body: summary,
|
||||
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
|
||||
from: 'dan@openprivacy.ca'
|
||||
)
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
pipeline {
|
||||
parameters {
|
||||
string(
|
||||
name: 'repo',
|
||||
defaultValue:"cwtch.im/cwtch",
|
||||
description: "repo to build from")
|
||||
}
|
||||
|
||||
agent any
|
||||
|
||||
environment {
|
||||
GOROOT = "/opt/go"
|
||||
GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"
|
||||
PATH = "$PATH:/opt/go/bin:${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/bin"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout'){
|
||||
steps {
|
||||
echo 'Checking out code from git'
|
||||
echo params.repo
|
||||
//checkout scm
|
||||
//git url: 'https://github.com/jfrogdev/project-examples.git'
|
||||
dir("${GOPATH}") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://git.openprivacy.ca/cwtch.im/cwtch.git']]])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Fetching Dependancies'){
|
||||
steps {
|
||||
echo 'Pulling Dependencies'
|
||||
echo "GOPATH: $GOPATH"
|
||||
echo "PATH: $PATH"
|
||||
|
||||
|
||||
sh 'go version'
|
||||
sh 'go get -u github.com/golang/lint/golint'
|
||||
|
||||
dir("${GOPATH}") {
|
||||
sh 'mkdir -p src/cwtch.im'
|
||||
sh 'ln -sf ${GOPATH} src/cwtch.im/cwtch'
|
||||
|
||||
sh """go list ./... | grep _/var | sed -e 's/^.*${BUILD_ID}//' | awk '\$0="./src/cwtch.im/cwtch"\$0' > projectPaths"""
|
||||
|
||||
sh 'cat projectPaths | xargs go get'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Code Quality'){
|
||||
steps {
|
||||
|
||||
dir("${GOPATH}") {
|
||||
|
||||
echo 'Vetting'
|
||||
sh """cat projectPaths | xargs go vet"""
|
||||
|
||||
echo 'Linting'
|
||||
sh """cat projectPaths | xargs golint -set_exit_status"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Unit Tests'){
|
||||
steps {
|
||||
dir("${GOPATH}") {
|
||||
echo 'Unit Testing'
|
||||
// -race - removed until passing
|
||||
sh """cat projectPaths | grep -v testing | xargs go test -cover"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Integration Test'){
|
||||
steps {
|
||||
dir("${GOPATH}") {
|
||||
echo 'Integration Testing'
|
||||
// -race - removed until passing
|
||||
sh """go test cwtch.im/cwtch/testing"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
notifyBuild("SUCCESS")
|
||||
}
|
||||
failure {
|
||||
notifyBuild("FAILURE")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use for cwtch notifications
|
||||
def notifyBuild(String buildStatus = 'STARTED') {
|
||||
// build status of null means successful
|
||||
buildStatus = buildStatus ?: 'SUCCESSFUL'
|
||||
|
||||
// Default values
|
||||
def colorName = 'RED'
|
||||
def colorCode = '#FF0000'
|
||||
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
|
||||
def summary = """${subject}
|
||||
${env.JOB_NAME}: ${env.JOB_URL}
|
||||
Build: ${env.BUILD_URL}/flowGraphTable"""
|
||||
|
||||
// Override default values based on build status
|
||||
if (buildStatus == 'STARTED') {
|
||||
color = 'YELLOW'
|
||||
colorCode = '#FFFF00'
|
||||
} else if (buildStatus == 'SUCCESSFUL') {
|
||||
color = 'GREEN'
|
||||
colorCode = '#00FF00'
|
||||
} else {
|
||||
color = 'RED'
|
||||
colorCode = '#FF0000'
|
||||
}
|
||||
|
||||
// Send notifications
|
||||
//slackSend (color: colorCode, message: summary)
|
||||
emailext (
|
||||
subject: "[JENKINS] ${subject}",
|
||||
to: 'dan@openprivacy.ca',
|
||||
body: summary,
|
||||
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
|
||||
from: 'dan@openprivacy.ca'
|
||||
)
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
curl -H "Authorization: token $BUILDBOT" -H "Content-Type: application/json" -d "{\"Body\": \"Drone Build Status: ${DRONE_BUILD_STATUS}\n\n${DRONE_BUILD_LINK}\"}" -X POST https://git.openprivacy.ca/api/v1/repos/${DRONE_REPO}/issues/${DRONE_PULL_REQUEST}/comments
|
||||
|
Loading…
Reference in New Issue