Add Gitlab-CI Configuration 42/72642/3
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Mon, 7 Jun 2021 14:52:53 +0000 (07:52 -0700)
committerGwenael Lambrouin <gwenael.lambrouin@orange.com>
Wed, 25 Aug 2021 11:35:19 +0000 (11:35 +0000)
Adds jobs for tox verification, ReadTheDocs builds on changes to docs/,
docker image builds, and disk image verification and builds.

Change-Id: Ie8e579a12ae6a0efd325a04de670486cafd50f46
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
.gitlab-ci.yml [new file with mode: 0644]

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..41d7fa2
--- /dev/null
@@ -0,0 +1,76 @@
+# NFVBench Gitlab-CI Jobs
+---
+include:
+  - project: anuket/releng
+    file: '/gitlab-templates/RTD.gitlab-ci.yml'
+  - project: anuket/releng
+    file: '/gitlab-templates/Docker.gitlab-ci.yml'
+  - project: anuket/releng
+    file: '/gitlab-templates/GoogleStorage.gitlab-ci.yml'
+
+variables:
+  DOCKER_REGISTRY: docker.io
+
+.tox-defaults: &tox-defaults
+  stage: test
+  image: python:3.6
+  before_script:
+    - pip install tox tox-pip-version
+  cache:
+    paths:
+      - .cache/pip
+      - venv/
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+
+pep8:
+  <<: *tox-defaults
+  stage: build
+  script:
+    tox -e pep8
+
+tox-py36:
+  <<: *tox-defaults
+  script:
+    tox -e py36
+
+verify-image:
+  stage: build
+  image: centos:8
+  before_script:
+    - dnf -y install python3-virtualenv
+    - virtualenv venv
+  script:
+    - source venv/bin/activate
+    - !reference [.gsutil-install, script]
+    - cd nfvbenchvm/dib
+    - |
+        echo -e "\e[0Ksection_start:`date +%s`:build_image\r\e[0KBuild Image"
+        bash verify-image.sh -v
+        echo -e "\e[0Ksection_end:`date +%s`:build_image\r\e[0K"
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+
+build-image:
+  stage: deploy
+  image: centos:8
+  before_script:
+    - dnf -y install python3-virtualenv
+    - virtualenv venv
+  script:
+    - source venv/bin/activate
+    - !reference [.gsutil-install, script]
+    - cd nfvbenchvm/dib
+    - |
+        echo -e "\e[0Ksection_start:`date +%s`:build_image\r\e[0KBuild Image"
+        bash build-image.sh
+        echo -e "\e[0Ksection_end:`date +%s`:build_image\r\e[0K"
+  rules:
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+
+docker-build-nfvbench:
+  extends: .docker-build-and-push
+  variables:
+    DOCKER_IMAGE: "$DOCKER_ORGANIZATION/nfvbench"
+    DOCKER_BUILDCONTEXT: "docker"
+    DOCKER_FILEPATH: "docker/Dockerfile"