Skip to content

Commit

Permalink
Merge branch 'v3' into add-default-config-for-command
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley committed Oct 8, 2024
2 parents 21d1004 + b3be362 commit 6267566
Show file tree
Hide file tree
Showing 41 changed files with 205 additions and 195 deletions.
73 changes: 22 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,6 @@ jobs:
name: nginx-agent-unsigned-snapshots
path: build
retention-days: 1
generate-pgo-profile:
name: Generate Profile
needs: build-unsigned-snapshot
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Download Packages
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: nginx-agent-unsigned-snapshots
path: build
- name: Generate pgo profile
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
OS_RELEASE="ubuntu" OS_VERSION="22.04" \
make generate-pgo-profile

integration-tests:
name: Integration Tests
Expand Down Expand Up @@ -164,16 +144,10 @@ jobs:
with:
name: nginx-agent-unsigned-snapshots
path: build
- name: Login to Docker Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Run Integration Tests
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
CONTAINER_NGINX_IMAGE_REGISTRY="${{ secrets.REGISTRY_URL }}" \
CONTAINER_NGINX_IMAGE_REGISTRY="docker-registry.nginx.com" \
TAG="${{ matrix.container.version }}-${{ matrix.container.image }}" \
OS_RELEASE="${{ matrix.container.release }}" OS_VERSION="${{ matrix.container.version }}" \
make official-image-integration-test
Expand Down Expand Up @@ -332,11 +306,10 @@ jobs:
- name: Push load test result
if: ${{ success() && github.ref_name == 'v3'}}
run: git push 'https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/nginx/agent.git' benchmark-results:benchmark-results

