Skip to content

[NGINX Agent] Agent packaging #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
109 changes: 109 additions & 0 deletions .github/workflows/agent-packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Release Agent v3

on:
workflow_call:
inputs:
packageVersion:
type: string
default: "3.0.0"
packageBuildNo:
type: string
default: "1"
tagRelease:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input doesnt seem to be used.

type: boolean
default: false
releaseBranch:
type: string
required: true
signingKeyFile:
type: string
required: true
uploadUrl:
type: string
default: "https://up-ap.nginx.com"
secrets:
INDIGO_GPG_AGENT:
required: true
ARTIFACTORY_USER:
required: true
ARTIFACTORY_TOKEN:
required: true


env:
NFPM_VERSION: 'v2.35.3'
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev"

permissions:
contents: read
id-token: write

defaults:
run:
shell: 'bash -Eeo pipefail -x {0}'

jobs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other workflows we also have a "sanity check" job that runs on public runners - and makes sure the workflow is instantiated from our orgs and through allowed events on known branches. See e.g.

While it's probably something that isnt strictly necessary, it's an additional check to make sure our self-hosted runners wont run the jobs they're not supposed to run.

build-and-upload-packages:
name: Build and upload Agent packages
runs-on: ubuntu-24.04-amd64
permissions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to duplicate permissions here if we already have it defined on the top-most level?

id-token: write
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ inputs.releaseBranch }}

- name: Setup go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
cache: false

- name: Setup package build environment
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
sudo apt-get update
sudo apt-get install -y gpgv1 monkeysphere
make install-tools
export PATH=$PATH:~/go/bin
nfpm --version

- name: Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

- name: Build Docker Image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
file: scripts/packages/packager/Dockerfile
tags: build-signed-packager:1.0.0
context: '.'
push: false
load: true
cache-from: type=gha,scope=build-signed-packager
cache-to: type=gha,scope=build-signed-packager,mode=max
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: ${{ inputs.signingKeyFile }}
VERSION: ${{ env.VERSION }}
PACKAGE_BUILD: ${{ inputs.packageBuildNo }}
run: |
export PATH=$PATH:~/go/bin
echo "$GPG_KEY" | base64 --decode > ${NFPM_SIGNING_KEY_FILE}
echo "Run make package -> $VERSION $PACKAGE_BUILD"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and another hunk is probably a leftover debug?


- name: Publish Release Packages
if: ${{ inputs.publishPackages == true }}
env:
TOKEN: ${{ secrets.id_token }}
UPLOAD_URL: ${{ inputs.uploadUrl }}
run: |
echo "Run make release -> $UPLOAD_URL"