Skip to content

Commit

Permalink
Merge branch 'v3' into v3-documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ADubhlaoich committed Oct 9, 2024
2 parents 7e87ae6 + b3be362 commit fa6cb74
Show file tree
Hide file tree
Showing 44 changed files with 685 additions and 185 deletions.
62 changes: 33 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,6 @@ jobs:
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
needs: build-unsigned-snapshot
Expand Down Expand Up @@ -165,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 @@ -261,7 +234,6 @@ jobs:
- name: Push benchmark 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

load-tests:
name: Load Tests
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref_name, 'dependabot/') }}
Expand Down Expand Up @@ -334,3 +306,35 @@ 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.ref_name == 'v3' &&
!github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-22.04
outputs:
package_build_num: ${{ steps.get_build_num.outputs.build_num }}
steps:
- name: Get the build number
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.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"
31 changes: 30 additions & 1 deletion .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,32 @@ on:
description: 'Release branch to build & publish from'
required: true
type: string
workflow_call:
inputs:
githubRelease:
type: boolean
default: false
packageVersion:
type: string
default: "3.0.0"
packageBuildNo:
type: string
default: "1"
uploadAzure:
type: boolean
default: true
publishPackages:
type: boolean
default: true
tagRelease:
type: boolean
default: false
createPullRequest:
type: boolean
default: false
releaseBranch:
type: string
required: true

env:
NFPM_VERSION: 'v2.35.3'
Expand Down Expand Up @@ -238,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 @@ -21,7 +21,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 @@ -31,15 +41,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.
Loading

0 comments on commit fa6cb74

Please sign in to comment.