Skip to content

Add weekly forward compatibility testing #3

Add weekly forward compatibility testing

Add weekly forward compatibility testing #3

Workflow file for this run

# Copyright NVIDIA CORPORATION
#
# 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: Image Builds
on:
push:
branches:
- "pull-request/[0-9]+"
- main
- release-*
workflow_call:
inputs:
commit_short_sha:
required: true
type: string
label_image_source:
required: true
type: string
push_on_build:
required: true
type: string
operator_image_base:
required: true
type: string
workflow_dispatch:
jobs:
variables:
runs-on: ubuntu-latest
outputs:
commit_short_sha: ${{ steps.vars.outputs.commit_short_sha }}
label_image_source: ${{ steps.vars.outputs.label_image_source }}
push_on_build: ${{ steps.vars.outputs.push_on_build }}
operator_image_base: ${{ steps.vars.outputs.operator_image_base }}
operator_image_arm64: ${{ steps.vars.outputs.operator_image_arm64 }}
operator_image_amd64: ${{ steps.vars.outputs.operator_image_amd64 }}
operator_image_multiarch: ${{ steps.vars.outputs.operator_image_multiarch }}
steps:
- name: Checkout code
if: ${{ github.event_name != 'workflow_call' }}
uses: actions/checkout@v5
- name: Calculate build variables
id: vars
run: |
# Use inputs from workflow_call if available, otherwise calculate
if [[ "${{ github.event_name }}" == "workflow_call" ]]; then
COMMIT_SHORT_SHA="${{ inputs.commit_short_sha }}"
LABEL_IMAGE_SOURCE="${{ inputs.label_image_source }}"
PUSH_ON_BUILD="${{ inputs.push_on_build }}"
OPERATOR_IMAGE_BASE="${{ inputs.operator_image_base }}"
else
# Calculate for standalone runs
COMMIT_SHORT_SHA="${GITHUB_SHA:0:8}"
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
if [[ -z "${REPO_FULL_NAME}" ]]; then
REPO_FULL_NAME="${{ github.repository }}"
fi
LABEL_IMAGE_SOURCE="https://github.com/${REPO_FULL_NAME}"
PUSH_ON_BUILD="false"
if [[ "${{ github.actor }}" != "dependabot[bot]" ]]; then
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
PUSH_ON_BUILD="true"
elif [[ "${{ github.event_name }}" == "push" ]]; then
PUSH_ON_BUILD="true"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
PUSH_ON_BUILD="true"
fi
fi
OPERATOR_IMAGE_BASE="ghcr.io/nvidia/gpu-operator"
fi
# Calculate derived image names
OPERATOR_IMAGE_ARM64="${OPERATOR_IMAGE_BASE}:${COMMIT_SHORT_SHA}-arm64"
OPERATOR_IMAGE_AMD64="${OPERATOR_IMAGE_BASE}:${COMMIT_SHORT_SHA}-amd64"
OPERATOR_IMAGE_MULTIARCH="${OPERATOR_IMAGE_BASE}:${COMMIT_SHORT_SHA}"
# Output all variables
echo "commit_short_sha=${COMMIT_SHORT_SHA}" >> $GITHUB_OUTPUT
echo "label_image_source=${LABEL_IMAGE_SOURCE}" >> $GITHUB_OUTPUT
echo "push_on_build=${PUSH_ON_BUILD}" >> $GITHUB_OUTPUT
echo "operator_image_base=${OPERATOR_IMAGE_BASE}" >> $GITHUB_OUTPUT
echo "operator_image_arm64=${OPERATOR_IMAGE_ARM64}" >> $GITHUB_OUTPUT
echo "operator_image_amd64=${OPERATOR_IMAGE_AMD64}" >> $GITHUB_OUTPUT
echo "operator_image_multiarch=${OPERATOR_IMAGE_MULTIARCH}" >> $GITHUB_OUTPUT
# Display for debugging
echo "::notice::Commit SHA: ${COMMIT_SHORT_SHA}"
echo "::notice::Push on build: ${PUSH_ON_BUILD}"
echo "::notice::Multi-arch image: ${OPERATOR_IMAGE_MULTIARCH}"
build-gpu-operator-arm64:
needs: [variables]
runs-on: linux-arm64-cpu4
permissions:
contents: read
id-token: write
packages: write
steps:
- uses: actions/checkout@v5
name: Check out code
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go Proxy
id: setup-go-proxy
uses: nv-gha-runners/setup-artifactory-go-proxy@main
- name: Build image
env:
IMAGE_NAME: ${{ needs.variables.outputs.operator_image_base }}
VERSION: ${{ needs.variables.outputs.commit_short_sha }}-arm64
PUSH_ON_BUILD: ${{ needs.variables.outputs.push_on_build }}
DOCKER_BUILD_PLATFORM_OPTIONS: --platform=linux/arm64
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
LABEL_IMAGE_SOURCE: ${{ needs.variables.outputs.label_image_source }}
run: |
echo "${VERSION}"
make build-image
build-gpu-operator-amd64:
needs: [variables]
runs-on: linux-amd64-cpu4
permissions:
contents: read
id-token: write
packages: write
steps:
- uses: actions/checkout@v5
name: Check out code
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go Proxy
id: setup-go-proxy
uses: nv-gha-runners/setup-artifactory-go-proxy@main
- name: Build image
env:
IMAGE_NAME: ${{ needs.variables.outputs.operator_image_base }}
VERSION: ${{ needs.variables.outputs.commit_short_sha }}-amd64
PUSH_ON_BUILD: ${{ needs.variables.outputs.push_on_build }}
DOCKER_BUILD_PLATFORM_OPTIONS: --platform=linux/amd64
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
LABEL_IMAGE_SOURCE: ${{ needs.variables.outputs.label_image_source }}
run: |
echo "${VERSION}"
make build-image
build-multi-arch-images:
needs: [variables, build-gpu-operator-arm64, build-gpu-operator-amd64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
name: Check out code
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Manifest
env:
OPERATOR_IMAGE_ARM: ${{ needs.variables.outputs.operator_image_arm64 }}
OPERATOR_IMAGE_AMD: ${{ needs.variables.outputs.operator_image_amd64 }}
OPERATOR_MULTIARCH_IMAGE: ${{ needs.variables.outputs.operator_image_multiarch }}
run: |
docker manifest create \
${OPERATOR_MULTIARCH_IMAGE} \
${OPERATOR_IMAGE_AMD} \
${OPERATOR_IMAGE_ARM}
docker manifest push ${OPERATOR_MULTIARCH_IMAGE}