Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
Merge branch 'cleanup-meta-package' into 'main'
Browse files Browse the repository at this point in the history
Simplify building of the meta-packages

See merge request nvidia/container-toolkit/container-runtime!79
  • Loading branch information
ArangoGutierrez committed Apr 26, 2023
2 parents 68b81a2 + ea1dd5c commit 6f328ae
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 368 deletions.
131 changes: 51 additions & 80 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ default:
- name: docker:dind
command: ["--experimental"]

# Build packages for all supported OS / ARCH combinations
stages:
- build-one
- build-all

variables:
# We specify the LIB_VERSION, TOOLKIT_VERSION, and TOOLKIT_TAG variable to allow packages
# to be built.
Expand All @@ -31,45 +26,51 @@ variables:
TOOLKIT_VERSION: 999.999.999
TOOLKIT_TAG: dummy+toolkit

.build-setup: &build-setup
before_script:
- apk update
- apk upgrade
- apk add coreutils build-base sed git bash make
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
# Build packages for all supported OS / ARCH combinations
stages:
- trigger
- build

# build-one jobs build packages for a single OS / ARCH combination.
#
# They are run during the first stage of the pipeline as a smoke test to ensure
# that we can successfully build packages on all of our architectures for a
# single OS. They are triggered on any change to an MR. No artifacts are
# produced as part of build-one jobs.
.build-one-setup: &build-one-setup
<<: *build-setup
stage: build-one
only:
- merge_requests
.pipeline-trigger-rules:
rules:
# We trigger the pipeline if started manually
- if: $CI_PIPELINE_SOURCE == "web"
# We trigger the pipeline on the main branch
- if: $CI_COMMIT_BRANCH == "main"
# We trigger the pipeline on the release- branches
- if: $CI_COMMIT_BRANCH =~ /^release-.*$/
# We trigger the pipeline on tags
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != ""

workflow:
rules:
# We trigger the pipeline on a merge request
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# We then add all the regular triggers
- !reference [.pipeline-trigger-rules, rules]

# The main or manual job is used to filter out distributions or architectures that are not required on
# every build.
.main-or-manual:
rules:
- !reference [.pipeline-trigger-rules, rules]
- if: $CI_PIPELINE_SOURCE == "schedule"
when: manual

# build-all jobs build packages for every OS / ARCH combination we support.
#
# They are run under two conditions:
# 1) Automatically whenever a new tag is pushed to the repo (e.g. v1.1.0)
# 2) Manually by a reviewer just before merging a MR.
#
# Unlike build-one jobs, it takes a long time to build the full suite
# OS / ARCH combinations, so this is optimized to only run once per MR
# (assuming it all passes). A full set of artifacts including the packages
# built for each OS / ARCH are produced as a result of these jobs.
.build-all-setup: &build-all-setup
<<: *build-setup
stage: build-all
timeout: 2h 30m
# The trigger-pipeline job adds a manualy triggered job to the pipeline on merge requests.
trigger-pipeline:
stage: trigger
script:
- echo "starting pipeline"
rules:
- if: $CI_COMMIT_TAG
when: always
- if: $CI_MERGE_REQUEST_ID
- !reference [.main-or-manual, rules]
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: false
- when: always

.build-setup:
stage: build
variables:
ARTIFACTS_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-${CI_JOB_NAME}-artifacts-${CI_PIPELINE_ID}"
ARTIFACTS_DIR: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-artifacts-${CI_PIPELINE_ID}"
Expand All @@ -80,46 +81,16 @@ variables:
paths:
- ${ARTIFACTS_DIR}

# The full set of build-one jobs organizes to build
# ubuntu18.04 in parallel on each of our supported ARCHs.
build-one-amd64:
<<: *build-one-setup
script:
- make ubuntu18.04-amd64

build-one-ppc64le:
<<: *build-one-setup
script:
- make ubuntu18.04-ppc64le

build-one-arm64:
<<: *build-one-setup
script:
- make ubuntu18.04-arm64

# The full set of build-all jobs organized to
# have builds for each ARCH run in parallel.
build-all-amd64:
<<: *build-all-setup
script:
- make docker-amd64

