Skip to content

Commit

Permalink
use centralized builder image (#264)
Browse files Browse the repository at this point in the history
* use centralized builder image

* cleanup for tests

* get go version from go.mod

* remove unused var from Makefile
  • Loading branch information
rajrohanyadav authored Nov 21, 2024
1 parent 79475b9 commit 018b41d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 66 deletions.
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
INTEGRATION := docker
BINARY_NAME = nri-$(INTEGRATION)
SRC_DIR = ./src/
VALIDATE_DEPS = golang.org/x/lint/golint
INTEGRATIONS_DIR = /var/db/newrelic-infra/newrelic-integrations/
CONFIG_DIR = /etc/newrelic-infra/integrations.d
GO_FILES := ./src/
GOOS = GOOS=linux
GO = $(GOOS) go
INTEGRATION := docker
BINARY_NAME = nri-$(INTEGRATION)
SRC_DIR = ./src/
VALIDATE_DEPS = golang.org/x/lint/golint
INTEGRATIONS_DIR = /var/db/newrelic-infra/newrelic-integrations/
CONFIG_DIR = /etc/newrelic-infra/integrations.d
GO_FILES := ./src/
GOOS = GOOS=linux
GO = $(GOOS) go
GO_VERSION ?= $(shell grep '^go ' go.mod | awk '{print $$2}')
BUILDER_IMAGE ?= "ghcr.io/newrelic/coreint-automation:latest-go$(GO_VERSION)-ubuntu16.04"

all: build

Expand Down
49 changes: 0 additions & 49 deletions build/Dockerfile

This file was deleted.

17 changes: 9 additions & 8 deletions build/ci.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
BUILDER_TAG ?= nri-$(INTEGRATION)-builder
.PHONY : ci/pull-builder-image
ci/pull-builder-image:
@docker pull $(BUILDER_IMAGE)

.PHONY : ci/deps
ci/deps:
@docker build -t $(BUILDER_TAG) -f $(CURDIR)/build/Dockerfile $(CURDIR)
ci/deps: ci/pull-builder-image

.PHONY : ci/debug-container
ci/debug-container: ci/deps
Expand All @@ -17,23 +18,23 @@ ci/debug-container: ci/deps
-e GPG_MAIL \
-e GPG_PASSPHRASE \
-e GPG_PRIVATE_KEY_BASE64 \
$(BUILDER_TAG) bash
$(BUILDER_IMAGE) bash

.PHONY : ci/validate
ci/validate: ci/deps
@docker run --rm -t \
--name "nri-$(INTEGRATION)-validate" \
-v $(CURDIR):/go/src/github.com/newrelic/nri-$(INTEGRATION) \
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
$(BUILDER_TAG) make validate
$(BUILDER_IMAGE) make validate

.PHONY : ci/test
ci/test: ci/deps
@docker run --rm -t \
--name "nri-$(INTEGRATION)-test" \
-v $(CURDIR):/go/src/github.com/newrelic/nri-$(INTEGRATION) \
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
$(BUILDER_TAG) make test
$(BUILDER_IMAGE) make test

.PHONY : ci/build
ci/build: ci/deps
Expand All @@ -44,7 +45,7 @@ ifdef TAG
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
-e INTEGRATION \
-e TAG \
$(BUILDER_TAG) make release/build
$(BUILDER_IMAGE) make release/build
else
@echo "===> $(INTEGRATION) === [ci/build] TAG env variable expected to be set"
exit 1
Expand All @@ -65,7 +66,7 @@ ifdef TAG
-e GPG_MAIL \
-e GPG_PASSPHRASE \
-e GPG_PRIVATE_KEY_BASE64 \
$(BUILDER_TAG) make release
$(BUILDER_IMAGE) make release
else
@echo "===> $(INTEGRATION) === [ci/prerelease] TAG env variable expected to be set"
exit 1
Expand Down

0 comments on commit 018b41d

Please sign in to comment.