Use build image directly in CI

This change uses the build image directly in CI instead of
using dind and invoking the docker-* make targets.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2021-10-12 11:15:19 +02:00
parent 229f9c3730
commit f7e9d1ca45
3 changed files with 28 additions and 32 deletions

View File

@ -20,23 +20,29 @@ default:
variables:
IMAGE: "${CI_REGISTRY_IMAGE}"
IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
BUILDIMAGE: "${CI_REGISTRY_IMAGE}/build:${CI_COMMIT_SHORT_SHA}"
stages:
- image
- lint
- go-checks
- go-build
- unit-tests
- build
- build-long
- scan
- release
build-dev-image:
stage: image
before_script:
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
script:
- apk --no-cache add make bash
- make .build-image
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- make .push-build-image
.requires-build-image:
variables:
SKIP_IMAGE_BUILD: "yes"
before_script:
- apk --no-cache add make bash
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- make .pull-build-image
image: "${BUILDIMAGE}"
.go-check:
extends:
@ -47,45 +53,45 @@ fmt:
extends:
- .go-check
script:
- make docker-assert-fmt
- make assert-fmt
vet:
extends:
- .go-check
script:
- make docker-vet
- make vet
lint:
extends:
- .go-check
script:
- make docker-lint
- make lint
allow_failure: true
ineffassign:
extends:
- .go-check
script:
- make docker-ineffassign
- make ineffassign
allow_failure: true
misspell:
extends:
- .go-check
script:
- make docker-misspell
- make misspell
go-build:
extends:
- .requires-build-image
stage: go-build
script:
- make docker-build
- make build
unit-tests:
extends:
- .requires-build-image
stage: unit-tests
script:
- make docker-coverage
- make coverage

View File

@ -15,17 +15,6 @@
include:
- .common-ci.yml
stages:
- image
- go-checks
- go-build
- unit-tests
- test
- scan
- release
- build-one
- build-all
.build-setup:
before_script:
- apk update
@ -42,7 +31,7 @@ stages:
.build-one-setup:
extends:
- .build-setup
stage: build-one
stage: build
rules:
- if: $CI_MERGE_REQUEST_ID
@ -59,7 +48,7 @@ stages:
.build-all-setup:
extends:
- .build-setup
stage: build-all
stage: build-long
timeout: 2h 30m
rules:
- if: $CI_COMMIT_TAG

View File

@ -27,12 +27,13 @@ MODULE := github.com/NVIDIA/nvidia-container-toolkit
docker-native:
include $(CURDIR)/docker/docker.mk
ifeq ($(IMAGE),)
ifeq ($(IMAGE_NAME),)
REGISTRY ?= nvidia
IMAGE=$(REGISTRY)/container-toolkit
IMAGE_NAME = $(REGISTRY)/container-toolkit
endif
IMAGE_TAG ?= $(GOLANG_VERSION)
BUILDIMAGE ?= $(IMAGE):$(IMAGE_TAG)-devel
BUILDIMAGE_TAG ?= golang$(GOLANG_VERSION)
BUILDIMAGE ?= $(IMAGE_NAME)-build:$(BUILDIMAGE_TAG)
EXAMPLES := $(patsubst ./examples/%/,%,$(sort $(dir $(wildcard ./examples/*/))))
EXAMPLE_TARGETS := $(patsubst %,example-%, $(EXAMPLES))