build-all-x86_64:
<<: *build-all-setup
script:
- make docker-x86_64

build-all-ppc64le:
<<: *build-all-setup
script:
- make docker-ppc64le

build-all-arm64:
<<: *build-all-setup
script:
- make docker-arm64
before_script:
- apk update
- apk upgrade
- apk add coreutils build-base sed git bash make

build-all-aarch64:
<<: *build-all-setup
build:
extends:
- .build-setup
parallel:
matrix:
- PACKAGING: [deb, rpm]
script:
- make docker-aarch64
- make ${PACKAGING}
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Build-Depends: debhelper (>= 9)
Package: nvidia-container-runtime
Architecture: all
Depends: ${misc:Depends}, nvidia-container-toolkit (>= @TOOLKIT_VERSION@), nvidia-container-toolkit (<< 2.0.0)
Description: NVIDIA container runtime
Provides a modified version of runc allowing users to run GPU enabled
containers.
Description: NVIDIA Container Toolkit meta-package
A meta-package that allows installation flows expecting the nvidia-container-runtime
to be migrated to installing the NVIDIA Container Toolkit packages directly.
40 changes: 0 additions & 40 deletions docker/Dockerfile.amazonlinux

This file was deleted.

14 changes: 5 additions & 9 deletions docker/Dockerfile.ubuntu → docker/Dockerfile.deb
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
ARG BASEIMAGE
FROM ${BASEIMAGE}

# packaging dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
ca-certificates \
git \
build-essential \
dh-make \
fakeroot \
build-essential \
devscripts \
lsb-release && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*

# packaging
ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV DEBFULLNAME "NVIDIA CORPORATION"
ENV DEBEMAIL "cudatools@nvidia.com"
ENV PKG_NAME "${PKG_NAME}"
ENV REVISION "$PKG_VERS-$PKG_REV"
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION
ENV SECTION ""

Expand All @@ -45,5 +41,5 @@ RUN sed -i "s;@TOOLKIT_VERSION@;${TOOLKIT_VERSION};" debian/control && \
if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi

CMD export DISTRIB="$(lsb_release -cs)" && \
debuild -eREVISION -eDISTRIB -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
debuild --preserve-env --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \
mv /tmp/*.deb /dist
53 changes: 0 additions & 53 deletions docker/Dockerfile.debian

This file was deleted.

40 changes: 0 additions & 40 deletions docker/Dockerfile.opensuse-leap

This file was deleted.

12 changes: 5 additions & 7 deletions docker/Dockerfile.centos → docker/Dockerfile.rpm
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
ARG BASEIMAGE
FROM ${BASEIMAGE}

# packaging dependencies
RUN yum install -y \
ca-certificates \
wget \
git \
make \
rpm-build && \
rm -rf /var/cache/yum/*

Expand All @@ -14,10 +11,12 @@ ARG PKG_NAME
ARG PKG_VERS
ARG PKG_REV
ARG TOOLKIT_VERSION
ARG DOCKER_VERSION

ENV PKG_NAME "${PKG_NAME}"
ENV VERSION $PKG_VERS
ENV RELEASE $PKG_REV
ENV DOCKER_VERSION $DOCKER_VERSION
ENV TOOLKIT_VERSION $TOOLKIT_VERSION

# output directory
Expand All @@ -27,12 +26,11 @@ RUN mkdir -p $DIST_DIR /dist
WORKDIR $DIST_DIR/..
COPY rpm .

CMD arch=$(uname -m) && \
rpmbuild --clean -bb \
CMD rpmbuild --clean -bb \
-D "_topdir $PWD" \
-D "release_date $(date +'%a %b %d %Y')" \
-D "version $VERSION" \
-D "release $RELEASE" \
-D "toolkit_version $TOOLKIT_VERSION" \
SPECS/${PKG_NAME}.spec && \
SPECS/nvidia-container-runtime.spec && \
mv RPMS/noarch/*.rpm /dist
Loading

0 comments on commit 6f328ae

Please sign in to comment.