Skip to content

Commit

Permalink
Use new drone instance (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver006 committed Jan 28, 2023
1 parent 84a773c commit 1f224c2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 21 deletions.
61 changes: 42 additions & 19 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
kind: pipeline
name: default
type: kubernetes

workspace:
base: /go
path: src/github.com/oliver006/redis_exporter


services:
Expand Down Expand Up @@ -48,7 +46,7 @@ services:
- 6390

- name: redis-2-8
image: redis:2.8
image: redis:2.8.22
pull: if-not-exists
commands:
- "redis-server --port 6381 --dbfilename dump2-8.rdb"
Expand Down Expand Up @@ -225,15 +223,14 @@ steps:
depends_on:
- tests


- name: build-binaries
- name: build-some-amd64-binaries
image: "golang:1.19"
pull: if-not-exists
environment:
GO111MODULE: on
LOG_LEVEL: "info"
commands:
- make build-binaries
- make build-some-amd64-binaries
when:
event:
- pull_request
Expand All @@ -243,6 +240,21 @@ steps:
- tests


- name: build-all-binaries
image: "golang:1.19"
pull: if-not-exists
environment:
GO111MODULE: on
LOG_LEVEL: "info"
commands:
- make build-all-binaries
when:
event:
- tag
depends_on:
- tests


- name: release-docker-image-scratch
image: plugins/docker
pull: if-not-exists
Expand Down Expand Up @@ -288,7 +300,7 @@ steps:
event:
- tag
depends_on:
- tests
- release-docker-image-scratch


- name: release-docker-image-alpine-arm
Expand All @@ -312,7 +324,7 @@ steps:
event:
- tag
depends_on:
- tests
- release-docker-image-alpine-arm64


- name: release-docker-image-alpine-amd64
Expand All @@ -336,7 +348,7 @@ steps:
event:
- tag
depends_on:
- tests
- release-docker-image-alpine-arm


- name: manifest-docker-latest
Expand Down Expand Up @@ -428,8 +440,10 @@ steps:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
config:
from_secret: docker_config_json
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
Expand All @@ -452,14 +466,17 @@ steps:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=arm64'
config:
from_secret: docker_config_json
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- tests
- release-docker-image-alpine-arm64
- release-quay-scratch


- name: release-quay-alpine-arm
Expand All @@ -476,14 +493,17 @@ steps:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=arm'
config:
from_secret: docker_config_json
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- tests
- release-docker-image-alpine-arm
- release-quay-alpine-arm64


- name: release-quay-alpine-amd64
Expand All @@ -500,14 +520,17 @@ steps:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
config:
from_secret: docker_config_json
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- tests
- release-docker-image-alpine-amd64
- release-quay-alpine-arm


- name: manifest-quay-latest
Expand Down Expand Up @@ -595,4 +618,4 @@ steps:
event:
- tag
depends_on:
- build-binaries
- build-all-binaries
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,19 @@ upload-coverage:
BUILD_DT:=$(shell date +%F-%T)
GO_LDFLAGS:="-s -w -extldflags \"-static\" -X main.BuildVersion=${DRONE_TAG} -X main.BuildCommitSha=${DRONE_COMMIT_SHA} -X main.BuildDate=$(BUILD_DT)"

.PHONE: build-binaries
build-binaries:

.PHONE: build-some-amd64-binaries
build-some-amd64-binaries:
go install github.com/oliver006/gox@master

rm -rf .build | true

export CGO_ENABLED=0 ; \
gox -os="linux windows" -arch="amd64" -verbose -rebuild -ldflags $(GO_LDFLAGS) -output ".build/redis_exporter-${DRONE_TAG}.{{.OS}}-{{.Arch}}/{{.Dir}}" && echo "done"


.PHONE: build-all-binaries
build-all-binaries:
go install github.com/oliver006/gox@master

rm -rf .build | true
Expand Down

0 comments on commit 1f224c2

Please sign in to comment.