From 5343b617f9192a828e95d5ed1967da76db941b6f Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Thu, 26 Sep 2019 14:42:36 +0200 Subject: [PATCH] Update global-jjb to v0.44.0 - Pull in the changes to auto-update packer images. - Enable packer merge jobs to auto-update images post-build with `update-cloud-image`. - Add job to auto-update all images at onces. - Remove redundant job in releng/builder. Signed-off-by: Anil Belur Change-Id: I286dadd10ddde1235d13acdefc0097a2d9ed3505 Signed-off-by: Anil Belur --- global-jjb | 2 +- jjb/opendaylight-infra-update-images.sh | 61 ------------------------- jjb/releng-jobs.yaml | 53 --------------------- jjb/releng-packer-jobs.yaml | 32 +++++++++++++ 4 files changed, 33 insertions(+), 115 deletions(-) delete mode 100644 jjb/opendaylight-infra-update-images.sh diff --git a/global-jjb b/global-jjb index 7cdb85935..200c13dba 160000 --- a/global-jjb +++ b/global-jjb @@ -1 +1 @@ -Subproject commit 7cdb85935ffbdeb1f0b82c0df6d964ff6bc27799 +Subproject commit 200c13dbad2552db1ba9cfc185b0dc40db863930 diff --git a/jjb/opendaylight-infra-update-images.sh b/jjb/opendaylight-infra-update-images.sh deleted file mode 100644 index c77b696b6..000000000 --- a/jjb/opendaylight-infra-update-images.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -l -# SPDX-License-Identifier: EPL-1.0 -############################################################################## -# Copyright (c) 2019 The Linux Foundation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -############################################################################## - -# Auto-update packer images: -# 1. Get a list of images from the releng/builder repository -# 2. Search openstack cloud for the latest images available -# 3. Compare the time stamps of the new image with the image in use -# 4. Update the image to the config files and yaml files -# 5. Push the change to Gerrit - -virtualenv "/tmp/v/openstack" -# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091 -source "/tmp/v/openstack/bin/activate" -pip install --upgrade --quiet "pip<10.0.0" setuptools -pip install --upgrade --quiet python-openstackclient -pip freeze - -mkdir -p "$WORKSPACE/archives" -echo "List of images used on the source repository:" -grep -Er '(_system_image:|IMAGE_NAME)' \ -| grep ZZCI | awk -F: -e '{print $3}' \ -| grep '\S' | tr -d \'\" | sort -n | uniq \ -| tee "$WORKSPACE/archives/used_image_list.txt" - -set -x - -while read -r line ; do - # remove leading white spaces if they exists - image_in_use="${line#"${line%%[![:space:]]*}"}" - # remove trailing white spaces if they exists - image_in_use="${image_in_use%"${image_in_use##*[![:space:]]}"}" - # get image type - ex: builder, docker, gbp etc - image_type="${line% -*}" - # get the latest image available on the cloud - new_image=$(openstack image list --long -f value -c Name -c Protected \ - | grep "${image_type}.*False" | tail -n-1 | sed 's/ False//') - [[ -z ${new_image} ]] && continue - # strip the timestamp from the image name amd compare - new_image_isotime=${new_image##*- } - image_in_use_isotime=${image_in_use##*- } - # compare timestamps - if [[ ${new_image_isotime//[\-\.]/} -gt ${image_in_use_isotime//[\-\.]/} ]]; then - # generate a patch to be submited to Gerrit - echo "Update old image: ${image_in_use} with new image: ${new_image}" - grep -rlE '(_system_image:|IMAGE_NAME)' | xargs sed -i "s/${image_in_use}/${new_image}/" - else - echo "No new image to update: ${new_image}" - fi -done < "$WORKSPACE/archives/used_image_list.txt" - -git remote -v -git add -u -git status diff --git a/jjb/releng-jobs.yaml b/jjb/releng-jobs.yaml index 15005dc95..69d329963 100644 --- a/jjb/releng-jobs.yaml +++ b/jjb/releng-jobs.yaml @@ -22,7 +22,6 @@ - gerrit-tox-verify # Automation for docs and jobs - 'builder-update-image-list' - - 'builder-update-images' # The following values are only specified here # so that code blocks look similar to other projects. @@ -174,55 +173,3 @@ email-recipients: '{email-recipients}' email-prefix: '[releng]' - lf-infra-publish - - -- job-template: - name: 'builder-update-images' - project-type: freestyle - node: centos7-builder-2c-1g - - properties: - - opendaylight-infra-properties: - build-days-to-keep: 7 - - parameters: - - opendaylight-infra-parameters: - os-cloud: vex - project: '{project}' - branch: '{branch}' - refspec: 'refs/heads/{branch}' - artifacts: '{archive-artifacts}' - - scm: - - git-scm: - branch: '{branch}' - - wrappers: - - opendaylight-infra-wrappers: - build-timeout: '{build-timeout}' - # Listed after to override openstack-infra-wrappers clouds.yaml definition - - config-file-provider: - files: - - file-id: clouds-yaml - target: '$HOME/.config/openstack/clouds.yaml' - - triggers: - # Update images the day after packer images are built every month on 2nd - - timed: '00 H 2 * *' - - builders: - - lf-infra-pre-build - - shell: !include-raw-escape: opendaylight-infra-update-images.sh - - lf-infra-push-gerrit-patch: - project: '{project}' - gerrit-user: 'jenkins-$SILO' - gerrit-host: 'git.opendaylight.org' - gerrit-topic: 'releng-update-cloud-images' - gerrit-commit-message: 'Update image to the latest' - reviewers-email: 'jenkins-releng@opendaylight.org' - - publishers: - - email-notification: - email-recipients: '{email-recipients}' - email-prefix: '[releng]' - - lf-infra-publish diff --git a/jjb/releng-packer-jobs.yaml b/jjb/releng-packer-jobs.yaml index 64194b30c..390b8c91f 100644 --- a/jjb/releng-packer-jobs.yaml +++ b/jjb/releng-packer-jobs.yaml @@ -24,6 +24,7 @@ platforms: centos-7 templates: builder + update-cloud-image: true - project: name: packer-devstack-jobs @@ -41,6 +42,7 @@ platforms: centos-7 templates: devstack + update-cloud-image: true - project: name: packer-devstack-pre-pip-queens-jobs @@ -58,6 +60,7 @@ platforms: centos-7 templates: devstack-pre-pip-queens + update-cloud-image: true - project: name: packer-devstack-pre-pip-rocky-jobs @@ -75,6 +78,7 @@ platforms: centos-7 templates: devstack-pre-pip-rocky + update-cloud-image: true - project: name: packer-devstack-pre-pip-stein-jobs @@ -92,6 +96,7 @@ platforms: centos-7 templates: devstack-pre-pip-stein + update-cloud-image: true - project: name: packer-docker-jobs @@ -111,6 +116,7 @@ - centos-7 - ubuntu-16.04 templates: docker + update-cloud-image: true - project: name: packer-gbp-jobs @@ -131,6 +137,7 @@ - ubuntu-18.04: disable-job: true templates: gbp + update-cloud-image: true - project: name: packer-mininet-ovs-2.5-jobs @@ -151,6 +158,7 @@ - ubuntu-18.04: disable-job: true templates: mininet-ovs-2.5 + update-cloud-image: true - project: name: packer-mininet-ovs-2.6-jobs @@ -171,6 +179,7 @@ - ubuntu-18.04: disable-job: true templates: mininet-ovs-2.6 + update-cloud-image: true - project: name: packer-mininet-ovs-2.8-jobs @@ -191,6 +200,7 @@ - ubuntu-18.04: disable-job: true templates: mininet-ovs-2.8 + update-cloud-image: true - project: name: packer-robot-jobs @@ -208,6 +218,7 @@ platforms: centos-7 templates: robot + update-cloud-image: true - project: name: packer-kubernetes-jobs @@ -228,3 +239,24 @@ - ubuntu-18.04: disable-job: true templates: kubernetes + update-cloud-image: true + +- project: + name: openstack-update-cloud-images + jobs: + - gerrit-openstack-update-cloud-image + + project: releng/builder + project-name: builder + branch: master + archive-artifacts: '**/*.log' + jenkins-ssh-credential: 'opendaylight-jenkins-ssh' + + build-node: centos7-builder-2c-1g + # update-cloud-image: true + build-timeout: 10 + + gerrit-user: "jenkins-$SILO" + gerrit-host: "git.opendaylight.org" + gerrit-topic: "update-cloud-image" + reviewers-email: "jenkins-releng@opendaylight.org" -- 2.36.6