publish-packages-vars:
name: Set workflow variables
if: ${{ github.event_name == 'pull_request' &&
github.base_ref == 'v3' &&
github.event.pull_request.merged == true &&
if: ${{ github.ref_name == 'v3' &&
!github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-22.04
outputs:
Expand All @@ -346,24 +319,22 @@ jobs:
id: get_build_num
run: echo "build_num=${{ github.run_number }}-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT

publish-packages:
name: Publish NGINX Agent v3 packages
if: ${{ github.event_name == 'pull_request' &&
github.base_ref == 'v3' &&
github.event.pull_request.merged == true &&
!github.event.pull_request.head.repo.fork }}
needs: [ lint, unit-test, performance-tests,
load-tests, official-oss-image-integration-tests,
official-plus-image-integration-tests,
race-condition-test, publish-packages-vars ]
uses: ./.github/workflows/release-branch.yml
secrets: inherit
permissions:
id-token: write
contents: read
with:
packageVersion: "3.0.0"
packageBuildNo: "${{ needs.publish-packages-vars.outputs.package_build_num }}"
uploadAzure: true
publishPackages: true
releaseBranch: "v3"
# publish-packages:
# name: Publish NGINX Agent v3 packages
# if: ${{ github.ref_name == 'v3' &&
# !github.event.pull_request.head.repo.fork }}
# needs: [ lint, unit-test, performance-tests,
# load-tests, official-oss-image-integration-tests,
# official-plus-image-integration-tests,
# race-condition-test, publish-packages-vars ]
# uses: ./.github/workflows/release-branch.yml
# secrets: inherit
# permissions:
# id-token: write
# contents: read
# with:
# packageVersion: "3.0.0"
# packageBuildNo: "${{ needs.publish-packages-vars.outputs.package_build_num }}"
# uploadAzure: true
# publishPackages: true
# releaseBranch: "v3"
5 changes: 4 additions & 1 deletion .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,14 @@ jobs:
build-args: |
package_type=signed-package
- name: Set the VERSION environment variable
run: echo VERSION=v${{ inputs.packageVersion }} >> $GITHUB_ENV

- name: Build Packages
env:
GPG_KEY: ${{ secrets.INDIGO_GPG_AGENT }}
NFPM_SIGNING_KEY_FILE: .key.asc
VERSION: ${{ inputs.packageVersion }}
VERSION: ${{ env.VERSION }}
PACKAGE_BUILD: ${{ inputs.packageBuildNo }}
run: |
export PATH=$PATH:~/go/bin
Expand Down
25 changes: 2 additions & 23 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ linters:
enable:
- bodyclose
- cyclop
- copyloopvar
- contextcheck
- dupl
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- gocheckcompilerdirectives
- gocognit
Expand All @@ -28,7 +28,6 @@ linters:
- godox
- gofumpt
- goheader
- gomnd
- gomoddirectives
- gosec
- grouper
Expand All @@ -40,6 +39,7 @@ linters:
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
Expand Down Expand Up @@ -201,27 +201,6 @@ linters-settings:
This source code is licensed under the Apache License, Version 2.0 license found in the
LICENSE file in the root directory of this source tree.
gomnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks:
- argument
- case
- condition
- operation
- return
- assign
# List of numbers to exclude from analysis. The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0". Default: []
ignored-numbers: []
# List of file patterns to exclude from analysis. Values always ignored: `.+_test.go`. Default: []
ignored-files: []
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions: []
gomoddirectives:
# Allow local `replace` directives. Default: false
replace-local: false
Expand Down
7 changes: 4 additions & 3 deletions Makefile.packaging
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BINARY_PATH := $(BUILD_DIR)/$(BINARY_NAME)
GPG_PUBLIC_KEY := .key
PACKAGE_BUILD ?= 1
PACKAGE_VERSION := $(shell echo ${VERSION} | tr -d 'v')-$(PACKAGE_BUILD)
APK_PACKAGE_VERSION := $(shell echo ${VERSION} | tr -d 'v')_$(PACKAGE_BUILD)
TARBALL_NAME := $(PACKAGE_PREFIX)v3.tar.gz

DEB_DISTROS ?= ubuntu-noble-24.04 ubuntu-jammy-22.04 ubuntu-focal-20.04 debian-bookworm-12 debian-bullseye-11
Expand Down Expand Up @@ -157,9 +158,9 @@ package: gpg-key $(PACKAGES_DIR) $(GITHUB_PACKAGES_DIR) $(AZURE_PACKAGES_DIR) ##
GOWORK=off CGO_ENABLED=0 GOARCH=$${goarch} GOOS=linux go build -pgo=auto -ldflags=${LDFLAGS} -o $(BINARY_PATH) $(PROJECT_DIR)/$(PROJECT_FILE); \
for version in $(APK_VERSIONS); do \
if [ ! -d "$(PACKAGES_DIR)/apk/v$${version}/$${arch}" ]; then mkdir -p $(PACKAGES_DIR)/apk/v$${version}/$${arch}; fi; \
VERSION=$(PACKAGE_VERSION) ARCH=$${arch} nfpm pkg --config .nfpm.yaml --packager apk --target $(PACKAGES_DIR)/apk/v$${version}/$${arch}/${PACKAGE_PREFIX}-$(PACKAGE_VERSION).apk; \
cp $(PACKAGES_DIR)/apk/v$${version}/$${arch}/${PACKAGE_PREFIX}-$(PACKAGE_VERSION).apk ${GITHUB_PACKAGES_DIR}/${PACKAGE_PREFIX}-$(PACKAGE_VERSION)-v$${version}-$${arch}.apk; \
cp $(PACKAGES_DIR)/apk/v$${version}/$${arch}/${PACKAGE_PREFIX}-$(PACKAGE_VERSION).apk ${AZURE_PACKAGES_DIR}/${PACKAGE_PREFIX}-$(PACKAGE_VERSION)-v$${version}-$${arch}.apk; \
VERSION=$(PACKAGE_VERSION) ARCH=$${arch} nfpm pkg --config .nfpm.yaml --packager apk --target $(PACKAGES_DIR)/apk/v$${version}/$${arch}/${PACKAGE_PREFIX}-$(APK_PACKAGE_VERSION).apk; \
cp $(PACKAGES_DIR)/apk/v$${version}/$${arch}/${PACKAGE_PREFIX}-$(APK_PACKAGE_VERSION).apk ${GITHUB_PACKAGES_DIR}/${PACKAGE_PREFIX}-$(APK_PACKAGE_VERSION)-v$${version}-$${arch}.apk; \
cp $(PACKAGES_DIR)/apk/v$${version}/$${arch}/${PACKAGE_PREFIX}-$(APK_PACKAGE_VERSION).apk ${AZURE_PACKAGES_DIR}/${PACKAGE_PREFIX}-$(APK_PACKAGE_VERSION)-v$${version}-$${arch}.apk; \
done; \
rm -rf $(BINARY_PATH); \
done; \
Expand Down
2 changes: 1 addition & 1 deletion Makefile.tools
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
OAPICODEGEN = github.com/deepmap/oapi-codegen/v2/cmd/[email protected]
LEFTHOOK = github.com/evilmartians/[email protected]
GOLANGCILINT = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
GOLANGCILINT = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
PROTOCGENGO = google.golang.org/protobuf/cmd/[email protected]
GOFUMPT = mvdan.cc/[email protected]
COUNTERFEITER = github.com/maxbrunsfeld/counterfeiter/[email protected]
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ The following packages need to be installed:
- make
- golang (https://go.dev/doc/install)
- protoc (https://grpc.io/docs/protoc-installation/)
- mdatagen (There is a workaround for installing mdatagen that can be found here: https://github.com/open-telemetry/opentelemetry-collector/issues/9281#issuecomment-2276407679)
- mdatagen (There is currently an issue installing mdatagen https://github.com/open-telemetry/opentelemetry-collector/issues/9281. See instructions below for workaround.)

#### Workaround to install mdatagen
```
git clone https://github.com/open-telemetry/opentelemetry-collector.git
cd opentelemetry-collector
git checkout v0.108.1
cd cmd/mdatagen
go install
```


Before starting development on the NGINX Agent, it is important to download and install the necessary tool and dependencies required by the NGINX Agent. You can do this by running the following `make` command:
```
Expand All @@ -28,15 +38,15 @@ make install-tools
### Building NGINX Agent from Source Code
Build NGINX Agent deb package:
```
OSARCH=<operating system archiecture> make local-deb-packge
OSARCH=<operating system archiecture> make local-deb-package
```
Build NGINX Agent rpm package:
```
OSARCH=<operating system archiecture> make local-rpm-packge
OSARCH=<operating system archiecture> make local-rpm-package
```
Build NGINX Agent apk package:
```
OSARCH=<operating system archiecture> make local-apk-packge
OSARCH=<operating system archiecture> make local-apk-package
```

## NGINX Agent Technical Specifications
Expand Down
Binary file modified default.pgo
Binary file not shown.
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/nginx/agent/v3

go 1.22.0
go 1.23

toolchain go1.22.5
toolchain go1.23.2

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.33.0-20240401165935-b983156c5e99.1
Expand All @@ -16,7 +16,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c
github.com/nginxinc/nginx-plus-go-client v1.2.2
github.com/nginxinc/nginx-plus-go-client/v2 v2.0.1
github.com/nginxinc/nginx-prometheus-exporter v1.3.0
github.com/nxadm/tail v1.4.11
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.108.0
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
go.opentelemetry.io/otel v1.28.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
golang.org/x/mod v0.19.0
golang.org/x/mod v0.21.0
golang.org/x/sync v0.8.0
google.golang.org/protobuf v1.34.2
)
Expand Down Expand Up @@ -113,7 +113,7 @@ require (
github.com/elastic/go-grok v0.3.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/expr-lang/expr v1.16.9 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
Expand Down Expand Up @@ -224,7 +224,7 @@ require (
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
Expand Down Expand Up @@ -297,11 +297,11 @@ require (
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
Expand Down Expand Up @@ -335,7 +335,7 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.28.0
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/grpc v1.65.0
)
Loading

0 comments on commit 6267566

Please sign in to comment.