Skip to content

Commit 0a78256

Browse files
committed
gitlab-ci: use CERN gitlab templates for pushing images and charts
1 parent f280a12 commit 0a78256

File tree

1 file changed

+40
-99
lines changed

1 file changed

+40
-99
lines changed

.gitlab-ci.yml

Lines changed: 40 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,48 @@
1-
stages:
2-
- build
3-
- image
4-
- test
5-
- deploy
6-
- cleanup
1+
include:
2+
- project: 'ci-tools/container-image-ci-templates'
3+
file: 'kaniko-image.gitlab-ci.yml'
4+
ref: master
5+
- project: 'ci-tools/container-image-ci-templates'
6+
file: 'helm.gitlab-ci.yml'
7+
ref: master
78

8-
before_script:
9-
- export CLUSTER_NAME=cvmfs-validation-$(echo $CI_COMMIT_SHA | head -c 6)
10-
- export BASE_CLUSTER_TEMPLATE="kubernetes-1.17.2-3"
11-
- export OS_AUTH_URL="https://keystone.cern.ch/main/v3"
12-
- export OS_IDENTITY_API_VERSION="3"
13-
- export OS_USERNAME="svcbuild"
14-
- export OS_PASSWORD="$SVCBUILD_PASSWORD"
15-
- export OS_PROJECT_NAME="Cloud CI"
16-
- export OS_REGION_NAME="cern"
17-
- export OS_DEFAULT_DOMAIN_NAME="default"
18-
- export OS_TENANT_ID="ec9ce822-d12f-453e-9f18-110652a85798"
19-
- export OS_TENANT_NAME="Cloud CI"
9+
stages:
10+
- build-bin
11+
- build-image
12+
- build-chart
2013

21-
build:
22-
stage: build
23-
image: gitlab-registry.cern.ch/cloud/ciadm:v0.3.6
24-
script:
25-
- make
26-
- make test
14+
build-bin:
15+
stage: build-bin
16+
rules:
17+
- if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG
18+
image: registry.cern.ch/docker.io/library/golang:1.19
2719
artifacts:
28-
expire_in: '30 minutes'
20+
expire_in: '10 minutes'
2921
paths:
3022
- bin/csi-cvmfsplugin
31-
except:
32-
- qa
33-
- master
23+
script:
24+
- make
3425

35-
buildimg:
36-
stage: image
26+
build-image:
27+
rules:
28+
- if: $CI_COMMIT_TAG
29+
variables:
30+
PUSH_IMAGE: "true"
31+
- if: $CI_COMMIT_BRANCH
32+
stage: build-image
33+
extends: .build_kaniko
3734
variables:
38-
TO: "${CI_REGISTRY_IMAGE}/cvmfs-csi:${CI_COMMIT_SHORT_SHA}"
39-
CONTEXT_DIR: "./"
40-
DOCKER_FILE: "deployments/docker/Dockerfile"
41-
tags:
42-
- docker-image-build
43-
script: "echo"
44-
dependencies:
45-
- build
46-
only:
47-
- branches
48-
except:
49-
- master
50-
51-
testk8s:
52-
stage: test
53-
image: gitlab-registry.cern.ch/cloud/ciadm:v0.3.6
54-
script: |
55-
LABELS=$(openstack coe cluster template show -f json $BASE_CLUSTER_TEMPLATE | jq --raw-output '.labels | to_entries | map("--labels \(.key)=\(.value)") | join(" ")')
56-
openstack coe cluster create $CLUSTER_NAME --cluster-template $BASE_CLUSTER_TEMPLATE --keypair lxplus --node-count 1 --master-count 1 --flavor m2.small $LABELS
57-
sleep 10
58-
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
59-
while [ "${STATUS}" != "CREATE_COMPLETE" ] && [ "${STATUS}" != "CREATE_FAILED" ]
60-
do
61-
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
62-
echo "Current cluster status ... $STATUS $(date)"
63-
sleep 10
64-
done
65-
66-
openstack coe cluster show $CLUSTER_NAME
67-
openstack coe cluster config $CLUSTER_NAME
68-
export KUBECONFIG=config
35+
REGISTRY_IMAGE_PATH: "registry.cern.ch/magnum/cvmfs-csi:$CI_COMMIT_TAG"
36+
CONTEXT_DIR: "."
37+
DOCKER_FILE_NAME: "deployments/docker/Dockerfile"
6938

70-
for m in $(ls test)
71-
do
72-
kubectl create --validate=false -f test/${m}
73-
done
74-
for m in $(ls test)
75-
do
76-
kubectl wait --for=condition=complete --timeout=600s -l ci=true --all-namespaces job
77-
done
78-
dependencies:
79-
- buildimg
80-
except:
81-
- master
82-
- qa
83-
84-
cleanup test clusters:
85-
stage: cleanup
86-
image: gitlab-registry.cern.ch/cloud/ciadm:v0.3.6
87-
script: |
88-
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
89-
while true
90-
do
91-
if [ "${STATUS}" != "DELETE_IN_PROGRESS" ]
92-
then
93-
openstack coe cluster delete $CLUSTER_NAME || true
94-
fi
95-
sleep 10
96-
if STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
97-
then
98-
echo "Current cluster status ... $STATUS $(date)"
99-
else
100-
echo "done"
101-
break
102-
fi
103-
done
104-
when: always
105-
except:
106-
- master
107-
- qa
39+
build-chart:
40+
rules:
41+
- if: $CI_COMMIT_TAG
42+
variables:
43+
PUSH_CHART: "true"
44+
- if: $CI_COMMIT_BRANCH
45+
stage: build-chart
46+
extends: .deploy_helm
47+
variables:
48+
REGISTRY_PATH: registry.cern.ch/chartrepo/cern

0 commit comments

Comments
 (0)