From 5172554462002a57af23e7df26ab9d792e7946b4 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 9 Oct 2023 11:58:24 +0200 Subject: [PATCH] ci: use rancher to create k8s namespace --- .gitlab-ci.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 235b5d59bf9..fe7a8ccd2e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,12 @@ # DOCKER_HUB_ACCESS_KEY: Access Key or Password of the docker user # # +# DESY env: we use rancher2 based cluster. User rancher cli to create namespace to bind to the project +# +# RANCHER_SERVER: rancher server endpoint +# RANCHER_TOKEN: rancher access token +# RANCHER_CONTEXT: associated rancher project +# # # KUBECONFIG: env file that contains kubernetes configuration to access the cluster # @@ -69,7 +75,13 @@ default: .kubernetes_image: extends: .kubernetes_tags image: bitnami/kubectl:latest - + +.rancher_image: + extends: .kubernetes_tags + image: rancher/cli2 + before_script: + - rancher login ${RANCHER_SERVER} --token ${RANCHER_TOKEN} --context ${RANCHER_CONTEXT} + .helm_image: extends: .kubernetes_tags image: @@ -321,10 +333,9 @@ upload_container: # prepare_k8s_env: stage: testenv_pre - extends: .kubernetes_image + extends: .rancher_image script: - - kubectl create namespace ${K8S_NAMESPACE} - + - rancher namespaces create ${K8S_NAMESPACE} # # collect all logs @@ -348,12 +359,12 @@ collect_logs: # cleanup_k8s_env: stage: testenv_post - extends: .kubernetes_image + extends: .rancher_image needs: - collect_logs when: always script: - - kubectl delete namespace ${K8S_NAMESPACE} --grace-period=1 --ignore-not-found=true + - rancher namespaces delete ${K8S_NAMESPACE} # # infrastructure required to run dCache @@ -470,4 +481,4 @@ pynfs_tests: artifacts: reports: junit: - - "xunit*.xml" \ No newline at end of file + - "xunit*.xml"