Skip to content

Commit 3972b7f

Browse files
authored
feat(fips): add fips compliant packages (#345)
Added FIPS compliance for nri-kafka
1 parent 53016ec commit 3972b7f

11 files changed

Lines changed: 127 additions & 96 deletions

File tree

.github/workflows/on_prerelease.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
ORIGINAL_REPO_NAME: ${{ github.event.repository.full_name }}
1313
CONSUMER_PRODUCER_DOCKER_IMAGE_NAME: ghcr.io/newrelic/kafka-consumer-producer
1414
name: Build and push consumer-producer image to use in our canaries
15-
runs-on: ubuntu-22.04
15+
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
1818
with:
@@ -33,10 +33,10 @@ jobs:
3333
# This is currently not covered by reusable workflow due to the retry mechanism
3434
test-integration-nix:
3535
name: Run integration tests on *Nix
36-
runs-on: ubuntu-22.04
36+
runs-on: ubuntu-latest
3737
env:
3838
ORIGINAL_REPO_NAME: ${{ github.event.repository.full_name }}
39-
NRJMX_VERSION: '2.3.2' ## this is needed in the makefile
39+
NRJMX_VERSION: '2.10.1' ## this is needed in the makefile
4040
defaults:
4141
run:
4242
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}
@@ -65,6 +65,6 @@ jobs:
6565
windows_goarch_matrix: '["amd64"]' # 386 is not supported in jmx integrations
6666
windows_download_nrjmx: true
6767
win_package_type: exe
68+
upload_fips_packages: true
69+
test_package: false
6870
secrets: inherit
69-
70-

.github/workflows/on_push_pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
# This is currently not covered by reusable workflow due to the retry mechanism
2121
test-integration-nix:
2222
name: Run integration tests on *Nix
23-
runs-on: ubuntu-22.04
23+
runs-on: ubuntu-latest
2424
env:
2525
ORIGINAL_REPO_NAME: ${{ github.event.repository.full_name }}
26-
NRJMX_VERSION: '2.3.2' ## this is needed in the makefile
26+
NRJMX_VERSION: '2.10.1' ## this is needed in the makefile
2727
defaults:
2828
run:
2929
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}

.github/workflows/on_release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ jobs:
1414
integration: kafka
1515
tag: ${{ github.event.release.tag_name }}
1616
publish_schema: "ohi-jmx"
17+
upload_fips_packages: true
1718
secrets: inherit

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10+
### enhancements
11+
- Add FIPS compliant packages
12+
1013
## v3.13.3 - 2025-08-13
1114

1215
### ⛓️ Dependencies

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ BINARY_NAME = nri-$(INTEGRATION)
88
GO_PKGS := $(shell go list ./... | grep -v "/vendor/")
99
GO_FILES := ./src/
1010
GOFLAGS = -mod=readonly
11+
GO_VERSION ?= $(shell grep '^go ' go.mod | awk '{print $$2}')
12+
BUILDER_IMAGE ?= "ghcr.io/newrelic/coreint-automation:latest-go$(GO_VERSION)-ubuntu16.04"
1113

1214
all: build
1315

build/.goreleaser.yml

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
version: 2
3+
project_name: nri-kafka
14
builds:
25
- id: nri-nix
36
main: ./src
@@ -17,6 +20,26 @@ builds:
1720
ignore:
1821
- goos: darwin
1922
goarch: 386
23+
24+
- id: nri-nix-fips
25+
main: ./src
26+
binary: nri-kafka
27+
ldflags:
28+
- -s -w -X main.integrationVersion={{.Version}} -X main.gitCommit={{.Commit}} -X main.buildDate={{.Date}}
29+
env:
30+
- CGO_ENABLED=1
31+
- GOEXPERIMENT=boringcrypto
32+
- >-
33+
{{- if eq .Arch "arm64" -}}
34+
CC=aarch64-linux-gnu-gcc
35+
{{- end }}
36+
goos:
37+
- linux
38+
goarch:
39+
- amd64
40+
- arm64
41+
tags:
42+
- fips
2043

2144
- id: nri-win
2245
main: ./src
@@ -34,7 +57,8 @@ builds:
3457

3558
nfpms:
3659
- id: linux
37-
file_name_template: "{{ .ProjectName }}_{{ .Version }}-1_{{ .Arch }}"
60+
package_name: nri-kafka
61+
file_name_template: "{{ .PackageName }}_{{ .Version }}-1_{{ .Arch }}"
3862
vendor: "New Relic, Inc."
3963
homepage: "https://www.newrelic.com/infrastructure"
4064
maintainer: "New Relic Infrastructure Team <infrastructure-eng@newrelic.com>"
@@ -45,8 +69,8 @@ nfpms:
4569
- nri-nix
4670

4771
dependencies:
48-
- newrelic-infra
49-
- nrjmx
72+
- newrelic-infra (>= 1.20.0)
73+
- nrjmx (>= 2.3.2)
5074

5175
bindir: "/var/db/newrelic-infra/newrelic-integrations/bin"
5276

@@ -64,17 +88,60 @@ nfpms:
6488
type: config
6589

6690
overrides:
67-
deb:
68-
dependencies:
69-
- newrelic-infra (>= 1.20.0)
70-
- nrjmx (>= 2.3.2)
7191
rpm:
72-
file_name_template: "{{ .ProjectName }}-{{ .Version }}-1.{{ .Arch }}"
73-
replacements:
74-
amd64: x86_64
75-
dependencies:
76-
- newrelic-infra >= 1.20.0
77-
- nrjmx >= 2.3.2
92+
file_name_template: >-
93+
{{- .ProjectName }}-
94+
{{- .Version }}-1.
95+
{{- if eq .Arch "amd64" -}}x86_64
96+
{{- else -}}
97+
{{ .Arch }}
98+
{{- end }}
99+
100+
# Formats to be generated.
101+
formats:
102+
- deb
103+
- rpm
104+
105+
- id: linux-fips
106+
package_name: nri-kafka-fips
107+
file_name_template: "{{ .PackageName }}_{{ .Version }}-1_{{ .Arch }}"
108+
vendor: "New Relic, Inc."
109+
homepage: "https://www.newrelic.com/infrastructure"
110+
maintainer: "New Relic Infrastructure Team <infrastructure-eng@newrelic.com>"
111+
description: "New Relic Infrastructure kafka Integration extend the core New Relic\nInfrastructure agent's capabilities to allow you to collect metric and\nlive state data from kafka components."
112+
license: "https://newrelic.com/terms (also see LICENSE installed with this package)"
113+
114+
builds:
115+
- nri-nix-fips
116+
117+
dependencies:
118+
- newrelic-infra-fips (>= 1.60.0)
119+
- nrjmx-fips (>= 2.10.1)
120+
121+
bindir: "/var/db/newrelic-infra/newrelic-integrations/bin"
122+
123+
contents:
124+
- src: "kafka-config.yml.sample"
125+
dst: "/etc/newrelic-infra/integrations.d/kafka-config.yml.sample"
126+
- src: "CHANGELOG.md"
127+
dst: "/usr/share/doc/nri-kafka/CHANGELOG.md"
128+
- src: "README.md"
129+
dst: "/usr/share/doc/nri-kafka/README.md"
130+
- src: "LICENSE"
131+
dst: "/usr/share/doc/nri-kafka/LICENSE"
132+
- src: "legacy/kafka-definition.yml"
133+
dst: "/var/db/newrelic-infra/newrelic-integrations/kafka-definition.yml"
134+
type: config
135+
136+
overrides:
137+
rpm:
138+
file_name_template: >-
139+
{{- .ProjectName }}-fips-
140+
{{- .Version }}-1.
141+
{{- if eq .Arch "amd64" -}}x86_64
142+
{{- else -}}
143+
{{ .Arch }}
144+
{{- end }}
78145
79146
# Formats to be generated.
80147
formats:
@@ -92,6 +159,17 @@ archives:
92159
dst: .
93160
strip_parent: true
94161
format: tar.gz
162+
163+
- id: nri-nix-fips
164+
builds:
165+
- nri-nix-fips
166+
name_template: "{{ .ProjectName }}-fips_{{ .Os }}_{{ .Version }}_{{ .Arch }}_dirty"
167+
files:
168+
- kafka-config.yml.sample
169+
- src: 'legacy/kafka-definition.yml'
170+
dst: .
171+
strip_parent: true
172+
format: tar.gz
95173

96174
- id: nri-win
97175
builds:

build/Dockerfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

build/ci.mk

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
BUILDER_TAG ?= nri-$(INTEGRATION)-builder
1+
.PHONY : ci/pull-builder-image
2+
ci/pull-builder-image:
3+
@docker pull $(BUILDER_IMAGE)
24

35
.PHONY : ci/deps
4-
ci/deps:
5-
@docker build -t $(BUILDER_TAG) -f $(CURDIR)/build/Dockerfile $(CURDIR)
6+
ci/deps: ci/pull-builder-image
67

78
.PHONY : ci/debug-container
89
ci/debug-container: ci/deps
@@ -17,15 +18,15 @@ ci/debug-container: ci/deps
1718
-e GPG_MAIL \
1819
-e GPG_PASSPHRASE \
1920
-e GPG_PRIVATE_KEY_BASE64 \
20-
$(BUILDER_TAG) bash
21+
$(BUILDER_IMAGE) bash
2122

2223
.PHONY : ci/test
2324
ci/test: ci/deps
2425
@docker run --rm -t \
2526
--name "nri-$(INTEGRATION)-test" \
2627
-v $(CURDIR):/go/src/github.com/newrelic/nri-$(INTEGRATION) \
2728
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
28-
$(BUILDER_TAG) make test
29+
$(BUILDER_IMAGE) make test
2930

3031
.PHONY : ci/build
3132
ci/build: ci/deps
@@ -36,7 +37,7 @@ ifdef TAG
3637
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
3738
-e INTEGRATION \
3839
-e TAG \
39-
$(BUILDER_TAG) make release/build
40+
$(BUILDER_IMAGE) make release/build
4041
else
4142
@echo "===> $(INTEGRATION) === [ci/build] TAG env variable expected to be set"
4243
exit 1
@@ -57,7 +58,7 @@ ifdef TAG
5758
-e GPG_MAIL \
5859
-e GPG_PASSPHRASE \
5960
-e GPG_PRIVATE_KEY_BASE64 \
60-
$(BUILDER_TAG) make release
61+
$(BUILDER_IMAGE) make release
6162
else
6263
@echo "===> $(INTEGRATION) === [ci/prerelease] TAG env variable expected to be set"
6364
exit 1

build/nix/sign.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

build/release.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BUILD_DIR := ./bin/
2-
GORELEASER_VERSION := v0.174.1
2+
GORELEASER_VERSION := v2.4.4
33
GORELEASER_BIN ?= bin/goreleaser
44

55
bin:
@@ -27,10 +27,10 @@ release/deps: $(GORELEASER_BIN)
2727
release/build: release/deps release/clean
2828
ifeq ($(PRERELEASE), true)
2929
@echo "===> $(INTEGRATION) === [release/build] PRE-RELEASE compiling all binaries, creating packages, archives"
30-
@$(GORELEASER_BIN) release --config $(CURDIR)/build/.goreleaser.yml --rm-dist
30+
@$(GORELEASER_BIN) release --config $(CURDIR)/build/.goreleaser.yml --clean
3131
else
3232
@echo "===> $(INTEGRATION) === [release/build] build compiling all binaries"
33-
@$(GORELEASER_BIN) build --config $(CURDIR)/build/.goreleaser.yml --snapshot --rm-dist
33+
@$(GORELEASER_BIN) build --config $(CURDIR)/build/.goreleaser.yml --snapshot --clean
3434
endif
3535

3636
.PHONY : release/fix-archive
@@ -43,7 +43,7 @@ release/fix-archive:
4343
.PHONY : release/sign/nix
4444
release/sign/nix:
4545
@echo "===> $(INTEGRATION) === [release/sign] signing packages"
46-
@bash $(CURDIR)/build/nix/sign.sh
46+
@bash sign.sh
4747

4848

4949
.PHONY : release/publish

0 commit comments

Comments
 (0)