Skip to content

Commit

Permalink
ci: implement pr linting and releases building (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetOps authored Jan 12, 2021
1 parent b57424d commit de4731c
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 68 deletions.
34 changes: 34 additions & 0 deletions .ci/pr_lint.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@Library('pipelinex@development') _

podTemplate(
label: 'http-blaster-lint',
containers: [
containerTemplate(name: 'jnlp', image: 'jenkins/jnlp-slave:4.0.1-1', workingDir: '/home/jenkins', resourceRequestCpu: '2000m', resourceLimitCpu: '2000m', resourceRequestMemory: '2048Mi', resourceLimitMemory: '2048Mi'),
containerTemplate(name: 'golang', image: 'golang:1.14.12', workingDir: '/home/jenkins', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'golangci-lint', image: 'golangci/golangci-lint:v1.32-alpine', workingDir: '/home/jenkins', ttyEnabled: true, command: 'cat'),
],
envVars: [
envVar(key: 'GO111MODULE', value: 'on'),
envVar(key: 'GOPROXY', value: 'https://goproxy.devops.iguazeng.com')
],
) {
node("http-blaster-lint") {
common.notify_slack {
stage('Run golangci-lint') {

container('golang') {

checkout scm
sh "go mod download"
}

container('golangci-lint') {

ansiColor('xterm') {
sh "golangci-lint run -v"
}
}
}
}
}
}
37 changes: 37 additions & 0 deletions .ci/release.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@Library('pipelinex@development') _

podTemplate(

label: 'http-blaster-release',
containers: [
containerTemplate(name: 'jnlp', image: 'jenkins/jnlp-slave:4.0.1-1', workingDir: '/home/jenkins', resourceRequestCpu: '2000m', resourceLimitCpu: '2000m', resourceRequestMemory: '2048Mi', resourceLimitMemory: '2048Mi'),
containerTemplate(name: 'golang', image: 'golang:1.14.12', workingDir: '/home/jenkins', ttyEnabled: true, command: 'cat'),
],
) {
node("http-blaster-release") {
common.notify_slack {
container('golang') {

stage('Obtain sources') {
checkout scm
sh "curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR=/usr/local/bin/ sh"
}

stage('Build and release binaries') {

withCredentials([
usernamePassword(credentialsId: 'iguazio-prod-artifactory-credentials',
usernameVariable: 'ARTIFACTORY_IGUAZIO_USERNAME',
passwordVariable: 'ARTIFACTORY_IGUAZIO_SECRET'),
usernamePassword(credentialsId: 'iguazio-prod-artifactory-credentials',
usernameVariable: 'ARTIFACTORY_NAIPI_USERNAME',
passwordVariable: 'ARTIFACTORY_NAIPI_SECRET'),
string(credentialsId: 'iguazio-prod-git-user-token', variable: 'GITHUB_TOKEN')
]) {
sh "/usr/local/bin/goreleaser release"
}
}
}
}
}
}
74 changes: 74 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
project_name: http_blaster
env:
- GO111MODULE=on
- GOPROXY=goproxy.devops.iguazeng.com
before:
hooks:
- go mod download
builds:
- id: http_blaster
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
binary: http_blaster
ldflags:
- -s -w -X main.AppVersion={{ .Version }}
- id: http_blaster_latest
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
binary: http_blaster
ldflags:
- -s -w -X main.AppVersion={{ .Version }}
archives:
- id: http_blaster
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format: binary
replacements:
amd64: x86_64
builds:
- http_blaster
allow_different_binary_count: true
- id: http_blaster_latest
name_template: '{{ .ProjectName }}'
format: binary
builds:
- http_blaster_latest
allow_different_binary_count: true
release:
ids:
- http_blaster
artifactories:
- name: iguazio
target: https://artifactory.iguazeng.com/artifactory/iguazio_naipi/{{ .ProjectName }}/{{ .Version }}/
mode: binary
checksum: true
ids:
- http_blaster
- name: naipi
target: https://artifactory.iguazeng.com/artifactory/iguazio_naipi/{{ .ProjectName }}/
mode: binary
checksum: true
ids:
- http_blaster_latest
checksum:
name_template: 'checksums.txt'
algorithm: sha256
disable: false
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

27 changes: 27 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module github.com/v3io/http_blaster

go 1.12

replace github.com/v3io/v3io-tsdb => github.com/v3io/v3io-tsdb v0.11.6

require (
github.com/BurntSushi/toml v0.3.1
github.com/Gurpartap/logrus-stack v0.0.0-20170710170904-89c00d8a28f4
github.com/MichaelSkralivetsky/termui v2.2.1-0.20200808100015-f72beafc9b23+incompatible
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/brianvoe/gofakeit v3.18.0+incompatible
github.com/buger/jsonparser v1.1.1
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/json-iterator/go v1.1.10
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/nsf/termbox-go v0.0.0-20201124104050-ed494de23a00 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
github.com/sasile/gohistogram v1.0.1-0.20180425111433-5001302df51a
github.com/shirou/gopsutil v3.20.12+incompatible
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.6.1 // indirect
github.com/v3io/v3io-tsdb v0.10.9
github.com/valyala/fasthttp v1.19.0
)
Loading

0 comments on commit de4731c

Please sign in to comment.