Skip to content

Commit

Permalink
Add Azure pipelines (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfeely committed Oct 21, 2019
1 parent 859acd6 commit b3dc33f
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.11 AS builder

WORKDIR /go/src/github.com/newrelic/fluent-bit/newrelic-fluent-bit-output

COPY .git Makefile go.* *.go *.h /go/src/github.com/newrelic/fluent-bit/newrelic-fluent-bit-output/
COPY Makefile go.* *.go *.h /go/src/github.com/newrelic/fluent-bit/newrelic-fluent-bit-output/
ENV SOURCE docker
RUN go get github.com/fluent/fluent-bit-go/output
RUN make all
Expand Down
65 changes: 65 additions & 0 deletions merge-to-master-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Run any time a commit is merged to the 'master' branch
trigger:
- master

# There is a separate pipeline for PRs (it does not do deploys)
pr: none

pool:
vmImage: 'ubuntu-16.04' # Has Docker

variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '/usr/local/go1.12'
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code

steps:
- script: |
mkdir -p '$(GOBIN)'
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(modulePath)'
shopt -s extglob
mv !(gopath) '$(modulePath)'
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
displayName: 'Set up the Go workspace'

- task: Bash@3
displayName: 'Run tests'
inputs:
targetType: 'inline'
workingDirectory: '$(modulePath)'
script: |
go get -v -u github.com/jstemmer/go-junit-report
go test -v 2>&1 | go-junit-report > test-results.xml
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(modulePath)/test-results.xml'
failTaskOnFailedTests: true

- task: Bash@3
displayName: 'Build the plugin'
inputs:
targetType: 'inline'
workingDirectory: '$(modulePath)'
script: |
DOCKER_IMAGE_VERSION=`cat version.go | grep VERSION | awk '{gsub(/"/, "", $4); print $4}'`
echo "##vso[task.setvariable variable=DOCKER_IMAGE_VERSION]$DOCKER_IMAGE_VERSION"
make all
- task: Docker@2
displayName: Login to Docker Hub
inputs:
command: login
containerRegistry: DockerHub

- task: Docker@2
displayName: Build and push Docker image to Docker Hub
inputs:
command: buildAndPush
buildContext: '$(modulePath)'
repository: newrelic/newrelic-fluentbit-output
tags: $(DOCKER_IMAGE_VERSION)
40 changes: 40 additions & 0 deletions pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pr:
branches:
include:
- '*'

pool:
vmImage: 'ubuntu-16.04' # Has Docker

variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '/usr/local/go1.12'
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code

steps:
- script: |
mkdir -p '$(GOBIN)'
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(modulePath)'
shopt -s extglob
mv !(gopath) '$(modulePath)'
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
displayName: 'Set up the Go workspace'

- task: Bash@3
displayName: 'Run tests'
inputs:
targetType: 'inline'
workingDirectory: '$(modulePath)'
script: |
go get -v -u github.com/jstemmer/go-junit-report
go test -v 2>&1 | go-junit-report > test-results.xml
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(modulePath)/test-results.xml'
failTaskOnFailedTests: true

0 comments on commit b3dc33f

Please sign in to comment.