Skip to content

Commit 622bf82

Browse files
authored
feat(fips): add fips compliant packages (#217)
feat(fips): add fips compliant packages
1 parent c53c685 commit 622bf82

File tree

10 files changed

+120
-81
lines changed

10 files changed

+120
-81
lines changed

.github/workflows/on_prerelease.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jobs:
1313
with:
1414
tag: ${{ github.event.release.tag_name }}
1515
integration: "vsphere"
16+
upload_fips_packages: true
1617
secrets: inherit

.github/workflows/on_release.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jobs:
1313
with:
1414
integration: vsphere
1515
tag: ${{ github.event.release.tag_name }}
16+
upload_fips_packages: true
1617
secrets: inherit

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Unreleased section should follow [Release Toolkit](https://github.com/newrelic/r
88

99
## Unreleased
1010

11+
### enhancements
12+
- Add FIPS compliant packages
13+
1114
## v1.6.3 - 2025-02-20
1215

1316
### ⛓️ Dependencies

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ NATIVEOS := $(shell $(GO_CMD) version | awk -F '[ /]' '{print $$4}')
44
NATIVEARCH := $(shell $(GO_CMD) version | awk -F '[ /]' '{print $$5}')
55
GO_PKGS := $(shell $(GO_CMD) list ./... | grep -v -e "/vendor/" -e "/example")
66
GO_FILES := $(shell find cmd -type f -name "*.go")
7+
GO_VERSION ?= $(shell grep '^go ' go.mod | awk '{print $$2}')
8+
BUILDER_IMAGE ?= "ghcr.io/newrelic/coreint-automation:latest-go$(GO_VERSION)-ubuntu16.04"
79

810
BIN_DIR = $(WORKDIR)/bin
911
TARGET = target

build/.goreleaser.yml

+89-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
version: 2
3+
project_name: nri-vsphere
14
builds:
25
- id: nri-vsphere-nix
36
main: ./cmd/nri-vsphere
@@ -18,6 +21,26 @@ builds:
1821
- goos: darwin
1922
goarch: 386
2023

24+
- id: nri-vsphere-nix-fips
25+
main: ./cmd/nri-vsphere
26+
binary: nri-vsphere
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
43+
2144
- id: nri-vsphere-win
2245
main: ./cmd/nri-vsphere
2346
binary: nri-vsphere
@@ -35,13 +58,17 @@ builds:
3558

3659
nfpms:
3760
- id: linux
38-
file_name_template: "{{ .ProjectName }}_{{ .Version }}-1_{{ .Arch }}"
61+
package_name: nri-vsphere
62+
file_name_template: "{{ .PackageName }}_{{ .Version }}-1_{{ .Arch }}"
3963
vendor: "New Relic, Inc."
4064
homepage: "https://www.newrelic.com/infrastructure"
4165
maintainer: "New Relic Infrastructure Team <[email protected]>"
4266
description: "New Relic Infrastructure vsphere Integration extend the core New Relic\nInfrastructure agent's capabilities to allow you to collect metric and\nlive state data from vsphere components."
4367
license: "https://newrelic.com/terms (also see LICENSE installed with this package)"
4468

69+
builds:
70+
- nri-vsphere-nix
71+
4572
dependencies:
4673
- "newrelic-infra"
4774

@@ -63,9 +90,58 @@ nfpms:
6390

6491
overrides:
6592
rpm:
66-
file_name_template: "{{ .ProjectName }}-{{ .Version }}-1.{{ .Arch }}"
67-
replacements:
68-
amd64: x86_64
93+
file_name_template: >-
94+
{{- .ProjectName }}-
95+
{{- .Version }}-1.
96+
{{- if eq .Arch "amd64" -}}x86_64
97+
{{- else -}}
98+
{{ .Arch }}
99+
{{- end }}
100+
101+
formats:
102+
- deb
103+
- rpm
104+
105+
- id: linux-fips
106+
package_name: nri-vsphere-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 <[email protected]>"
111+
description: "New Relic Infrastructure vsphere Integration extend the core New Relic\nInfrastructure agent's capabilities to allow you to collect metric and\nlive state data from vsphere components."
112+
license: "https://newrelic.com/terms (also see LICENSE installed with this package)"
113+
114+
builds:
115+
- nri-vsphere-nix-fips
116+
117+
dependencies:
118+
- newrelic-infra-fips (>= 1.60.0)
119+
120+
bindir: "/var/db/newrelic-infra/newrelic-integrations/bin"
121+
122+
contents:
123+
- src: "vsphere-config.yml.sample"
124+
dst: "/etc/newrelic-infra/integrations.d/vsphere-config.yml.sample"
125+
type: config
126+
- src: "vsphere-performance.metrics"
127+
dst: "/etc/newrelic-infra/integrations.d/vsphere-performance.metrics"
128+
type: config
129+
- src: "CHANGELOG.md"
130+
dst: "/usr/share/doc/nri-vsphere/CHANGELOG.md"
131+
- src: "README.md"
132+
dst: "/usr/share/doc/nri-vsphere/README.md"
133+
- src: "LICENSE"
134+
dst: "/usr/share/doc/nri-vsphere/LICENSE"
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 }}
69145
70146
formats:
71147
- deb
@@ -80,6 +156,15 @@ archives:
80156
- vsphere-config.yml.sample
81157
- vsphere-performance.metrics
82158
format: tar.gz
159+
160+
- id: nri-vsphere-nix-fips
161+
builds:
162+
- nri-vsphere-nix-fips
163+
name_template: "{{ .ProjectName }}-fips_{{ .Os }}_{{ .Version }}_{{ .Arch }}_dirty"
164+
files:
165+
- vsphere-config.yml.sample
166+
- vsphere-performance.metrics
167+
format: tar.gz
83168

