Skip to content

Commit

Permalink
ci: use rancher to create k8s namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kofemann committed Oct 9, 2023
1 parent f26fe08 commit 5172554
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -470,4 +481,4 @@ pynfs_tests:
artifacts:
reports:
junit:
- "xunit*.xml"
- "xunit*.xml"

0 comments on commit 5172554

Please sign in to comment.