Skip to content

Commit 5807151

Browse files
author
Michael Robinson
authored
Merge pull request #16 from sendgrid/fix-artifact
fix artifact upload. fix yaml lint errors #minor
2 parents 4ccba8f + a4d795c commit 5807151

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

.buildkite/pipeline.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ steps:
2020
command: 'workflow status_checks'
2121
branches: '!master'
2222

23-
# The purpose of this script is to determine what version you are attempting to bump to.
24-
# This script will then write out that version into a file named 'version_wf', which
25-
# will be used by the build system to create pull requests, and your app itself may
26-
# use the file as well.
23+
# The purpose of this script is to determine what version you are
24+
# attempting to bump to. This script will then write out that version
25+
# into a file named 'version_wf', which will be used by the build system
26+
# to create pull requests, and your app itself may use the file as well.
2727
- label: 'prebuild_determine_version'
2828
env:
2929
# Use automatic versioning.
@@ -41,11 +41,10 @@ steps:
4141
# Build, Test, Lint
4242
##############################
4343
- label: 'Build Binary'
44-
command:
45-
- 'make build-docker'
46-
- 'buildkite-agent artifact upload aws-env'
44+
command: 'make artifact'
45+
artifact_paths: 'aws-env'
4746

48-
- label: 'Unit Tests & Code Coverage'
47+
- label: 'Unit Tests & Code Coverage'
4948
command: 'make test && make report'
5049
artifact_paths: 'coverage.html'
5150

@@ -60,7 +59,7 @@ steps:
6059

6160
# On master builds, push the versioned image
6261
- label: 'Release :shipit:'
63-
command:
62+
command:
6463
- 'mkdir build'
6564
- 'buildkite-agent artifact download aws-env build/'
6665
- 'make release'
@@ -72,9 +71,9 @@ steps:
7271
# Post-Publish
7372
##############################
7473

75-
# This script will use the previously written version_wf file to update the version
76-
# inside of github, as well as create release notes with a link back to the
77-
# merged pull request.
74+
# This script will use the previously written version_wf file to update
75+
# the version inside of github, as well as create release notes with a
76+
# link back to the merged pull request.
7877
#- label: 'postbuild_tagrepo_update_releasenotes'
7978
# env:
8079
# # Use automatic versioning.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/aws-env
22
/coverage.*
3+
version_wf

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ RUN go mod download
1818

1919
COPY . .
2020

21+
ARG GIT_COMMIT=unknown
22+
ARG BUILD_DATE=unknown
23+
ARG VERSION=0.0.1
24+
ARG BUILD_NUMBER=0
25+
2126
RUN make build
2227

2328
# The release (default) stage is a minimal production image suitable for use

Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ WD ?= $(shell pwd)
33
NAMESPACE=sendgrid
44
APPNAME=aws-env
55

6-
GIT_COMMIT = $(shell git rev-parse --verify HEAD)
7-
BUILD_DATE = $(shell date -u)
8-
VERSION = $(if $(shell cat version_wf),$(shell cat version_wf),0.0.1)
9-
BUILD_NUMBER = $(if $(BUILDKITE_BUILD_NUMBER),$(BUILDKITE_BUILD_NUMBER),0)
6+
export GIT_COMMIT ?= $(shell git rev-parse --verify HEAD)
7+
export BUILD_DATE ?= $(shell date -u)
8+
export VERSION ?= $(or $(shell cat version_wf),0.0.1)
9+
export BUILD_NUMBER ?= $(or $(BUILDKITE_BUILD_NUMBER),0)
1010

1111
GO_FILES = $(shell find . -type f -name "*.go")
1212

@@ -23,7 +23,16 @@ $(BINARIES): $(GO_FILES)
2323

2424
.PHONY: build-docker
2525
build-docker:
26-
@docker build -t aws-env --target build .
26+
@docker build -t aws-env \
27+
--build-arg GIT_COMMIT \
28+
--build-arg BUILD_DATE \
29+
--build-arg VERSION \
30+
--build-arg BUILD_NUMBER \
31+
--target build .
32+
33+
.PHONY: artifact
34+
artifact: build-docker
35+
@docker run -v $(WD):/dist --rm aws-env cp /code/aws-env /dist/
2736

2837
.PHONY: clean
2938
clean:

0 commit comments

Comments
 (0)