Skip to content

Commit 99859e4

Browse files
author
Evan Lezar
committed
Merge branch 'import-wrapper-and-runtime' into 'main'
Import NVIDIA Docker and NVIDIA Container Runtime to in-tree folders See merge request nvidia/container-toolkit/container-toolkit!418
2 parents c11c769 + 652345b commit 99859e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2743
-10
lines changed

.gitmodules

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,3 @@
22
path = third_party/libnvidia-container
33
url = https://gitlab.com/nvidia/container-toolkit/libnvidia-container.git
44
branch = main
5-
[submodule "third_party/nvidia-container-runtime"]
6-
path = third_party/nvidia-container-runtime
7-
url = https://gitlab.com/nvidia/container-toolkit/container-runtime.git
8-
branch = main
9-
[submodule "third_party/nvidia-docker"]
10-
path = third_party/nvidia-docker
11-
url = https://gitlab.com/nvidia/container-toolkit/nvidia-docker.git
12-
branch = main
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dist
2+
testing
3+
.git
4+
test/output
5+
/nvidia-container-runtime
6+
/runc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testing/* linguist-vendored=true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dist
2+
*.swp
3+
*.swo
4+
test/output
5+
/runc
6+
/nvidia-container-runtime
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
default:
16+
image: docker
17+
services:
18+
- name: docker:dind
19+
command: ["--experimental"]
20+
21+
variables:
22+
# We specify the LIB_VERSION, TOOLKIT_VERSION, and TOOLKIT_TAG variable to allow packages
23+
# to be built.
24+
LIB_VERSION: 999.999.999
25+
LIB_TAG: dummy+lib
26+
TOOLKIT_VERSION: 999.999.999
27+
TOOLKIT_TAG: dummy+toolkit
28+
29+
# Build packages for all supported OS / ARCH combinations
30+
stages:
31+
- trigger
32+
- build
33+
34+
.pipeline-trigger-rules:
35+
rules:
36+
# We trigger the pipeline if started manually
37+
- if: $CI_PIPELINE_SOURCE == "web"
38+
# We trigger the pipeline on the main branch
39+
- if: $CI_COMMIT_BRANCH == "main"
40+
# We trigger the pipeline on the release- branches
41+
- if: $CI_COMMIT_BRANCH =~ /^release-.*$/
42+
# We trigger the pipeline on tags
43+
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != ""
44+
45+
workflow:
46+
rules:
47+
# We trigger the pipeline on a merge request
48+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
49+
# We then add all the regular triggers
50+
- !reference [.pipeline-trigger-rules, rules]
51+
52+
# The main or manual job is used to filter out distributions or architectures that are not required on
53+
# every build.
54+
.main-or-manual:
55+
rules:
56+
- !reference [.pipeline-trigger-rules, rules]
57+
- if: $CI_PIPELINE_SOURCE == "schedule"
58+
when: manual
59+
60+
# The trigger-pipeline job adds a manualy triggered job to the pipeline on merge requests.
61+
trigger-pipeline:
62+
stage: trigger
63+
script:
64+
- echo "starting pipeline"
65+
rules:
66+
- !reference [.main-or-manual, rules]
67+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
68+
when: manual
69+
allow_failure: false
70+
- when: always
71+
72+
.build-setup:
73+
stage: build
74+
variables:
75+
ARTIFACTS_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-${CI_JOB_NAME}-artifacts-${CI_PIPELINE_ID}"
76+
ARTIFACTS_DIR: "${CI_PROJECT_NAME}-${CI_COMMIT_REF_SLUG}-artifacts-${CI_PIPELINE_ID}"
77+
DIST_DIR: "${CI_PROJECT_DIR}/${ARTIFACTS_DIR}"
78+
79+
artifacts:
80+
name: ${ARTIFACTS_NAME}
81+
paths:
82+
- ${ARTIFACTS_DIR}
83+
84+
before_script:
85+
- apk update
86+
- apk upgrade
87+
- apk add coreutils build-base sed git bash make
88+
89+
build:
90+
extends:
91+
- .build-setup
92+
parallel:
93+
matrix:
94+
- PACKAGING: [deb, rpm]
95+
script:
96+
- make ${PACKAGING}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Contribute to the NVIDIA Container Toolkit
2+
3+
Want to hack on the NVIDIA Container Toolkit Project? Awesome!
4+
We only require you to sign your work, the below section describes this!
5+
6+
## Sign your work
7+
8+
The sign-off is a simple line at the end of the explanation for the patch. Your
9+
signature certifies that you wrote the patch or otherwise have the right to pass
10+
it on as an open-source patch. The rules are pretty simple: if you can certify
11+
the below (from [developercertificate.org](http://developercertificate.org/)):
12+
13+
```
14+
Developer Certificate of Origin
15+
Version 1.1
16+
17+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
18+
1 Letterman Drive
19+
Suite D4700
20+
San Francisco, CA, 94129
21+
22+
Everyone is permitted to copy and distribute verbatim copies of this
23+
license document, but changing it is not allowed.
24+
25+
Developer's Certificate of Origin 1.1
26+
27+
By making a contribution to this project, I certify that:
28+
29+
(a) The contribution was created in whole or in part by me and I
30+
have the right to submit it under the open source license
31+
indicated in the file; or
32+
33+
(b) The contribution is based upon previous work that, to the best
34+
of my knowledge, is covered under an appropriate open source
35+
license and I have the right under that license to submit that
36+
work with modifications, whether created in whole or in part
37+
by me, under the same open source license (unless I am
38+
permitted to submit under a different license), as indicated
39+
in the file; or
40+
41+
(c) The contribution was provided directly to me by some other
42+
person who certified (a), (b) or (c) and I have not modified
43+
it.
44+
45+
(d) I understand and agree that this project and the contribution
46+
are public and that a record of the contribution (including all
47+
personal information I submit with it, including my sign-off) is
48+
maintained indefinitely and may be redistributed consistent with
49+
this project or the open source license(s) involved.
50+
```
51+
52+
Then you just add a line to every git commit message:
53+
54+
Signed-off-by: Joe Smith <joe.smith@email.com>
55+
56+
Use your real name (sorry, no pseudonyms or anonymous contributions.)
57+
58+
If you set your `user.name` and `user.email` git configs, you can sign your
59+
commit automatically with `git commit -s`.
60+
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
*/
16+
17+
podTemplate (cloud:'sw-gpu-cloudnative',
18+
containers: [
19+
containerTemplate(name: 'docker', image: 'docker:dind', ttyEnabled: true, privileged: true)
20+
]) {
21+
node(POD_LABEL) {
22+
def scmInfo
23+
24+
stage('checkout') {
25+
scmInfo = checkout(scm)
26+
}
27+
28+
stage('dependencies') {
29+
container('docker') {
30+
sh 'apk add --no-cache make bash git'
31+
}
32+
}
33+
stage('check') {
34+
}
35+
stage('test') {
36+
}
37+
38+
def versionInfo
39+
stage('version') {
40+
container('docker') {
41+
versionInfo = getVersionInfo(scmInfo)
42+
println "versionInfo=${versionInfo}"
43+
}
44+
}
45+
46+
def dist = 'ubuntu20.04'
47+
def arch = 'amd64'
48+
def stageLabel = "${dist}-${arch}"
49+
50+
stage('build-one') {
51+
container('docker') {
52+
stage (stageLabel) {
53+
sh "make ${dist}-${arch}"
54+
}
55+
}
56+
}
57+
58+
stage('release') {
59+
container('docker') {
60+
stage (stageLabel) {
61+
62+
def component = 'main'
63+
def repository = 'sw-gpu-cloudnative-debian-local/pool/main/'
64+
65+
def uploadSpec = """{
66+
"files":
67+
[ {
68+
"pattern": "./dist/${dist}/${arch}/*.deb",
69+
"target": "${repository}",
70+
"props": "deb.distribution=${dist};deb.component=${component};deb.architecture=${arch}"
71+
}
72+
]
73+
}"""
74+
75+
sh "echo starting release with versionInfo=${versionInfo}"
76+
if (versionInfo.isTag) {
77+
// upload to artifactory repository
78+
def server = Artifactory.server 'sw-gpu-artifactory'
79+
server.upload spec: uploadSpec
80+
} else {
81+
sh "echo skipping release for non-tagged build"
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}
88+
89+
// getVersionInfo returns a hash of version info
90+
def getVersionInfo(def scmInfo) {
91+
def versionInfo = [
92+
isTag: isTag(scmInfo.GIT_BRANCH)
93+
]
94+
95+
scmInfo.each { k, v -> versionInfo[k] = v }
96+
return versionInfo
97+
}
98+
99+
def isTag(def branch) {
100+
if (!branch.startsWith('v')) {
101+
return false
102+
}
103+
104+
def version = shOutput('git describe --all --exact-match --always')
105+
return version == "tags/${branch}"
106+
}
107+
108+
def shOuptut(def script) {
109+
return sh(script: script, returnStdout: true).trim()
110+
}

0 commit comments

Comments
 (0)