- 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 <abelur@linuxfoundation.org>
Change-Id: I286dadd10ddde1235d13acdefc0097a2d9ed3505
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
-Subproject commit 7cdb85935ffbdeb1f0b82c0df6d964ff6bc27799
+Subproject commit 200c13dbad2552db1ba9cfc185b0dc40db863930
+++ /dev/null
-#!/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
- 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.
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
platforms: centos-7
templates: builder
+ update-cloud-image: true
- project:
name: packer-devstack-jobs
platforms: centos-7
templates: devstack
+ update-cloud-image: true
- project:
name: packer-devstack-pre-pip-queens-jobs
platforms: centos-7
templates: devstack-pre-pip-queens
+ update-cloud-image: true
- project:
name: packer-devstack-pre-pip-rocky-jobs
platforms: centos-7
templates: devstack-pre-pip-rocky
+ update-cloud-image: true
- project:
name: packer-devstack-pre-pip-stein-jobs
platforms: centos-7
templates: devstack-pre-pip-stein
+ update-cloud-image: true
- project:
name: packer-docker-jobs
- centos-7
- ubuntu-16.04
templates: docker
+ update-cloud-image: true
- project:
name: packer-gbp-jobs
- ubuntu-18.04:
disable-job: true
templates: gbp
+ update-cloud-image: true
- project:
name: packer-mininet-ovs-2.5-jobs
- ubuntu-18.04:
disable-job: true
templates: mininet-ovs-2.5
+ update-cloud-image: true
- project:
name: packer-mininet-ovs-2.6-jobs
- ubuntu-18.04:
disable-job: true
templates: mininet-ovs-2.6
+ update-cloud-image: true
- project:
name: packer-mininet-ovs-2.8-jobs
- ubuntu-18.04:
disable-job: true
templates: mininet-ovs-2.8
+ update-cloud-image: true
- project:
name: packer-robot-jobs
platforms: centos-7
templates: robot
+ update-cloud-image: true
- project:
name: packer-kubernetes-jobs
- 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"