Skip to content
Merged
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
115 changes: 112 additions & 3 deletions .github/workflows/agent-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,50 @@
name: Agent Unittest
#
# LICENSE START
#
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
#
# 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.
#
# LICENSE END
#







name: Agent CI
on:
pull_request:
branches:
- main
paths:
- agent/**
- .github/workflows/agent-ci.yaml
- containers/agent.Dockerfile
- .github/workflows/agent-container.yaml
push:
branches:
- main
tags:
- agent/*
paths:
- agent/**
- containers/agent.Dockerfile
- .github/workflows/agent-container.yaml
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Skyhook Agent Unit Tests
Expand All @@ -28,4 +69,72 @@ jobs:
- name: Display Summary
if: always()
run: |
cat test-summary.md >> $GITHUB_STEP_SUMMARY
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
# 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
TAGS="-t ${REGISTRY@L}/${{env.IMAGE_NAME}}/agent:${{ github.sha }}"
case ${{ github.ref_type }} in
branch)
# The last tag + current git sha
export AGENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")+${{ github.sha }}
;;
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

99 changes: 0 additions & 99 deletions .github/workflows/agent-container.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/agentless-container.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
#
# LICENSE START
#
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
#
# 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.
#
# LICENSE END
#







name: Build and push agentless container image

# Configures this workflow to run every time a tag is created
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/commit-linting.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
#
# LICENSE START
#
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
#
# 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.
#
# LICENSE END
#







name: Commit Linting
on: pull_request
jobs:
Expand Down
Loading
Loading