File tree Expand file tree Collapse file tree 4 files changed +38
-10
lines changed
Expand file tree Collapse file tree 4 files changed +38
-10
lines changed Original file line number Diff line number Diff line change 1818 steps :
1919 - checkout
2020 - run : make test
21+ verify :
22+ executor : golang
23+ steps :
24+ - checkout
25+ - run : make verify
2126 build :
2227 executor : golang
2328 working_directory : /work
@@ -64,14 +69,10 @@ jobs:
6469 - image : docker:stable
6570 working_directory : /work
6671 steps :
67- - attach_workspace :
68- at : /tmp/ct-monitor
6972 - setup_remote_docker :
7073 docker_layer_caching : false
7174 - checkout
7275 - run : |
73- mkdir artifacts
74- cp /tmp/ct-monitor/artifacts/ct-monitor-linux-amd64 artifacts/
7576 BASENAME="quay.io/hsn723/ct-monitor"
7677 TAG=$(cat VERSION)
7778 BRANCH=$(echo $TAG | cut -d '.' -f 1,2)
@@ -87,10 +88,12 @@ workflows:
8788 jobs :
8889 - lint
8990 - test
91+ - verify
9092 - build :
9193 requires :
9294 - lint
9395 - test
96+ - verify
9497 matrix :
9598 parameters :
9699 os : [linux]
@@ -106,7 +109,15 @@ workflows:
106109 only : master
107110 create-release :
108111 jobs :
112+ - verify :
113+ filters :
114+ branches :
115+ ignore : /.*/
116+ tags :
117+ only : /^v\d+\.\d+\.\d+$/
109118 - build :
119+ requires :
120+ - verify
110121 matrix :
111122 parameters :
112123 os : [linux, darwin, windows]
@@ -126,7 +137,7 @@ workflows:
126137 only : /^v\d+\.\d+\.\d+$/
127138 - publish-docker :
128139 requires :
129- - build
140+ - verify
130141 filters :
131142 branches :
132143 ignore : /.*/
Original file line number Diff line number Diff line change 1- FROM quay.io/cybozu/ubuntu:20.04 as certs
1+ FROM quay.io/cybozu/golang:1.15-focal as build
2+ ENV CGO_ENABLED=0
3+ RUN mkdir -p /etc/ct-monitor /var/log/ct-monitor \
4+ && chown nobody:nogroup /etc/ct-monitor /var/log/ct-monitor
5+ COPY . .
6+ RUN make
27
38FROM scratch
4- COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
5- COPY artifacts/ct-monitor-linux-amd64 /ct-monitor
9+ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
10+ COPY --from=build /etc/passwd /etc/passwd
11+ COPY --from=build /etc/group /etc/group
12+ COPY --from=build --chown=nobody:nogroup /etc/ct-monitor /etc/ct-monitor
13+ COPY --from=build --chown=nobody:nogroup /var/log/ct-monitor /var/log/ct-monitor
14+ COPY --from=build /tmp/ct-monitor/artifacts/ct-monitor-linux-amd64 /ct-monitor
15+
16+ USER nobody:nogroup
17+
618ENTRYPOINT [ "/ct-monitor" ]
Original file line number Diff line number Diff line change 11BUILD_DIR =/tmp/ct-monitor/artifacts
22WORK_DIR =./bin
33VERSION := $(shell cat VERSION)
4- LDFLAGS =-ldflags "-X github.com/Hsn723/ct-monitor/cmd.CurrentVersion=${VERSION}"
4+ LDFLAGS =-ldflags "-w -s - X github.com/Hsn723/ct-monitor/cmd.CurrentVersion=${VERSION}"
55OS ?= linux
66ARCH ?= amd64
77ifeq ($(OS ) , windows)
@@ -27,6 +27,11 @@ lint: clean setup
2727test : clean
2828 go test -race -v ./...
2929
30+ .PHONY : verify
31+ verify :
32+ go mod download
33+ go mod verify
34+
3035.PHONY : build
3136build : clean setup
3237 env GOOS=$(OS ) GOARCH=$(ARCH ) go build $(LDFLAGS ) -o $(BUILD_DIR ) /ct-monitor-$(OS ) -$(ARCH )$(EXT ) .
Original file line number Diff line number Diff line change 1- 0.1.0
1+ 0.1.1
You can’t perform that action at this time.
0 commit comments