Skip to content

Commit 28f6b7c

Browse files
author
Evan Lezar
committed
Merge branch 'update-ci' into 'master'
Update CI to use build image directly See merge request nvidia/container-toolkit/container-toolkit!53
2 parents 8457014 + f7e9d1c commit 28f6b7c

File tree

4 files changed

+36
-89
lines changed

4 files changed

+36
-89
lines changed

.common-ci.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,29 @@ default:
2020
variables:
2121
IMAGE: "${CI_REGISTRY_IMAGE}"
2222
IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
23+
BUILDIMAGE: "${CI_REGISTRY_IMAGE}/build:${CI_COMMIT_SHORT_SHA}"
24+
25+
stages:
26+
- image
27+
- lint
28+
- go-checks
29+
- go-build
30+
- unit-tests
31+
- build
32+
- build-long
33+
- scan
34+
- release
2335

2436
build-dev-image:
2537
stage: image
26-
before_script:
27-
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
2838
script:
2939
- apk --no-cache add make bash
3040
- make .build-image
41+
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
3142
- make .push-build-image
3243

3344
.requires-build-image:
34-
variables:
35-
SKIP_IMAGE_BUILD: "yes"
36-
before_script:
37-
- apk --no-cache add make bash
38-
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
39-
- make .pull-build-image
45+
image: "${BUILDIMAGE}"
4046

4147
.go-check:
4248
extends:
@@ -47,45 +53,45 @@ fmt:
4753
extends:
4854
- .go-check
4955
script:
50-
- make docker-assert-fmt
56+
- make assert-fmt
5157

5258
vet:
5359
extends:
5460
- .go-check
5561
script:
56-
- make docker-vet
62+
- make vet
5763

5864
lint:
5965
extends:
6066
- .go-check
6167
script:
62-
- make docker-lint
68+
- make lint
6369
allow_failure: true
6470

6571
ineffassign:
6672
extends:
6773
- .go-check
6874
script:
69-
- make docker-ineffassign
75+
- make ineffassign
7076
allow_failure: true
7177

7278
misspell:
7379
extends:
7480
- .go-check
7581
script:
76-
- make docker-misspell
82+
- make misspell
7783

7884
go-build:
7985
extends:
8086
- .requires-build-image
8187
stage: go-build
8288
script:
83-
- make docker-build
89+
- make build
8490

8591
unit-tests:
8692
extends:
8793
- .requires-build-image
8894
stage: unit-tests
8995
script:
90-
- make docker-coverage
96+
- make coverage
9197

.gitlab-ci.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@
1515
include:
1616
- .common-ci.yml
1717

18-
stages:
19-
- image
20-
- go-checks
21-
- go-build
22-
- unit-tests
23-
- test
24-
- scan
25-
- release
26-
- build-one
27-
- build-all
28-
2918
.build-setup:
3019
before_script:
3120
- apk update
@@ -42,7 +31,7 @@ stages:
4231
.build-one-setup:
4332
extends:
4433
- .build-setup
45-
stage: build-one
34+
stage: build
4635
rules:
4736
- if: $CI_MERGE_REQUEST_ID
4837

@@ -59,7 +48,7 @@ stages:
5948
.build-all-setup:
6049
extends:
6150
- .build-setup
62-
stage: build-all
51+
stage: build-long
6352
timeout: 2h 30m
6453
rules:
6554
- if: $CI_COMMIT_TAG

DEVELOPMENT.md

Lines changed: 8 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ where `TARGET` is a make target that is valid for each of the sub-components.
1919

2020
These include:
2121
* `ubuntu18.04-amd64`
22-
* `docker-all`
23-
with the later generating for all supported distribution and platform combinations.
22+
* `centos8-x86_64`
2423

2524
The packages are generated in the `dist` folder.
2625

@@ -33,62 +32,14 @@ environment variables.
3332

3433
## Testing packages locally
3534

36-
### Ubuntu
35+
The [test/release](./test/release/) folder contains documentation on how the installation of local or staged packages can be tested.
3736

38-
Launch a docker container:
3937

40-
```
41-
docker run --rm -it \
42-
-v $(pwd):/work \
43-
-v $(pwd)/dist/ubuntu18.04/amd64:/local-repository \
44-
-w /work \
45-
ubuntu:18.04
46-
```
47-
48-
49-
```
50-
apt-get update && apt-get install -y apt-utils
51-
```
52-
53-
```
54-
echo "deb [trusted=yes] file:/local-repository/ ./" > /etc/apt/sources.list.d/local.list
55-
```
56-
57-
```
58-
cd /local-repository && apt-ftparchive packages . > Packages
59-
```
60-
61-
```
62-
apt-get update
63-
```
38+
## Releasing
6439

65-
66-
67-
### Centos
68-
69-
```
70-
docker run --rm -it \
71-
-v $(pwd):/work \
72-
-v $(pwd)/dist/centos8/x86_64:/local-repository \
73-
-w /work \
74-
centos:8
75-
```
76-
77-
```
78-
yum install -y createrepo
79-
```
80-
81-
```
82-
createrepo /local-repository
83-
```
84-
85-
```
86-
cat >/etc/yum.repos.d/local.repo <<EOL
87-
[local]
88-
name=NVIDIA Container Toolkit Local Packages
89-
baseurl=file:///local-repository
90-
enabled=1
91-
gpgcheck=0
92-
protect=1
93-
EOL
40+
A utility script [`scripts/release.sh`](./scripts/release.sh) is provided to build
41+
packages required for release. If run without arguments, all supported distribution-architecture combinations are built. A specific distribution-architecture pair can also be provided
42+
```sh
43+
./scripts/release.sh ubuntu18.04-amd64
9444
```
45+
where the `amd64` builds for `ubuntu18.04` are provided as an example.

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ MODULE := github.com/NVIDIA/nvidia-container-toolkit
2727
docker-native:
2828
include $(CURDIR)/docker/docker.mk
2929

30-
ifeq ($(IMAGE),)
30+
ifeq ($(IMAGE_NAME),)
3131
REGISTRY ?= nvidia
32-
IMAGE=$(REGISTRY)/container-toolkit
32+
IMAGE_NAME = $(REGISTRY)/container-toolkit
3333
endif
34-
IMAGE_TAG ?= $(GOLANG_VERSION)
35-
BUILDIMAGE ?= $(IMAGE):$(IMAGE_TAG)-devel
34+
35+
BUILDIMAGE_TAG ?= golang$(GOLANG_VERSION)
36+
BUILDIMAGE ?= $(IMAGE_NAME)-build:$(BUILDIMAGE_TAG)
3637

3738
EXAMPLES := $(patsubst ./examples/%/,%,$(sort $(dir $(wildcard ./examples/*/))))
3839
EXAMPLE_TARGETS := $(patsubst %,example-%, $(EXAMPLES))

0 commit comments

Comments
 (0)