84169
- id: nri-vsphere-win
85170
builds:

build/Dockerfile

-18
This file was deleted.

build/ci.mk

+9-8
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,7 +18,7 @@ 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

2324
.PHONY : ci/test
@@ -26,7 +27,7 @@ ci/test: ci/deps
2627
--name "nri-$(INTEGRATION)-test" \
2728
-v $(CURDIR):/go/src/github.com/newrelic/nri-$(INTEGRATION) \
2829
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
29-
$(BUILDER_TAG) make test
30+
$(BUILDER_IMAGE) make test
3031

3132

3233
.PHONY : ci/build
@@ -38,7 +39,7 @@ ifdef TAG
3839
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
3940
-e INTEGRATION \
4041
-e TAG \
41-
$(BUILDER_TAG) make release/build
42+
$(BUILDER_IMAGE) make release/build
4243
else
4344
@echo "===> $(INTEGRATION) === [ci/build] TAG env variable expected to be set"
4445
exit 1
@@ -59,7 +60,7 @@ ifdef TAG
5960
-e GPG_MAIL \
6061
-e GPG_PASSPHRASE \
6162
-e GPG_PRIVATE_KEY_BASE64 \
62-
$(BUILDER_TAG) make release
63+
$(BUILDER_IMAGE) make release
6364
else
6465
@echo "===> $(INTEGRATION) === [ci/prerelease] TAG env variable expected to be set"
6566
exit 1
@@ -82,7 +83,7 @@ ifdef TAG
8283
-e GPG_MAIL \
8384
-e GPG_PASSPHRASE \
8485
-e GPG_PRIVATE_KEY_BASE64 \
85-
$(BUILDER_TAG) make release
86+
$(BUILDER_IMAGE) make release
8687
else
8788
@echo "===> $(INTEGRATION) === [ci/fake-prerelease] TAG env variable expected to be set"
8889
exit 1

build/nix/sign.sh

-47
This file was deleted.

build/release.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BUILD_DIR := ./bin/
2-
GORELEASER_VERSION := v0.154.0
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
@@ -44,7 +44,7 @@ release/fix-archive:
4444
release/sign/nix:
4545
ifneq ($(NO_SIGN), true)
4646
@echo "===> $(INTEGRATION) === [release/sign] signing packages"
47-
@bash $(CURDIR)/build/nix/sign.sh
47+
@bash sign.sh
4848
else
4949
@echo "===> $(INTEGRATION) === [release/sign] signing packages is disabled by environment variable"
5050
endif

cmd/nri-vsphere/fips.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2025 New Relic Corporation. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//go:build fips
5+
// +build fips
6+
7+
package main
8+
9+
import (
10+
_ "crypto/tls/fipsonly"
11+
)

0 commit comments

Comments
 (0)