forked from cvmfs-contrib/cvmfs-csi
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
107 lines (100 loc) · 2.82 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
stages:
- build
- image
- test
- deploy
- cleanup
before_script:
- export CLUSTER_NAME=cvmfs-validation-$(echo $CI_COMMIT_SHA | head -c 6)
- export BASE_CLUSTER_TEMPLATE="kubernetes-1.17.2-3"
- export OS_AUTH_URL="https://keystone.cern.ch/main/v3"
- export OS_IDENTITY_API_VERSION="3"
- export OS_USERNAME="svcbuild"
- export OS_PASSWORD="$SVCBUILD_PASSWORD"
- export OS_PROJECT_NAME="Cloud CI"
- export OS_REGION_NAME="cern"
- export OS_DEFAULT_DOMAIN_NAME="default"
- export OS_TENANT_ID="ec9ce822-d12f-453e-9f18-110652a85798"
- export OS_TENANT_NAME="Cloud CI"
build:
stage: build
image: gitlab-registry.cern.ch/cloud/ciadm:v0.3.6
script:
- make
- make test
artifacts:
expire_in: '30 minutes'
paths:
- bin/csi-cvmfsplugin
except:
- qa
- master
buildimg:
stage: image
variables:
TO: "${CI_REGISTRY_IMAGE}/cvmfs-csi:${CI_COMMIT_SHORT_SHA}"
CONTEXT_DIR: "./"
DOCKER_FILE: "deployments/docker/Dockerfile"
tags:
- docker-image-build
script: "echo"
dependencies:
- build
only:
- branches
except:
- master
testk8s:
stage: test
image: gitlab-registry.cern.ch/cloud/ciadm:v0.3.6
script: |
LABELS=$(openstack coe cluster template show -f json $BASE_CLUSTER_TEMPLATE | jq --raw-output '.labels | to_entries | map("--labels \(.key)=\(.value)") | join(" ")')
openstack coe cluster create $CLUSTER_NAME --cluster-template $BASE_CLUSTER_TEMPLATE --keypair lxplus --node-count 1 --master-count 1 --flavor m2.small $LABELS
sleep 10
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
while [ "${STATUS}" != "CREATE_COMPLETE" ] && [ "${STATUS}" != "CREATE_FAILED" ]
do
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
echo "Current cluster status ... $STATUS $(date)"
sleep 10
done
openstack coe cluster show $CLUSTER_NAME
openstack coe cluster config $CLUSTER_NAME
export KUBECONFIG=config
for m in $(ls test)
do
kubectl create --validate=false -f test/${m}
done
for m in $(ls test)
do
kubectl wait --for=condition=complete --timeout=600s -l ci=true --all-namespaces job
done
dependencies:
- buildimg
except:
- master
- qa
cleanup test clusters:
stage: cleanup
image: gitlab-registry.cern.ch/cloud/ciadm:v0.3.6
script: |
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
while true
do
if [ "${STATUS}" != "DELETE_IN_PROGRESS" ]
then
openstack coe cluster delete $CLUSTER_NAME || true
fi
sleep 10
if STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
then
echo "Current cluster status ... $STATUS $(date)"
else
echo "done"
break
fi
done
when: always
except:
- master
- qa