Alpine 3.23 ships net-snmp 5.9.4 which has segfault bugs in varbind construction and buffer overflows in octet string handling. Version 5.9.5.2 fixes these issues. Adds a pre-built base image (Dockerfile.netsnmp) compiled from source so the net-snmp build doesn't run on every agent deploy. The base image is built separately via the netsnmp-base workflow and referenced in the main Dockerfile.
99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
# Builds the net-snmp base image used by the agent Dockerfile.
|
|
# Only needs to run when the net-snmp version changes.
|
|
#
|
|
# Trigger manually or on changes to Dockerfile.netsnmp.
|
|
|
|
name: Build net-snmp base image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: [Dockerfile.netsnmp]
|
|
workflow_dispatch:
|
|
inputs:
|
|
netsnmp_version:
|
|
description: "Net-SNMP version to build"
|
|
default: "5.9.5.2"
|
|
required: true
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: towerops-app/netsnmp-alpine
|
|
|
|
jobs:
|
|
build:
|
|
name: Build (${{ matrix.arch }})
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
arch: amd64
|
|
runner: blacksmith-4vcpu-ubuntu-2404
|
|
- platform: linux/arm64
|
|
arch: arm64
|
|
runner: blacksmith-4vcpu-ubuntu-2404-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Blacksmith Builder
|
|
uses: useblacksmith/setup-docker-builder@v1
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: useblacksmith/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile.netsnmp
|
|
platforms: ${{ matrix.platform }}
|
|
push: true
|
|
provenance: false
|
|
build-args: |
|
|
NETSNMP_VERSION=${{ inputs.netsnmp_version || '5.9.5.2' }}
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.netsnmp_version || '5.9.5.2' }}-${{ matrix.arch }}
|
|
|
|
manifest:
|
|
name: Create Manifest
|
|
needs: build
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create multi-arch manifest
|
|
run: |
|
|
VERSION="${{ inputs.netsnmp_version || '5.9.5.2' }}"
|
|
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
|
|
|
|
docker buildx imagetools create -t ${IMAGE}:${VERSION} \
|
|
${IMAGE}:${VERSION}-amd64 \
|
|
${IMAGE}:${VERSION}-arm64
|
|
|
|
docker buildx imagetools create -t ${IMAGE}:latest \
|
|
${IMAGE}:${VERSION}-amd64 \
|
|
${IMAGE}:${VERSION}-arm64
|
|
|
|
- name: Summary
|
|
run: |
|
|
echo "### net-snmp base image built" >> $GITHUB_STEP_SUMMARY
|
|
echo "Version: ${{ inputs.netsnmp_version || '5.9.5.2' }}" >> $GITHUB_STEP_SUMMARY
|
|
echo "Image: \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.netsnmp_version || '5.9.5.2' }}\`" >> $GITHUB_STEP_SUMMARY
|