From 7a04088a9013a0ee07c9fac2832ffdb1149745e3 Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Wed, 13 Mar 2024 12:34:00 +0000 Subject: [PATCH] CI/CD pipeline - end-to-end automated tests: - Integrate OFC'22 TFS deployment --- .gitlab-ci.yml | 8 ++++--- src/tests/.gitlab-ci.yml | 8 +++++-- src/tests/ofc22/.gitlab-ci.yml | 44 ++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 src/tests/ofc22/.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 141578287..194e93a6d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,10 +17,9 @@ stages: #- dependencies - build - unit_test - #- deploy - #- end2end_test + - end2end_test -# include the individual .gitlab-ci.yml of each micro-service +# include the individual .gitlab-ci.yml of each micro-service and tests include: #- local: '/manifests/.gitlab-ci.yml' - local: '/src/monitoring/.gitlab-ci.yml' @@ -45,3 +44,6 @@ include: #- local: '/src/dlt/.gitlab-ci.yml' - local: '/src/load_generator/.gitlab-ci.yml' - local: '/src/bgpls_speaker/.gitlab-ci.yml' + + # This should be last one: end-to-end integration tests + - local: '/src/tests/.gitlab-ci.yml' diff --git a/src/tests/.gitlab-ci.yml b/src/tests/.gitlab-ci.yml index db44b9e4a..d48456b83 100644 --- a/src/tests/.gitlab-ci.yml +++ b/src/tests/.gitlab-ci.yml @@ -12,7 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -# include the individual .gitlab-ci.yml of each integration test +# include the individual .gitlab-ci.yml of each end-to-end integration test include: - local: '/src/tests/ofc22/.gitlab-ci.yml' - - local: '/src/tests/oeccpsc22/.gitlab-ci.yml' + #- local: '/src/tests/oeccpsc22/.gitlab-ci.yml' + #- local: '/src/tests/ecoc22/.gitlab-ci.yml' + #- local: '/src/tests/nfvsdn22/.gitlab-ci.yml' + #- local: '/src/tests/ofc23/.gitlab-ci.yml' + #- local: '/src/tests/ofc24/.gitlab-ci.yml' diff --git a/src/tests/ofc22/.gitlab-ci.yml b/src/tests/ofc22/.gitlab-ci.yml new file mode 100644 index 000000000..5f8f8dd1b --- /dev/null +++ b/src/tests/ofc22/.gitlab-ci.yml @@ -0,0 +1,44 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# 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. + +# Build, tag, and push the Docker image to the GitLab Docker registry +end2end ofc22: + variables: + TEST_NAME: 'ofc22' + stage: end2end_test + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - source src/tests/${TEST_NAME}/deploy_specs.sh + - export TFS_REGISTRY_IMAGES="labs.etsi.org:5050/tfs/" + - export TFS_SKIP_BUILD="YES" + - export TFS_IMAGE_TAG="latest" + - ./deploy/all.sh + - while ! kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server 2>&1 | grep -q 'Subscriber is Ready? True'; do sleep 1; done + - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server + ## Run the tests + #- > + # docker exec -i $IMAGE_NAME bash -c + # "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/opt/results/${IMAGE_NAME}_report.xml" + #- docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" + after_script: + - docker images --filter="dangling=true" --quiet | xargs -r docker rmi + #coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + artifacts: + when: always + reports: + junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report.xml -- GitLab