From f72df3e995411936004560d7defa628ca58ed772 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 11:19:46 +0300 Subject: [PATCH 1/7] ADG-3944 add specs --- bamboo-specs/bamboo.yaml | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 bamboo-specs/bamboo.yaml diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml new file mode 100644 index 000000000..5e108f5d5 --- /dev/null +++ b/bamboo-specs/bamboo.yaml @@ -0,0 +1,64 @@ +--- +version: 2 +plan: + project-key: AGH + key: DNSPROXYSPECS + name: dns proxy - Build and run tests +variables: + dockerGo: adguard/golang-ubuntu:2.0 + +stages: + - Tests: + manual: 'false' + final: 'false' + jobs: + - Test + +Test: + docker: + image: ${bamboo.dockerGo} + volumes: + ${system.YARN_DIR}: ${bamboo.cacheYarn} + ${system.GO_CACHE_DIR}: ${bamboo.cacheGo} + ${system.GO_PKG_CACHE_DIR}: ${bamboo.cacheGoPkg} + key: TEST + tasks: + - checkout: + force-clean-build: 'true' + - script: + interpreter: SHELL + scripts: + - |- + set -x + set -e + go version + golangci-lint --version + + # Run linter + golangci-lint run + + # Run tests + go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... + final-tasks: + - clean + requirements: + - adg-docker: 'true' + +branches: + create: for-pull-request + delete: + after-deleted-days: '1' + after-inactive-days: '5' + link-to-jira: 'true' + +notifications: + - events: + - plan-status-changed + recipients: + - webhook: + name: Build webhook + url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo + +labels: [] +other: + concurrent-build-plugin: system-default From f2645e246875e66985511ddb739d54e096bba283 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 13:58:07 +0300 Subject: [PATCH 2/7] some fixes --- bamboo-specs/bamboo.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml index 5e108f5d5..392d301a3 100644 --- a/bamboo-specs/bamboo.yaml +++ b/bamboo-specs/bamboo.yaml @@ -3,14 +3,14 @@ version: 2 plan: project-key: AGH key: DNSPROXYSPECS - name: dns proxy - Build and run tests + name: dnsproxy - Build and run tests variables: dockerGo: adguard/golang-ubuntu:2.0 stages: - Tests: - manual: 'false' - final: 'false' + manual: false + final: false jobs: - Test @@ -47,9 +47,9 @@ Test: branches: create: for-pull-request delete: - after-deleted-days: '1' - after-inactive-days: '5' - link-to-jira: 'true' + after-deleted-days: 1 + after-inactive-days: 5 + link-to-jira: true notifications: - events: From 1f4af226ada42adb25dcca946ce676eb7834e811 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 19:12:17 +0300 Subject: [PATCH 3/7] remove makefile, remove redundant go param --- Makefile | 43 ---------------------------------------- bamboo-specs/bamboo.yaml | 2 +- 2 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index a4901ebec..000000000 --- a/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -NAME=dnsproxy -BASE_BUILDDIR=build -BUILDNAME=$(GOOS)-$(GOARCH)$(GOARM) -BUILDDIR=$(BASE_BUILDDIR)/$(BUILDNAME) -VERSION?=dev - -ifeq ($(GOOS),windows) - ext=.exe - archiveCmd=zip -9 -r $(NAME)-$(BUILDNAME)-$(VERSION).zip $(BUILDNAME) -else - ext= - archiveCmd=tar czpvf $(NAME)-$(BUILDNAME)-$(VERSION).tar.gz $(BUILDNAME) -endif - -.PHONY: default -default: build - -build: clean test - go build -mod=vendor - -release: check-env-release - mkdir -p $(BUILDDIR) - cp LICENSE $(BUILDDIR)/ - cp README.md $(BUILDDIR)/ - CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -mod=vendor -ldflags "-s -w -X main.VersionString=$(VERSION)" -o $(BUILDDIR)/$(NAME)$(ext) - cd $(BASE_BUILDDIR) ; $(archiveCmd) - -test: - go test -race -v -bench=. ./... - -clean: - go clean - rm -rf $(BASE_BUILDDIR) - -check-env-release: - @ if [ "$(GOOS)" = "" ]; then \ - echo "Environment variable GOOS not set"; \ - exit 1; \ - fi - @ if [ "$(GOARCH)" = "" ]; then \ - echo "Environment variable GOOS not set"; \ - exit 1; \ - fi diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml index 392d301a3..d3f7c5855 100644 --- a/bamboo-specs/bamboo.yaml +++ b/bamboo-specs/bamboo.yaml @@ -38,7 +38,7 @@ Test: golangci-lint run # Run tests - go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... + go test -race -v -bench=. -coverprofile=coverage.txt ./... final-tasks: - clean requirements: From a7ab8595c6d9f0147cd495d69b76501cd44a7548 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 19:13:30 +0300 Subject: [PATCH 4/7] change docker image --- bamboo-specs/bamboo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml index d3f7c5855..8700be824 100644 --- a/bamboo-specs/bamboo.yaml +++ b/bamboo-specs/bamboo.yaml @@ -5,7 +5,7 @@ plan: key: DNSPROXYSPECS name: dnsproxy - Build and run tests variables: - dockerGo: adguard/golang-ubuntu:2.0 + dockerGo: golang:1.16 stages: - Tests: From 060879db6e7ae991c61704547ab1ff9fcfe50ed3 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 19:16:09 +0300 Subject: [PATCH 5/7] Revert "change docker image" This reverts commit a7ab8595c6d9f0147cd495d69b76501cd44a7548. --- bamboo-specs/bamboo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml index 8700be824..d3f7c5855 100644 --- a/bamboo-specs/bamboo.yaml +++ b/bamboo-specs/bamboo.yaml @@ -5,7 +5,7 @@ plan: key: DNSPROXYSPECS name: dnsproxy - Build and run tests variables: - dockerGo: golang:1.16 + dockerGo: adguard/golang-ubuntu:2.0 stages: - Tests: From 9556d065990d1f002279d86c6d03dfd1efb6ac34 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 19:18:38 +0300 Subject: [PATCH 6/7] Revert "remove makefile, remove redundant go param" This reverts commit 1f4af226ada42adb25dcca946ce676eb7834e811. --- Makefile | 43 ++++++++++++++++++++++++++++++++++++++++ bamboo-specs/bamboo.yaml | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..a4901ebec --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +NAME=dnsproxy +BASE_BUILDDIR=build +BUILDNAME=$(GOOS)-$(GOARCH)$(GOARM) +BUILDDIR=$(BASE_BUILDDIR)/$(BUILDNAME) +VERSION?=dev + +ifeq ($(GOOS),windows) + ext=.exe + archiveCmd=zip -9 -r $(NAME)-$(BUILDNAME)-$(VERSION).zip $(BUILDNAME) +else + ext= + archiveCmd=tar czpvf $(NAME)-$(BUILDNAME)-$(VERSION).tar.gz $(BUILDNAME) +endif + +.PHONY: default +default: build + +build: clean test + go build -mod=vendor + +release: check-env-release + mkdir -p $(BUILDDIR) + cp LICENSE $(BUILDDIR)/ + cp README.md $(BUILDDIR)/ + CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -mod=vendor -ldflags "-s -w -X main.VersionString=$(VERSION)" -o $(BUILDDIR)/$(NAME)$(ext) + cd $(BASE_BUILDDIR) ; $(archiveCmd) + +test: + go test -race -v -bench=. ./... + +clean: + go clean + rm -rf $(BASE_BUILDDIR) + +check-env-release: + @ if [ "$(GOOS)" = "" ]; then \ + echo "Environment variable GOOS not set"; \ + exit 1; \ + fi + @ if [ "$(GOARCH)" = "" ]; then \ + echo "Environment variable GOOS not set"; \ + exit 1; \ + fi diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml index d3f7c5855..392d301a3 100644 --- a/bamboo-specs/bamboo.yaml +++ b/bamboo-specs/bamboo.yaml @@ -38,7 +38,7 @@ Test: golangci-lint run # Run tests - go test -race -v -bench=. -coverprofile=coverage.txt ./... + go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... final-tasks: - clean requirements: From b4adffa743737a2d3288dd3bd7c3e689adedcd70 Mon Sep 17 00:00:00 2001 From: it Date: Tue, 6 Apr 2021 19:18:58 +0300 Subject: [PATCH 7/7] remove redundant go param --- bamboo-specs/bamboo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bamboo-specs/bamboo.yaml b/bamboo-specs/bamboo.yaml index 392d301a3..d3f7c5855 100644 --- a/bamboo-specs/bamboo.yaml +++ b/bamboo-specs/bamboo.yaml @@ -38,7 +38,7 @@ Test: golangci-lint run # Run tests - go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... + go test -race -v -bench=. -coverprofile=coverage.txt ./... final-tasks: - clean requirements: