mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-10 15:25:33 +00:00
[no-relnote] Run e2e tests as reusable workflow
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This commit is contained in:
parent
92472bd0ed
commit
4ded119c31
24
.github/workflows/e2e.yaml
vendored
24
.github/workflows/e2e.yaml
vendored
@ -15,19 +15,25 @@
|
|||||||
name: End-to-end Tests
|
name: End-to-end Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_call:
|
||||||
workflows: [image]
|
inputs: {}
|
||||||
types:
|
secrets:
|
||||||
- completed
|
AWS_ACCESS_KEY_ID:
|
||||||
branches:
|
required: true
|
||||||
- "pull-request/[0-9]+"
|
AWS_SECRET_ACCESS_KEY:
|
||||||
- main
|
required: true
|
||||||
- release-*
|
AWS_SSH_KEY:
|
||||||
|
required: true
|
||||||
|
E2E_SSH_USER:
|
||||||
|
required: true
|
||||||
|
SLACK_BOT_TOKEN:
|
||||||
|
required: true
|
||||||
|
SLACK_CHANNEL_ID:
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e-tests:
|
e2e-tests:
|
||||||
runs-on: linux-amd64-cpu4
|
runs-on: linux-amd64-cpu4
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
8
.github/workflows/image.yaml
vendored
8
.github/workflows/image.yaml
vendored
@ -94,7 +94,7 @@ jobs:
|
|||||||
if [[ "${{ matrix.ispr }}" == "true" ]]; then
|
if [[ "${{ matrix.ispr }}" == "true" ]]; then
|
||||||
BUILD_MULTI_ARCH_IMAGES="false"
|
BUILD_MULTI_ARCH_IMAGES="false"
|
||||||
fi
|
fi
|
||||||
echo "PUSH_ON_BUILD=\"true\"" >> $GITHUB_ENV
|
echo "PUSH_ON_BUILD=true" >> $GITHUB_ENV
|
||||||
echo "BUILD_MULTI_ARCH_IMAGES=${BUILD_MULTI_ARCH_IMAGES}" >> $GITHUB_ENV
|
echo "BUILD_MULTI_ARCH_IMAGES=${BUILD_MULTI_ARCH_IMAGES}" >> $GITHUB_ENV
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@ -122,3 +122,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "${VERSION}"
|
echo "${VERSION}"
|
||||||
make -f deployments/container/Makefile build-${{ matrix.dist }}
|
make -f deployments/container/Makefile build-${{ matrix.dist }}
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: End-to-end Tests
|
||||||
|
uses: ./.github/workflows/e2e.yaml
|
||||||
|
secrets: inherit
|
||||||
|
needs: image
|
||||||
|
@ -43,6 +43,7 @@ DISTRIBUTIONS := ubuntu20.04 ubi8
|
|||||||
|
|
||||||
META_TARGETS := packaging
|
META_TARGETS := packaging
|
||||||
|
|
||||||
|
IMAGE_TARGETS := $(patsubst %,image-%,$(DISTRIBUTIONS) $(META_TARGETS))
|
||||||
BUILD_TARGETS := $(patsubst %,build-%,$(DISTRIBUTIONS) $(META_TARGETS))
|
BUILD_TARGETS := $(patsubst %,build-%,$(DISTRIBUTIONS) $(META_TARGETS))
|
||||||
PUSH_TARGETS := $(patsubst %,push-%,$(DISTRIBUTIONS) $(META_TARGETS))
|
PUSH_TARGETS := $(patsubst %,push-%,$(DISTRIBUTIONS) $(META_TARGETS))
|
||||||
TEST_TARGETS := $(patsubst %,test-%,$(DISTRIBUTIONS))
|
TEST_TARGETS := $(patsubst %,test-%,$(DISTRIBUTIONS))
|
||||||
@ -83,7 +84,7 @@ build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile.$(DOCKERFILE_SU
|
|||||||
ARTIFACTS_ROOT ?= $(shell realpath --relative-to=$(CURDIR) $(DIST_DIR))
|
ARTIFACTS_ROOT ?= $(shell realpath --relative-to=$(CURDIR) $(DIST_DIR))
|
||||||
|
|
||||||
# Use a generic build target to build the relevant images
|
# Use a generic build target to build the relevant images
|
||||||
$(BUILD_TARGETS): build-%: $(ARTIFACTS_ROOT)
|
$(IMAGE_TARGETS): image-%: $(ARTIFACTS_ROOT)
|
||||||
DOCKER_BUILDKIT=1 \
|
DOCKER_BUILDKIT=1 \
|
||||||
$(DOCKER) $(BUILDX) build --pull \
|
$(DOCKER) $(BUILDX) build --pull \
|
||||||
--provenance=false --sbom=false \
|
--provenance=false --sbom=false \
|
||||||
@ -102,7 +103,6 @@ $(BUILD_TARGETS): build-%: $(ARTIFACTS_ROOT)
|
|||||||
-f $(DOCKERFILE) \
|
-f $(DOCKERFILE) \
|
||||||
$(CURDIR)
|
$(CURDIR)
|
||||||
|
|
||||||
|
|
||||||
build-ubuntu%: DOCKERFILE_SUFFIX := ubuntu
|
build-ubuntu%: DOCKERFILE_SUFFIX := ubuntu
|
||||||
build-ubuntu%: PACKAGE_DIST = ubuntu18.04
|
build-ubuntu%: PACKAGE_DIST = ubuntu18.04
|
||||||
|
|
||||||
@ -116,6 +116,12 @@ build-packaging: PACKAGE_DIST = all
|
|||||||
# Test targets
|
# Test targets
|
||||||
test-%: DIST = $(*)
|
test-%: DIST = $(*)
|
||||||
|
|
||||||
|
# Handle the default build target.
|
||||||
|
.PHONY: build
|
||||||
|
build: $(DEFAULT_PUSH_TARGET)
|
||||||
|
$(DEFAULT_PUSH_TARGET): build-$(DEFAULT_PUSH_TARGET)
|
||||||
|
$(DEFAULT_PUSH_TARGET): DIST = $(DEFAULT_PUSH_TARGET)
|
||||||
|
|
||||||
TEST_CASES ?= docker crio containerd
|
TEST_CASES ?= docker crio containerd
|
||||||
$(TEST_TARGETS): test-%:
|
$(TEST_TARGETS): test-%:
|
||||||
TEST_CASES="$(TEST_CASES)" bash -x $(CURDIR)/test/container/main.sh run \
|
TEST_CASES="$(TEST_CASES)" bash -x $(CURDIR)/test/container/main.sh run \
|
||||||
|
@ -16,8 +16,7 @@ PUSH_ON_BUILD ?= false
|
|||||||
DOCKER_BUILD_OPTIONS = --output=type=image,push=$(PUSH_ON_BUILD)
|
DOCKER_BUILD_OPTIONS = --output=type=image,push=$(PUSH_ON_BUILD)
|
||||||
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64,linux/arm64
|
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64,linux/arm64
|
||||||
|
|
||||||
# We only generate amd64 image for ubuntu18.04
|
$(BUILD_TARGETS): build-%: image-%
|
||||||
build-ubuntu18.04: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
|
|
||||||
|
|
||||||
# We only generate a single image for packaging targets
|
# We only generate a single image for packaging targets
|
||||||
build-packaging: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
|
build-packaging: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
|
||||||
|
@ -12,4 +12,22 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
|
PUSH_ON_BUILD ?= false
|
||||||
|
ARCH ?= $(shell uname -m)
|
||||||
|
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/$(ARCH)
|
||||||
|
|
||||||
|
ifeq ($(PUSH_ON_BUILD),true)
|
||||||
|
DOCKER_BUILD_OPTIONS = --output=type=image,push=$(PUSH_ON_BUILD)
|
||||||
|
$(BUILD_TARGETS): build-%: image-%
|
||||||
|
$(DOCKER) push "$(IMAGE)"
|
||||||
|
else
|
||||||
|
$(BUILD_TARGETS): build-%: image-%
|
||||||
|
endif
|
||||||
|
|
||||||
|
# For the default distribution we also retag the image.
|
||||||
|
# Note: This needs to be updated for multi-arch images.
|
||||||
|
ifeq ($(IMAGE_TAG),$(VERSION)-$(DIST))
|
||||||
|
$(DEFAULT_PUSH_TARGET):
|
||||||
|
$(DOCKER) image inspect $(IMAGE) > /dev/null || $(DOCKER) pull $(IMAGE)
|
||||||
|
$(DOCKER) tag $(IMAGE) $(subst :$(IMAGE_TAG),:$(VERSION),$(IMAGE))
|
||||||
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user