Skip to content

Commit

Permalink
Merge branch 'main' into bump-nginx-plus-go-client-version-to-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley committed Oct 3, 2024
2 parents dfd065f + 253ea3c commit 1f05bf7
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 89 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ permissions:
env:
GOLANGCI_LINT_VERSION: 'v1.55.1'
NFPM_VERSION: 'v2.35.3'
NGINX_OSS_REGISTRY: 'docker-registry.nginx.com'

jobs:
lint:
Expand Down Expand Up @@ -213,16 +214,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 }}" TAG="${{ matrix.container.version }}-${{ matrix.container.image }}" OS_RELEASE="${{ matrix.container.release }}"\
CONTAINER_NGINX_IMAGE_REGISTRY="${{ env.NGINX_OSS_REGISTRY }}" TAG="${{ matrix.container.version }}-${{ matrix.container.image }}" OS_RELEASE="${{ matrix.container.release }}"\
make official-image-integration-test
- name: Container Output Logs
if: failure()
Expand Down Expand Up @@ -413,4 +408,4 @@ jobs:
secrets: inherit
permissions:
contents: write
pull-requests: write
pull-requests: write
7 changes: 4 additions & 3 deletions site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ Docs are written in Markdown. We build the docs using [Hugo](https://gohugo.io).
To build the docs locally, run the desired `make` command from the docs directory:

```text
make docs - builds the docs to the default output path `public`
make watch - runs a local hugo server so you can view docs in your browser while you work
make hugo-update - cleans the Hugo module cache and fetches the latest version of the theme module
make drafts - runs the local hugo server and includes all docs marked with `draft: true`
make clean - removes the local `public` directory, which is the default output path used by Hugo
make docs - runs a local hugo server so you can view docs in your browser while you work
make hugo-mod - cleans the Hugo module cache and fetches the latest version of the theme module
make docs-drafts - runs the local hugo server and includes all docs marked with `draft: true`
```
## Linting
Expand Down
4 changes: 2 additions & 2 deletions site/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/nginx/agent/site

go 1.18
go 1.22.0

require github.com/nginxinc/nginx-hugo-theme v0.41.14 // indirect
require github.com/nginxinc/nginx-hugo-theme v0.41.19 // indirect
18 changes: 2 additions & 16 deletions site/go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
github.com/nginxinc/nginx-hugo-theme v0.28.0 h1:RHHvBmFk2Uptk+efLPSIuBd2elc3IOZPElkJbkkpAHo=
github.com/nginxinc/nginx-hugo-theme v0.28.0/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.33.0 h1:6mZdgxf5kNhInsrAXXiSlWXRy3fsP51lWKOdrvmkR6U=
github.com/nginxinc/nginx-hugo-theme v0.33.0/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.34.0-alpha h1:8tKWnkhxP5Nk0V64v8rE9T3crusycohXl3wmOWc4uFk=
github.com/nginxinc/nginx-hugo-theme v0.34.0-alpha/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.34.0 h1:G7LPVq7w1ls6IS4+OkTwjhFb67rLCzPdfZvW1/sn2Cw=
github.com/nginxinc/nginx-hugo-theme v0.34.0/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.35.0 h1:7XB2GMy6qeJgKEJy9wOS3SYKYpfvLW3/H+UHRPLM4FU=
github.com/nginxinc/nginx-hugo-theme v0.35.0/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.40.8 h1:VtoSAtf9k67tI2jzbLRo0oFBAMHZBUPRh/xV4MYullI=
github.com/nginxinc/nginx-hugo-theme v0.40.8/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.41.9 h1:8TKgjocF95ZSRP0PHkyvk9TyJvwPrdz1k0FB5RfKT3I=
github.com/nginxinc/nginx-hugo-theme v0.41.9/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.41.14 h1:OraNB01CdMJXufPddvIVt6qn6Mj38Z/XCVIWBgVtuY0=
github.com/nginxinc/nginx-hugo-theme v0.41.14/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.41.19 h1:CyZOhU8q0p3nQ+ZTFRx7c/Dq9rxV1mShADIHz0vDoHo=
github.com/nginxinc/nginx-hugo-theme v0.41.19/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
2 changes: 1 addition & 1 deletion site/go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.18
go 1.22

use (
.
Expand Down
4 changes: 4 additions & 0 deletions site/hugo-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

hugo mod get -u github.com/nginxinc/nginx-hugo-theme
hugo $*
88 changes: 29 additions & 59 deletions site/makefile
Original file line number Diff line number Diff line change
@@ -1,94 +1,64 @@
HUGO?=hugo
HUGO_IMG?=hugomods/hugo:0.115.3
HUGO_VERSION?=$(shell hugo version 2>/dev/null | awk '{print $$2}' | cut -d '.' -f 2)
HUGO_IMG?=hugomods/hugo:std-go-git-0.134.3

THEME_MODULE = github.com/nginxinc/nginx-hugo-theme
## Pulls the current theme version from the Netlify settings
THEME_VERSION = $(NGINX_THEME_VERSION)

# if there's no local hugo, fallback to docker
ifeq (, $(shell ${HUGO} version 2> /dev/null))
ifeq (, $(shell docker version 2> /dev/null))
$(error Docker and Hugo are not installed. Hugo (<0.91) or Docker are required to build the local preview.)
ifeq ($(shell [ $(HUGO_VERSION) -gt 133 2>/dev/null ] && echo true || echo false), true)
$(info Hugo is available and has a version greater than 133. Proceeding with build.)
else
HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} hugo --bind 0.0.0.0 -p 1313
endif
$(warning Hugo is not available or using a version less than 134. Attempting to use docker. HUGO_VERSION=$(HUGO_VERSION))
HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} /src/hugo-entrypoint.sh
ifeq (, $(shell docker version 2> /dev/null))
$(error Hugo (>0.134) or Docker are required to build the local previews.)
endif
endif

