Adding scripts for running RC2 testcases 88/71188/18
authorRihab Banday <rihab.banday@ericsson.com>
Fri, 25 Sep 2020 12:28:27 +0000 (14:28 +0200)
committerRihab Banday <rihab.banday@ericsson.com>
Thu, 19 Nov 2020 13:29:10 +0000 (13:29 +0000)
This patch adds support for running RC2 Functest
testcases suite on the K8s cluster deployed by
Kuberef deployer.

It leverages on Gitlab CI/CD variables to prepare
next Docker runners (for the time being, the
deployment script wrongly forces Shell runners).

Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com>
Change-Id: I7652aa817ad9b434235abf0fab9ba63f4ad2f23e
Signed-off-by: Rihab Banday <rihab.banday@ericsson.com>
Reviewed-on: https://gerrit.opnfv.org/gerrit/c/kuberef/+/71188
Tested-by: jenkins-ci <jenkins-opnfv-ci@opnfv.org>
Reviewed-by: Cedric Ollivier <cedric.ollivier@orange.com>
.gitlab-ci.yml
deploy.sh
functions.sh

index fecf145..51291b8 100644 (file)
 # and run RC2 compliance tests on the deployed platform.
 # TODO add tox jobs
 
+variables:
+  S3_ENDPOINT_URL: https://storage.googleapis.com
+  S3_DST_URL: s3://artifacts.opnfv.org/kuberef/${CI_COMMIT_SHORT_SHA}/${CI_JOB_NAME}-${CI_JOB_ID}
+  HTTP_DST_URL: http://artifacts.opnfv.org/kuberef/${CI_COMMIT_SHORT_SHA}/${CI_JOB_NAME}-${CI_JOB_ID}
+  TEST_DB_URL: http://testresults.opnfv.org/test/api/v1/results
+  TEST_DB_EXT_URL: http://testresults.opnfv.org/test/api/v1/results
+  NODE_NAME: ericsson-pod2
+  BUILD_TAG: ${CI_COMMIT_SHORT_SHA}
+  DEPLOY_SCENARIO: k8-nosdn-nofeature-noha
+
 stages:
+  - .pre
   - deploy_platform
-  - run_compliance_tests
+  - functest-kubernetes-healthcheck
+  - functest-kubernetes-smoke
+  - functest-kubernetes-security
+  - functest-kubernetes-benchmarking
+  - functest-kubernetes-cnf
+  - zip
+  - .post
 
 deploy:
-  stage: deploy_platform
   tags:
     - ericsson-pod2
+  stage: deploy_platform
   script:
     - bash deploy.sh
 
-runtestsuite:
-  extends: deploy
-  stage: run_compliance_tests
+k8s_quick:
   tags:
-    - ericsson-pod2
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-healthcheck
+  image: opnfv/functest-kubernetes-healthcheck:jerma
+  script:
+    - run_tests -t k8s_quick -p -r
+
+k8s_smoke:
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-healthcheck
+  image: opnfv/functest-kubernetes-healthcheck:jerma
+  script:
+    - run_tests -t k8s_smoke -p -r
+
+xrally_kubernetes:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-smoke
+  image: opnfv/functest-kubernetes-smoke:jerma
+  timeout: 3 hours 30 minutes
+  script:
+    - run_tests -t xrally_kubernetes -p -r
+
+k8s_conformance:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-smoke
+  image: opnfv/functest-kubernetes-smoke:jerma
+  timeout: 3 hours 30 minutes
+  script:
+    - run_tests -t k8s_conformance -p -r
+
+kube_hunter:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-security
+  image: opnfv/functest-kubernetes-security:jerma
+  script:
+    - run_tests -t kube_hunter -p -r
+
+kube_bench_master:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-security
+  image: opnfv/functest-kubernetes-security:jerma
+  script:
+    - run_tests -t kube_bench_master -p -r
+
+kube_bench_node:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-security
+  image: opnfv/functest-kubernetes-security:jerma
+  script:
+    - run_tests -t kube_bench_node -p -r
+
+xrally_kubernetes_full:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-benchmarking
+  image: opnfv/functest-kubernetes-benchmarking:jerma
+  script:
+    - run_tests -t xrally_kubernetes_full -p -r
+
+k8s_vims:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-cnf
+  image: opnfv/functest-kubernetes-cnf:jerma
+  script:
+    - run_tests -t k8s_vims -p -r
+
+helm_vims:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-cnf
+  image: opnfv/functest-kubernetes-cnf:jerma
+  script:
+    - run_tests -t helm_vims -p -r
+
+cnf_conformance:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: functest-kubernetes-cnf
+  image: opnfv/functest-kubernetes-cnf:jerma
+  script:
+    - run_tests -t cnf_conformance -p -r
+
+zip:
+  only:
+    - schedules
+  tags:
+    - ericsson-pod2-docker
+  stage: zip
+  variables:
+    S3_DST_URL: s3://artifacts.opnfv.org/kuberef/
+    HTTP_DST_URL: http://artifacts.opnfv.org/kuberef/
+  image: opnfv/functest-kubernetes-healthcheck:jerma
   script:
-    - bash run_testsuite.sh
-  when: on_success
+    - zip_campaign
index 88e746b..7b230f1 100755 (executable)
--- a/deploy.sh
+++ b/deploy.sh
@@ -63,3 +63,9 @@ fi
 # Provision k8s cluster (currently BMRA)
 # ---------------------------------------------------------------------
 provision_k8s
+
+# ---------------------------------------------------------------------
+# Copy kubeconfig to desired location
+# ---------------------------------------------------------------------
+copy_k8s_config
+
index 4e06523..8d206bf 100755 (executable)
@@ -235,6 +235,21 @@ ${ansible_cmd}
 EOF
 }
 
+# Copy kubeconfig to the appropriate location needed by functest containers
+copy_k8s_config() {
+# TODO Use Kubespray variables in BMRA to simplify this
+    MASTER_IP=$(get_host_pxe_ip "nodes[0]")
+    # shellcheck disable=SC2087
+    ssh -o StrictHostKeyChecking=no -tT "$USERNAME"@"$(get_vm_ip)" << EOF
+scp -q root@$MASTER_IP:/root/.kube/config ${PROJECT_ROOT}/kubeconfig
+EOF
+
+# Copy kubeconfig from Jump VM to appropriate location in Jump Host
+# Direct scp to the specified location doesn't work due to permission/ssh-keys
+    scp "$USERNAME"@"$(get_vm_ip)":"${PROJECT_ROOT}"/kubeconfig kubeconfig
+    sudo cp kubeconfig /home/opnfv/functest-kubernetes/config
+}
+
 # Executes a specific Ansible playbook
 run_playbook() {
     ansible_cmd="$(command -v ansible-playbook)"