From 575c714bacbbe50c63e50b526ccc36b6e2552db3 Mon Sep 17 00:00:00 2001 From: Kevin Klues Date: Mon, 22 Mar 2021 11:21:36 +0000 Subject: [PATCH] Add .gitlab-ci files (for both internal and external builds) Signed-off-by: Kevin Klues --- .common-ci.yml | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 16 ++++++++++ .nvidia-ci.yml | 16 ++++++++++ 3 files changed, 116 insertions(+) create mode 100644 .common-ci.yml create mode 100644 .gitlab-ci.yml create mode 100644 .nvidia-ci.yml diff --git a/.common-ci.yml b/.common-ci.yml new file mode 100644 index 0000000..f97d121 --- /dev/null +++ b/.common-ci.yml @@ -0,0 +1,84 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +default: + image: docker:stable + services: + - docker:stable-dind + +stages: + - image + - lint + - build + - test + - scan + - release + +variables: + IMAGE: "${CI_REGISTRY_IMAGE}" + IMAGE_TAG: "${CI_COMMIT_REF_SLUG}" + +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 + - make .build-image + - make .push-build-image + +.requires-build-image: + variables: + SKIP_IMAGE_BUILD: "yes" + before_script: + - apk --no-cache add make + - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" + - make .pull-build-image + +.lint: + extends: + - .requires-build-image + stage: lint + allow_failure: true + +fmt: + extends: + - .lint + script: + - make docker-assert-fmt + +vet: + extends: + - .lint + script: + - make docker-vet + +lint: + extends: + - .lint + script: + - make docker-lint + +build: + extends: + - .requires-build-image + stage: build + script: + - make docker-build + +unit-tests: + extends: + - .requires-build-image + stage: test + script: + - make docker-test diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6758246 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include: + - .common-ci.yml diff --git a/.nvidia-ci.yml b/.nvidia-ci.yml new file mode 100644 index 0000000..6758246 --- /dev/null +++ b/.nvidia-ci.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include: + - .common-ci.yml