Skip to content
Closed
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
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /sw/nic/gpuagent
schedule:
interval: weekly
day: monday
time: "08:00"
timezone: Etc/UTC
open-pull-requests-limit: 1
groups:
go-dependencies:
patterns:
- "*"
labels:
- dependencies
- security
- package-ecosystem: docker
directory: /tools/build-container
schedule:
interval: weekly
day: monday
time: "08:00"
timezone: Etc/UTC
open-pull-requests-limit: 1
labels:
- dependencies
- security
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Read Go version
id: go-version
run: |
version=$(awk '$1 == "go" { print $2; exit }' sw/nic/gpuagent/go.mod)
test -n "$version"
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Build builder container
uses: docker/build-push-action@v6
with:
context: tools/build-container
file: tools/build-container/Dokerfile.rhel9
file: tools/build-container/Dockerfile.rhel9
load: true
tags: gpuagent-builder-rhel:9
build-args: |
GO_VERSION=${{ steps.go-version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/dependabot-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Dependabot Cleanup

on:
pull_request:
types:
- closed

permissions:
contents: write

jobs:
delete-merged-branch:
name: Delete merged Dependabot branch
if: >-
github.event.pull_request.merged &&
github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.event.pull_request.head.ref, 'dependabot/')
runs-on: ubuntu-24.04

steps:
- name: Delete branch
uses: actions/github-script@v7.0.1
with:
script: |
try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${context.payload.pull_request.head.ref}`,
});
} catch (error) {
if (error.status !== 404) throw error;
}
45 changes: 45 additions & 0 deletions .github/workflows/trivy-dependency-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Trivy Dependency Scan

on:
pull_request:
paths:
- sw/nic/gpuagent/go.mod
- sw/nic/gpuagent/go.sum
schedule:
- cron: "0 8 * * 1"
workflow_dispatch:

permissions:
contents: read
security-events: write

jobs:
scan-go-dependencies:
name: Scan Go dependencies
runs-on: ubuntu-24.04
timeout-minutes: 15

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Scan dependencies with Trivy
uses: aquasecurity/trivy-action@0.35.0
with:
version: v0.74.0
scan-type: fs
scan-ref: sw/nic/gpuagent
scanners: vuln
severity: HIGH,CRITICAL
ignore-unfixed: true
format: sarif
output: trivy-results.sarif

- name: Upload Trivy results
uses: github/codeql-action/upload-sarif@v3.29.6
if: always()
with:
sarif_file: trivy-results.sarif
category: trivy-go-dependencies
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ CONTAINER_WORKDIR := /usr/src/github.com/ROCm/gpu-agent
BUILD_DATE ?= $(shell date +%Y-%m-%dT%H:%M:%S%z)
GIT_COMMIT ?= $(shell git rev-list -1 HEAD --abbrev-commit)
BUILD_BASE_IMAGE ?= registry.access.redhat.com/ubi9/ubi:9.4
GO_VERSION ?= $(shell awk '$$1 == "go" { print $$2; exit }' sw/nic/gpuagent/go.mod)

export BUILD_BASE_IMAGE
export GPUAGENT_BLD_CONTAINER_IMAGE
export GPUAGENT_BLD_CONTAINER_IMAGE_UBUNTU
export GO_VERSION

.PHONY: all
all:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# compilation and development tools pre-installed.
ARG BUILD_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi:9.8
FROM ${BUILD_BASE_IMAGE}
ARG GO_VERSION=1.25.13

LABEL maintainer="praveenkumar.shanmugam@amd.com"

Expand All @@ -28,13 +29,13 @@

RUN yum install -y sudo

RUN wget https://go.dev/dl/go1.25.13.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.25.13.linux-amd64.tar.gz && \
rm -f go1.25.13.linux-amd64.tar.gz
RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm -f go${GO_VERSION}.linux-amd64.tar.gz

ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Check warning on line 37 in tools/build-container/Dockerfile.rhel9

View workflow job for this annotation

GitHub Actions / Build

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Check warning on line 38 in tools/build-container/Dockerfile.rhel9

View workflow job for this annotation

GitHub Actions / Build

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$PKG_CONFIG_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

ADD ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# compilation and development tools pre-installed.
ARG BUILD_BASE_IMAGE=ubuntu:22.04
FROM ${BUILD_BASE_IMAGE}
ARG GO_VERSION=1.25.13

LABEL maintainer="praveenkumar.shanmugam@amd.com"

Expand Down Expand Up @@ -30,9 +31,9 @@ RUN apt-get update && apt-get install -y \

WORKDIR /usr/src/github.com/Rocm/gpu-agent/

RUN wget https://go.dev/dl/go1.25.13.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.25.13.linux-amd64.tar.gz && \
rm -f go1.25.13.linux-amd64.tar.gz
RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm -f go${GO_VERSION}.linux-amd64.tar.gz

ADD ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
Expand Down
6 changes: 4 additions & 2 deletions tools/build-container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ rhel-builder:
docker build --build-arg USER=$(shell id -un) \
--build-arg GROUP=$(shell id -gn) \
--build-arg BUILD_BASE_IMAGE=$(BUILD_BASE_IMAGE) \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
-t ${GPUAGENT_BLD_CONTAINER_IMAGE} \
. -f Dokerfile.rhel9
. -f Dockerfile.rhel9
echo "dev container build complete : ${GPUAGENT_BLD_CONTAINER_IMAGE}"

# create ubuntu based builder/developer container
ubuntu-builder:
docker build --build-arg USER=$(shell id -un) \
--build-arg GROUP=$(shell id -gn) \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
-t ${GPUAGENT_BLD_CONTAINER_IMAGE_UBUNTU} \
. -f Dokerfile.ubu2204
. -f Dockerfile.ubu2204
echo "builder container build complete : ${GPUAGENT_BLD_CONTAINER_IMAGE_UBUNTU}"
Loading