-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build packages for multiple architectures (#267)
Adds support for multiple architectures and simplifies build process. Closes #223
- Loading branch information
Showing
32 changed files
with
214 additions
and
6,342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
name: Continuous Integration | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
pull_request: | ||
branches: | ||
- main | ||
|
@@ -15,136 +17,76 @@ on: | |
- synchronize | ||
paths-ignore: | ||
- '**.md' | ||
create: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' | ||
|
||
env: | ||
DOCKER_BUILDKIT: 1 | ||
|
||
jobs: | ||
|
||
binary: | ||
name: Build Binary | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Determine Go version from go.mod | ||
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV | ||
- name: Setup Golang Environment | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Build Binary | ||
run: make build | ||
- name: Store Artifacts in Cache | ||
uses: actions/cache@v3 | ||
go-version-file: go.mod | ||
cache: true | ||
- name: Determine GOPATH | ||
id: go | ||
run: echo "::set-output name=go_path::$(go env GOPATH)" | ||
- name: Build binary | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
path: ${{ github.workspace }}/nginx-asg-sync | ||
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }} | ||
version: latest | ||
args: build --snapshot --rm-dist --single-target | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GOPATH: ${{ steps.go.outputs.go_path }} | ||
|
||
unit-tests: | ||
name: Unit Tests | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Determine Go version from go.mod | ||
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV | ||
- name: Setup Golang Environment | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version-file: go.mod | ||
cache: true | ||
- name: Run Tests | ||
run: make test | ||
|
||
build: | ||
name: Build Image | ||
name: Build Packages | ||
runs-on: ubuntu-20.04 | ||
needs: [binary, unit-tests] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Fetch Cached Artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/nginx-asg-sync | ||
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }} | ||
- name: Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build Image Amazon 2 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: amazon2-builder:${{ github.sha }} | ||
build-args: | | ||
CONTAINER_VERSION=amazonlinux:2 | ||
OS_TYPE=rpm_based | ||
- name: Run Amazon 2 | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: amazon2-builder:${{ github.sha }} | ||
run: /build.sh | ||
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output | ||
- name: Build Image Centos 7 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: centos7-builder:${{ github.sha }} | ||
build-args: | | ||
CONTAINER_VERSION=centos:7 | ||
OS_TYPE=rpm_based | ||
- name: Run Centos 7 | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: centos7-builder:${{ github.sha }} | ||
run: /build.sh | ||
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output | ||
- name: Build Image Centos stream 8 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: centosstream8-builder:${{ github.sha }} | ||
build-args: | | ||
CONTAINER_VERSION=quay.io/centos/centos:stream8 | ||
OS_TYPE=rpm_based | ||
- name: Run Centos stream 8 | ||
uses: addnab/docker-run-action@v3 | ||
fetch-depth: 0 | ||
- name: Setup Golang Environment | ||
uses: actions/setup-go@v3 | ||
with: | ||
image: centosstream8-builder:${{ github.sha }} | ||
run: /build.sh | ||
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output | ||
- name: Build Image Debian | ||
uses: docker/build-push-action@v3 | ||
go-version-file: go.mod | ||
cache: true | ||
- name: Determine GOPATH | ||
id: go | ||
run: echo "::set-output name=go_path::$(go env GOPATH)" | ||
- name: Publish Release Notes | ||
uses: release-drafter/release-drafter@v5 | ||
with: | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: debian-builder:${{ github.sha }} | ||
build-args: | | ||
OS_TYPE=deb_based | ||
- name: Run Debian | ||
uses: addnab/docker-run-action@v3 | ||
publish: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
- name: Download Syft | ||
uses: anchore/sbom-action/[email protected] | ||
- name: Build binaries | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
image: debian-builder:${{ github.sha }} | ||
run: /build.sh | ||
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output | ||
version: latest | ||
args: release ${{ startsWith(github.ref, 'refs/tags/') && '' || '--snapshot' }} --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GOPATH: ${{ steps.go.outputs.go_path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
/build_output | ||
.DS_Store | ||
|
||
# binaries | ||
nginx-asg-sync | ||
/build_output | ||
dist | ||
|
||
# IDEs | ||
.vscode | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
env: | ||
- CGO_ENABLED=0 | ||
|
||
before: | ||
hooks: | ||
- make LICENSES | ||
|
||
builds: | ||
- id: nginx-asg-sync | ||
goos: | ||
- linux | ||
goarch: | ||
- 386 | ||
- amd64 | ||
- arm64 | ||
- s390x | ||
flags: | ||
- -trimpath | ||
gcflags: | ||
- all=-trimpath={{.Env.GOPATH}} | ||
asmflags: | ||
- all=-trimpath={{.Env.GOPATH}} | ||
main: ./cmd/sync | ||
binary: nginx-asg-sync | ||
|
||
archives: | ||
- files: | ||
- README.md | ||
- LICENSE | ||
- CHANGELOG.md | ||
- build/config.yaml.example | ||
|
||
sboms: | ||
- artifacts: archive | ||
|
||
changelog: | ||
skip: true | ||
|
||
nfpms: | ||
- file_name_template: "{{ .ConventionalFileName }}" | ||
vendor: NGINX Inc. | ||
homepage: https://github.com/nginxinc/nginx-asg-sync | ||
maintainer: NGINX Inc. <[email protected]> | ||
description: |- | ||
NGINX Plus Integration with Cloud Autoscaling. | ||
This package contains software that integrates NGINX Plus | ||
with AWS Auto Scaling groups and Azure Virtual Machine Scale Set | ||
license: BSD-2-Clause | ||
dependencies: | ||
- nginx-plus | ||
- systemd | ||
suggests: | ||
- logrotate | ||
formats: | ||
- deb | ||
- rpm | ||
release: 1 | ||
section: utils | ||
priority: optional | ||
bindir: /usr/sbin | ||
contents: | ||
- src: build/config.yaml.example | ||
dst: /etc/nginx/config.yaml.example | ||
type: "config|noreplace" | ||
- src: build/logrotate | ||
dst: /etc/logrotate.d/nginx-asg-sync | ||
type: "config|noreplace" | ||
- dst: /var/log/nginx-asg-sync | ||
type: dir | ||
- src: build/nginx-asg-sync.service | ||
dst: /lib/systemd/system/nginx-asg-sync.service | ||
- src: LICENSE | ||
dst: /usr/share/doc/nginx-asg-sync/copyright | ||
packager: deb | ||
- src: LICENSES | ||
dst: /usr/share/doc/nginx-asg-sync/LICENSES | ||
packager: deb | ||
- src: LICENSE | ||
dst: /usr/share/licenses/nginx-asg-sync/LICENSE | ||
packager: rpm | ||
- src: LICENSES | ||
dst: /usr/share/licenses/nginx-asg-sync/LICENSES | ||
packager: rpm | ||
- src: README.md | ||
dst: /usr/share/doc/nginx-asg-sync/README | ||
type: doc | ||
overrides: | ||
rpm: | ||
scripts: | ||
postinstall: "build/postinstall.sh" | ||
preremove: "build/preremove.sh" | ||
postremove: "build/postremove.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
github.com/Azure/azure-sdk-for-go,https://github.com/Azure/azure-sdk-for-go/blob/v66.0.0/LICENSE.txt,MIT | ||
github.com/Azure/go-autorest/autorest,https://github.com/Azure/go-autorest/blob/autorest/v0.11.24/autorest/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/autorest/adal,https://github.com/Azure/go-autorest/blob/autorest/adal/v0.9.18/autorest/adal/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/autorest/azure/auth,https://github.com/Azure/go-autorest/blob/autorest/azure/auth/v0.5.11/autorest/azure/auth/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/autorest/azure/cli,https://github.com/Azure/go-autorest/blob/autorest/azure/cli/v0.4.5/autorest/azure/cli/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/autorest/date,https://github.com/Azure/go-autorest/blob/autorest/date/v0.3.0/autorest/date/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/autorest/to,https://github.com/Azure/go-autorest/blob/autorest/to/v0.4.0/autorest/to/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/autorest/validation,https://github.com/Azure/go-autorest/blob/autorest/validation/v0.3.1/autorest/validation/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/logger,https://github.com/Azure/go-autorest/blob/logger/v0.2.1/logger/LICENSE,Apache-2.0 | ||
github.com/Azure/go-autorest/tracing,https://github.com/Azure/go-autorest/blob/tracing/v0.6.0/tracing/LICENSE,Apache-2.0 | ||
github.com/aws/aws-sdk-go,https://github.com/aws/aws-sdk-go/blob/v1.44.4/LICENSE.txt,Apache-2.0 | ||
github.com/aws/aws-sdk-go/internal/sync/singleflight,https://github.com/aws/aws-sdk-go/blob/v1.44.4/internal/sync/singleflight/LICENSE,BSD-3-Clause | ||
github.com/dimchansky/utfbom,https://github.com/dimchansky/utfbom/blob/v1.1.1/LICENSE,Apache-2.0 | ||
github.com/golang-jwt/jwt/v4,https://github.com/golang-jwt/jwt/blob/v4.2.0/LICENSE,MIT | ||
github.com/jmespath/go-jmespath,https://github.com/jmespath/go-jmespath/blob/v0.4.0/LICENSE,Apache-2.0 | ||
github.com/mitchellh/go-homedir,https://github.com/mitchellh/go-homedir/blob/v1.1.0/LICENSE,MIT | ||
github.com/nginxinc/nginx-asg-sync/cmd/sync,https://github.com/nginxinc/nginx-asg-sync/blob/HEAD/LICENSE,BSD-2-Clause | ||
github.com/nginxinc/nginx-plus-go-client/client,https://github.com/nginxinc/nginx-plus-go-client/blob/v0.10.0/LICENSE,Apache-2.0 | ||
golang.org/x/crypto/pkcs12,https://cs.opensource.google/go/x/crypto/+/e495a2d5:LICENSE,BSD-3-Clause | ||
gopkg.in/yaml.v2,https://github.com/go-yaml/yaml/blob/v2.4.0/LICENSE,Apache-2.0 |
Oops, something went wrong.