From: garciadeblas Date: Mon, 13 May 2024 06:46:55 +0000 (+0200) Subject: Fix Copy Artifacts stage in stage3 in case that tree fails X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fv12.0;hp=7a51165c86b80ee450604b4cd6e6afa2aa0525f5;p=osm%2Fdevops.git Fix Copy Artifacts stage in stage3 in case that tree fails Change-Id: I96b4dd28a8df5374ec0990790a5d69d7fc06fe3a Signed-off-by: garciadeblas --- diff --git a/installers/install_docker_ce.sh b/installers/install_docker_ce.sh index 9d6387fd..750cdb34 100755 --- a/installers/install_docker_ce.sh +++ b/installers/install_docker_ce.sh @@ -70,6 +70,15 @@ EOF" sudo service docker restart echo "... restarted Docker service again" fi + + if [ -n "${DOCKER_PROXY_URL}" ]; then + echo "Configuring containerd" + sudo mv /etc/containerd/config.toml /etc/containerd/config.toml.orig 2>/dev/null + sudo bash -c "containerd config default > /etc/containerd/config.toml" + sudo sed -i "s#\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]#\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]\n \[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"docker.io\"\]\n endpoint = \[\"${DOCKER_PROXY_URL}\"\]\n \[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"registry.hub.docker.com\"]\n endpoint = \[\"${DOCKER_PROXY_URL}\"]#" /etc/containerd/config.toml + sudo service containerd restart + fi + [ -z "${DEBUG_INSTALL}" ] || ! echo "File: /etc/docker/daemon.json" || cat /etc/docker/daemon.json sg docker -c "docker version" || FATAL "Docker installation failed" echo "... Docker CE installation done" diff --git a/installers/install_kubeadm_cluster.sh b/installers/install_kubeadm_cluster.sh index 70f6d9da..babf17ca 100755 --- a/installers/install_kubeadm_cluster.sh +++ b/installers/install_kubeadm_cluster.sh @@ -15,24 +15,28 @@ set +eux -#installs kubernetes packages +K8S_VERSION=1.24 +K8S_PACKAGE_VERSION="$K8S_VERSION".17-1.1 +HELM_VERSION="v3.10.3" + +# installs kubernetes packages function install_kube() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - K8S_VERSION=1.23.3-00 # Kubernetes releases can be found here: https://kubernetes.io/releases/ # To check other available versions, run the following command # curl -s https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep Version | awk '{print $2}' - sudo apt-get update && sudo apt-get install -y apt-transport-https - sudo apt-get update && sudo apt-get install -y apt-transport-https - curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - sudo add-apt-repository "deb https://apt.kubernetes.io/ kubernetes-xenial main" - sudo apt-get update + sudo mkdir /etc/apt/keyrings + sudo apt-get -y update && sudo apt-get install -y apt-transport-https ca-certificates curl + curl -fsSL https://pkgs.k8s.io/core:/stable:/v"$K8S_VERSION"/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v'$K8S_VERSION'/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list + sudo apt-get -y update echo "Installing Kubernetes Packages ..." - sudo apt-get install -y kubelet=${K8S_VERSION} kubeadm=${K8S_VERSION} kubectl=${K8S_VERSION} - cat << EOF | sudo tee -a /etc/default/kubelet - KUBELET_EXTRA_ARGS="--cgroup-driver=cgroupfs" -EOF + sudo apt-get install -y kubelet=${K8S_PACKAGE_VERSION} kubeadm=${K8S_PACKAGE_VERSION} kubectl=${K8S_PACKAGE_VERSION} sudo apt-mark hold kubelet kubeadm kubectl + + sudo rm /etc/containerd/config.toml + sudo systemctl restart containerd + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -71,8 +75,9 @@ function deploy_cni_provider() { #taints K8s master node function taint_master_node() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - K8S_MASTER=$(kubectl get nodes | awk '$3~/master/'| awk '{print $1}') + K8S_MASTER=$(kubectl get nodes | awk '$3~/control-plane/'| awk '{print $1}') kubectl taint node $K8S_MASTER node-role.kubernetes.io/master:NoSchedule- + kubectl taint node $K8S_MASTER node-role.kubernetes.io/control-plane:NoSchedule- sleep 5 [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -81,7 +86,6 @@ function taint_master_node() { #Helm releases can be found here: https://github.com/helm/helm/releases function install_helm() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - HELM_VERSION="v3.7.2" if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then # Helm is not installed. Install helm echo "Helm3 is not installed, installing ..." diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index 9d5a6e4c..0102e2f2 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -216,10 +216,9 @@ node("${params.NODE}") { stage('Copy Artifacts') { // cleanup any previous repo println("Logging system info before deleting repo.") - sh("pwd") - sh("tree -fD repo") - println("Trying to delete previous repo...") - sh("rm -rfv repo") + sh "tree -fD repo || exit 0" + sh 'rm -rvf repo' + sh "tree -fD repo && lsof repo || exit 0" dir('repo') { packageList = [] dir("${RELEASE}") {