Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,50 @@ jobs:
if: always()
run: bash ./scripts/dashboard/format_results.sh ${{job.status}} ${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}} ${{github.workspace}}

upgrade-tests:
name: Upgrade Tests
needs: build-unsigned-snapshot
runs-on: ubuntu-22.04
strategy:
matrix:
container:
- image: "ubuntu"
version: "24.04"
- image: "redhatenterprise"
version: "9"
- image: "alpine"
version: "3.22"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.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: Create Results Directory
run: mkdir -p ${{ github.workspace }}/test/dashboard/logs/${{ github.job }}/${{matrix.container.image}}-${{matrix.container.version}}

- name: Start Promtail
uses: ./.github/actions/start-promtail
with:
loki_url: ${{ secrets.LOKI_DASHBOARD_URL }}

- name: Run Upgrade Tests
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
OS_RELEASE="${{ matrix.container.image }}" OS_VERSION="${{ matrix.container.version }}" \
make upgrade-test | tee ${{github.workspace}}/test/dashboard/logs/${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}}/raw_logs.log
exit "${PIPESTATUS[0]}"

- name: Format Results
if: always()
run: bash ./scripts/dashboard/format_results.sh ${{job.status}} ${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}} ${{github.workspace}}

official-oss-image-integration-tests:
name: Integration Tests - Official OSS Images
needs: build-unsigned-snapshot
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags)
ifeq ($(strip $(VERSION)),)
VERSION := $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r)
endif

COMMIT = $(shell git rev-parse --short HEAD)
DATE = $(shell date +%F_%H-%M-%S)
LDFLAGS = "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
Expand Down Expand Up @@ -166,6 +167,12 @@ integration-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) \
go test -v ./test/integration/installuninstall ./test/integration/managementplane ./test/integration/auxiliarycommandserver ./test/integration/nginxless

upgrade-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) BUILD_TARGET="install-agent-repo" CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} \
PACKAGES_REPO=$(OSS_PACKAGES_REPO) PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) \
DOCKERFILE_PATH=$(DOCKERFILE_PATH) IMAGE_PATH=$(IMAGE_PATH) TAG=${IMAGE_TAG} OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) \
go test -v ./test/integration/upgrade

official-image-integration-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} BUILD_TARGET="install" \
PACKAGES_REPO=$(OSS_PACKAGES_REPO) TAG=${TAG} PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) DOCKERFILE_PATH=$(OFFICIAL_IMAGE_DOCKERFILE_PATH) \
Expand Down
11 changes: 4 additions & 7 deletions test/docker/nginx-oss/apk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM ${BASE_IMAGE} as install-nginx
LABEL maintainer="NGINX Docker Maintainers <[email protected]>"

ARG ENTRY_POINT
ARG PACKAGES_REPO

WORKDIR /agent
COPY ./build /agent/build
Expand Down Expand Up @@ -33,12 +32,10 @@ RUN apk add --allow-untrusted /agent/build/${PACKAGE_NAME}.apk

FROM install-nginx as install-agent-repo

ARG PACKAGES_REPO

# Setup nginx agent repository
RUN curl -o /etc/apk/keys/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub
RUN printf "http://${PACKAGES_REPO}/nginx-agent/alpine/v`grep -o -E '^[0-9]+\.[0-9]+' /etc/alpine-release`/main" | tee -a /etc/apk/repositories

RUN printf "%s%s%s\n" \
"http://${PACKAGES_REPO}/nginx-agent/alpine/v" \
`grep -o -E '^[0-9]+\.[0-9]+' /etc/alpine-release` \
"/main" | tee -a /etc/apk/repositories

RUN apk add nginx-agent@nginx-agent
RUN apk add nginx-agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# /etc/nginx-agent/nginx-agent.conf
#
# Configuration file for NGINX Agent.
#

log:
# set log level (error, warn, info, debug; default "info")
level: debug
# set log path. if empty, don't log to file.
path: /var/log/nginx-agent/

allowed_directories:
- /etc/nginx
- /usr/local/etc/nginx
- /usr/share/nginx/modules
- /var/run/nginx
- /var/log/nginx

command:
server:
host: managementPlane
port: 9092
type: grpc
24 changes: 24 additions & 0 deletions test/integration/upgrade/configs/nginx-agent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# /etc/nginx-agent/nginx-agent.conf
#
# Configuration file for NGINX Agent.
#

log:
# set log level (error, warn, info, debug; default "info")
level: debug
# set log path. if empty, don't log to file.
path: /var/log/nginx-agent/

allowed_directories:
- /etc/nginx
- /usr/local/etc/nginx
- /usr/share/nginx/modules
- /var/run/nginx
- /var/log/nginx

command:
server:
host: managementPlane
port: 9092
type: grpc
46 changes: 46 additions & 0 deletions test/integration/upgrade/configs/nginx-oss.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
worker_processes 1;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}

http {
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$bytes_sent" "$request_length" "$request_time" '
'"$gzip_ratio" $server_protocol ';

access_log /var/log/nginx/access.log main;

sendfile on;
keepalive_timeout 65;

server {
listen 8080;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

##
# Enable Metrics
##
location /api {
stub_status;
allow 127.0.0.1;
deny all;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
48 changes: 48 additions & 0 deletions test/integration/upgrade/configs/nginx-plus.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
worker_processes 1;
error_log /var/log/nginx/error.log;

events {
worker_connections 1024;
}

http {
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$bytes_sent" "$request_length" "$request_time" '
'"$gzip_ratio" $server_protocol ';

access_log /var/log/nginx/access.log main;

sendfile on;
keepalive_timeout 65;

server {
listen 8080;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

##
# Enable Metrics
##
location /api/ {
api write=on;
allow 127.0.0.1;
deny all;
status_zone my_location_zone1;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
Loading