MARKDOWNLINT?=markdownlint
MARKDOWNLINT_IMG?=ghcr.io/igorshubovych/markdownlint-cli:latest

# if there's no local markdownlint, fallback to docker
ifeq (, $(shell ${MARKDOWNLINT} version 2> /dev/null))
ifeq (, $(shell docker version 2> /dev/null))
ifneq (, $(shell $(NETLIFY) "true"))
$(error Docker and markdownlint are not installed. markdownlint or Docker are required to lint.)
endif
else
MARKDOWNLINT=docker run --rm -i -v ${CURDIR}:/src --workdir /src ${MARKDOWNLINT_IMG}
endif
endif

MARKDOWNLINKCHECK?=markdown-link-check
MARKDOWNLINKCHECK_IMG?=ghcr.io/tcort/markdown-link-check:stable
# if there's no local markdown-link-check, fallback to docker

ifeq (, $(shell ${MARKDOWNLINKCHECK} --version 2> /dev/null))
ifeq (, $(shell docker version 2> /dev/null))
ifneq (, $(shell $(NETLIFY) "true"))
$(error Docker and markdown-link-check are not installed. markdown-link-check or Docker are required to check links.)
endif
else
MARKDOWNLINKCHECK=docker run --rm -it -v ${CURDIR}:/docs --workdir /docs ${MARKDOWNLINKCHECK_IMG}
endif
endif

.PHONY: all clean hugo-mod all-staging all-dev hugo-server-drafts hugo-server netlify deploy-preview

# Removes the public directory generated by the `hugo` command
clean:
if [[ -d ${PWD}/public ]] ; then rm -rf ${PWD}/public && echo "Removed public directory" ; else echo "Did not find a public directory to remove" ; fi

hugo-mod:
hugo mod get $(THEME_MODULE)@v$(THEME_VERSION)

# Builds using the Hugo "production" environment
# For deploys to docs.nginx.com only
all: hugo-mod
hugo --gc -e production

# Builds using the Hugo "staging" environment
# For deploys to docs-staging.nginx.com only
all-staging: hugo-mod
hugo --gc -e staging

# Builds using the Hugo "development" environment
# For deploys to docs-dev.nginx.com only
all-dev: hugo-mod
hugo --gc -e development

# Runs the Hugo server with content marked as draft
# Serves docs at localhost:1313
docs-drafts:
${HUGO} server -D --disableFastRender

docs-local: clean
${HUGO}
.PHONY: docs docs-draft docs-local clean hugo-get hugo-tidy lint-markdown link-check

# Runs the Hugo server
# Serves docs at localhost:1313
docs:
${HUGO} server --disableFastRender
${HUGO}

watch:
${HUGO} --bind 0.0.0.0 -p 1313 server --disableFastRender

drafts:
${HUGO} --bind 0.0.0.0 -p 1313 server -D --disableFastRender

clean:
[ -d "public" ] && rm -rf "public"

hugo-get:
hugo mod get -u github.com/nginxinc/nginx-hugo-theme

hugo-tidy:
hugo mod tidy

hugo-update: hugo-get hugo-tidy

lint-markdown:
${MARKDOWNLINT} -c .markdownlint.yaml -- content

link-check:
${MARKDOWNLINKCHECK} $(shell find content -name '*.md')

# Can be used to deploy to netlify from your local
# development environment.
# Requires a netlify login.
netlify: clean
netlify deploy --build -d public --alias $(shell git branch --show-current)-branch

deploy-preview: hugo-mod
hugo --gc -b ${NETLIFY_DEPLOY_URL}/nginx-agent

0 comments on commit 1f05bf7

Please sign in to comment.