Skip to content

Commit

Permalink
use centralized builder image
Browse files Browse the repository at this point in the history
  • Loading branch information
rajrohanyadav committed Nov 19, 2024
1 parent 79475b9 commit 1844053
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/on_prerelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
pre-release:
uses: newrelic/coreint-automation/.github/workflows/reusable_pre_release.yaml@v3
uses: newrelic/coreint-automation/.github/workflows/reusable_pre_release.yaml@feat/fips-image-and-workflow
with:
tag: ${{ github.event.release.tag_name }}
integration: "docker"
Expand Down
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
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 ?= "1.23.2"
UBUNTU_VERSION ?= "16.04"
BUILDER_IMAGE_TAG ?= "latest"
BUILDER_IMAGE ?= "ghcr.io/newrelic/coreint-automation:latest-go$(GO_VERSION)-ubuntu$(UBUNTU_VERSION)"

all: build

Expand Down
15 changes: 8 additions & 7 deletions build/ci.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
BUILDER_TAG ?= nri-$(INTEGRATION)-builder
BUILDER_IMAGE ?= nri-$(INTEGRATION)-builder

.PHONY : ci/deps
ci/deps:
@docker build -t $(BUILDER_TAG) -f $(CURDIR)/build/Dockerfile $(CURDIR)
@docker login ghcr.io -u $(GHCR_USER) -p $(GHCR_TOKEN)
@docker 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 1844053

Please sign in to comment.