Skip to content

chore: release v0.9.2 #149

chore: release v0.9.2

chore: release v0.9.2 #149

Workflow file for this run

# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Agent CI
on:
pull_request:
branches:
- main
paths:
- agent/**
- containers/agent.Dockerfile
- .github/workflows/agent-ci.yaml
push:
branches:
- main
tags:
- agent/*
paths:
- agent/**
- containers/agent.Dockerfile
- .github/workflows/agent-ci.yaml
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Skyhook Agent Unit Tests
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Run unittests
run: |
cd agent
make test
- name: Generate Summary
uses: test-summary/action@v2
if: always()
with:
paths: "agent/skyhook-agent/test-results.xml"
output: test-summary.md
- name: Display Summary
if: always()
run: |
cat test-summary.md >> $GITHUB_STEP_SUMMARY
build-and-push-agent:
runs-on: ubuntu-latest
needs: [test] # Don't run the build and push if the unit tests fail
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --tags --force
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Setup for multi-platform
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the agent container image
id: build
run: |
apt-get update && apt-get install -y make git jq
cd agent
# if this is a tag build, use the tag as the version, otherwise use the sha
git fetch --all
export GIT_SHA=$(git rev-parse --short ${{ github.sha }})
TAGS="-t ${REGISTRY@L}/${{env.IMAGE_NAME}}/agent:${GIT_SHA}"
case ${{ github.ref_type }} in
branch)
# The last tag + current git sha
export AGENT_VERSION=$(git tag --list 'agent*' --sort=-v:refname | head -n 1 | cut -d/ -f2)+${GIT_SHA}
TAGS="$TAGS -t ${REGISTRY@L}/${{env.IMAGE_NAME}}/agent:$(echo "${AGENT_VERSION}" | tr + -)"
;;
tag)
# The version part of the tag
export AGENT_VERSION=$(echo "${{ github.ref_name }}" | cut -f 2 -d /)
TAGS="$TAGS -t ${REGISTRY@L}/${{env.IMAGE_NAME}}/agent:${AGENT_VERSION} -t ${REGISTRY@L}/${{env.IMAGE_NAME}}/agent:latest"
;;
*)
echo "Unkown type ${{ github.ref_type }}"
exit 1
;;
esac
export TAGS=$TAGS
export REGISTRY=${REGISTRY@L}
export BUILD_ARGS="--push"
make docker-build-only agent_version=${AGENT_VERSION}
cat metadata.json
echo "digest=$(cat metadata.json | jq -r .\"containerimage.digest\")" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
env:
AGENT_IMAGE: ${{env.IMAGE_NAME}}/agent
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{env.IMAGE_NAME}}/agent
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true