Skip to content
Snippets Groups Projects

New CI

Merged Guillermo Facundo Colunga requested to merge update_ci into qa
5 files
+ 152
29
Compare changes
  • Side-by-side
  • Inline
Files
5
.gitlab-ci.yml 0 → 100644
+ 132
0
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
stages:
- lint
- test
- build
- tag
- release
docs_lint:
stage: lint
script:
- dnf install -y python-pip
- python3 -m pip install linkcheckmd
- python3 -m linkcheckmd -v README.md
yaml_lint:
stage: lint
script:
- dnf install -y epel-release
- dnf install -y yamllint
- yamllint .
helm_lint:
stage: lint
image: alpine/helm
script:
- helm dep update .
- helm lint --strict .
version_test:
stage: test
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "qa"'
script: |
dnf install -y python3-pip
pip install yq
MASTER_VERSION=$(curl https://gitlab.cern.ch/monitoring/helm-charts/kubernetes-monitoring/-/raw/qa/Chart.yaml?ref_type=heads | yq .version)
LOCAL_VERSION=$(cat Chart.yaml | yq .version)
if [ $MASTER_VERSION == $LOCAL_VERSION ]; then
echo "Please, update Chart.yaml version before merge."
exit -1
else
echo "Chart version changed from $MASTER_VERSION to $LOCAL_VERSION."
fi
helm_test:
stage: test
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
script: |
dnf install -y python3-pip
pip install yq
dnf install -y python3-setuptools
dnf install -y gcc
dnf install -y python3-devel
dnf install -y epel-release
dnf install -y diffutils wget tar
wget https://get.helm.sh/helm-v3.15.3-linux-386.tar.gz
tar -zxvf helm-v3.15.3-linux-386.tar.gz
mv linux-386/helm /usr/local/bin/helm
rm helm-v3.15.3-linux-386.tar.gz
rm -rf linux-386
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
rm kubectl
pip install python-openstackclient
pip install python-magnumclient
dnf install openssl
export OS_AUTH_URL=$CI_OS_AUTH_URL
export OS_PROJECT_ID=$CI_OS_PROJECT_ID
export OS_PROJECT_NAME=$CI_OS_PROJECT_NAME
export OS_USER_DOMAIN_NAME=$CI_OS_USER_DOMAIN_NAME
export OS_USERNAME=$CI_OS_USERNAME
export OS_PASSWORD=$CI_OS_PASSWORD
export OS_REGION_NAME=$CI_OS_REGION_NAME
export OS_INTERFACE=$CI_OS_INTERFACE
export OS_IDENTITY_API_VERSION=$CI_OS_IDENTITY_API_VERSION
echo "OpenStack configured as:"
echo "OS_AUTH_URL $OS_AUTH_URL"
echo "OS_PROJECT_ID $OS_PROJECT_ID"
echo "OS_PROJECT_NAME $OS_PROJECT_NAME"
echo "OS_USER_DOMAIN_NAME $OS_USER_DOMAIN_NAME"
echo "OS_USERNAME $OS_USERNAME"
echo "OS_PASSWORD $OS_PASSWORD"
echo "OS_REGION_NAME $OS_REGION_NAME"
echo "OS_INTERFACE $OS_INTERFACE"
echo "OS_IDENTITY_API_VERSION $OS_IDENTITY_API_VERSION"
CLUSTER_NAME=test-cluster-$(openssl rand -hex 2)
echo "Creating cluster $CLUSTER_NAME..."
openstack coe cluster create \
--cluster-template kubernetes-1.30.2-1 \
--node-count 1 \
--flavor m2.medium \
--merge-labels \
--labels eos_enabled=false \
--labels cern_enabled=false \
$CLUSTER_NAME
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
echo "Cluster $CLUSTER_NAME CREATED. Configuring credentials."
openstack coe cluster config --force $CLUSTER_NAME 2> /dev/null || true
echo "Exporting Kubeconfig..."
export KUBECONFIG=$(pwd)/config
echo "Installing and testing helm chart"
LOCAL_VERSION=$(cat Chart.yaml | yq -r .version)
kubectl delete -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/bundle.yaml || true
helm dependency update
helm package .
ls -all
helm install cern-it-kubernetes-monitoring-crds https://gitlab.cern.ch/monitoring/helm-charts/kubernetes-monitoring-crds/-/archive/v0.1.0/kubernetes-monitoring-crds-v0.1.0.tar.gz -n monitoring --create-namespace
helm install cern-it-kubernetes-monitoring ./cern-it-kubernetes-monitoring-$LOCAL_VERSION.tgz -f values.yaml -n monitoring --create-namespace
helm test --logs cern-it-kubernetes-monitoring -n monitoring
echo "Deleting temporal cluster."
openstack coe cluster delete $CLUSTER_NAME
Loading