Skip to content

Commit

Permalink
Merge pull request #32 from AirHelp/feature/go-mod-Jenkinsfile
Browse files Browse the repository at this point in the history
AIR-25385 Add jenkinsfile and migrate from dep to go mod
  • Loading branch information
kszarek authored Feb 13, 2019
2 parents cc4c539 + e8b3e18 commit 906ee7c
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 114 deletions.
16 changes: 9 additions & 7 deletions Dockerfile-test
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM golang:1.10-alpine
FROM golang:1.11-alpine
ENV GO111MODULE=on
ENV CGO_ENABLED=0

WORKDIR /go/src/github.com/AirHelp/treasury
RUN apk add --no-cache git && go get github.com/golang/dep/cmd/dep
WORKDIR /usr/src/app

RUN apk add --no-cache git

COPY go.mod go.sum ./
RUN go mod download

# copies the Gopkg.toml and Gopkg.lock to WORKDIR
COPY Gopkg.toml Gopkg.lock ./
# install the dependencies without checking for go code
RUN dep ensure -v -vendor-only
COPY . .
CMD ["go", "test", "-cover", "-v", "./..."]
75 changes: 0 additions & 75 deletions Gopkg.lock

This file was deleted.

30 changes: 0 additions & 30 deletions Gopkg.toml

This file was deleted.

50 changes: 50 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!groovy

def label = "treasury-${UUID.randomUUID().toString()}"

podTemplate(label: label, containers: [
containerTemplate(
name: 'golang',
image: 'golang:1.11-alpine',
ttyEnabled: true,
command: 'cat',
resourceRequestCpu: '100m',
resourceRequestMemory: '128Mi',
envVars: [
envVar(key: 'GO111MODULE', value: 'on'),
envVar(key: 'CGO_ENABLED', value: '0'),
]
)
]) {
node(label) {
stage('github checkout') {
checkout scm
}

stage('download Go deps') {
container('golang'){
sh 'apk add --no-cache git'
sh 'go mod download'
}
}

stage('go test') {
container('golang'){
sh 'go test -cover -v ./...'
}
}

stage('go formatting') {
container('golang'){
sh 'gofmt -s -w .'
}
}

stage('go vet') {
container('golang'){
sh 'go vet -v ./...'
}
}

}
}
2 changes: 1 addition & 1 deletion client/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestImportS3(t *testing.T) {
func TestImportSSM(t *testing.T) {
prefix := "test/webapp/"
dummyClientOptions := &client.Options{
Backend: &test.MockBackendClient{},
Backend: &test.MockBackendClient{},
}
treasury, err := client.New(dummyClientOptions)
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/AirHelp/treasury

require (
github.com/aws/aws-sdk-go v1.16.2
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 // indirect
golang.org/x/text v0.3.0 // indirect
)
21 changes: 21 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
github.com/aws/aws-sdk-go v1.16.2 h1:nlD5jfFLa/EN/Ag1B2UAI2YtE0oFSN+YJWh1uicKGss=
github.com/aws/aws-sdk-go v1.16.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 h1:bfLnR+k0tq5Lqt6dflRLcZiz6UaXCMt3vhYJ1l4FQ80=
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// treasury version should be changed here
const version = "0.5.0"
const version = "0.5.1"

// This will be filled in by the compiler.
var (
Expand Down

0 comments on commit 906ee7c

Please sign in to comment.