Retire stackforge/prep-source-repos

This commit is contained in:
Monty Taylor 2015-10-17 16:04:15 -04:00
parent b6bd9d0b4c
commit a39f005960
10 changed files with 7 additions and 427 deletions

3
.gitignore vendored
View File

@ -1,3 +0,0 @@
.*.swp
*~
repo_refs.yaml.variables

View File

@ -1,14 +0,0 @@
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,50 +0,0 @@
This repository contains scripts for managing multiple outstanding patches to
TripleO (or other gerrit based projects).
- tooling to combine arbitrary unmerged gerrit patches (prep_source_repos)
which will also export an rc file with git refs based on the combined
branches
- a sample config file that we're using (repo_refs.yaml)
- some example inputs for doing rack testing of tripleo in the rack-testing
subdir
## Usage
* create a repo_refs.yaml in your TRIPLEO_ROOT (see the one in the root of this
repository for inspiration).
* add the tripleo-end-to-end bin directory to your path (or symlink the
specific scripts into place, or $up to you).
* run prep_source_repos $YOUR\_REFS\_FILE $TRIPLEO\_ROOT to checkout and update
the repositories specified by the refs file. Note that local edits are saved
via git stash whenever you refresh your source repos, and restored after the
update (which may, of course, fail). This provides a convenient way to use
local edits / work in progress for repositories that are used directly (vs
e.g. those that are cloned into images).
* source YOUR_REFS_FILE.variables to configure TripleO scripts to use your
freshly integrated branches
* proceed with any tripleo activies you might have (building images, deploying,
etc etc).
## Advanced use
Refs that don't match the xx/yy/zz form of gerrit refs are presumed to be local
work-in-progress branches. These are not fetched, but are merged into the
rollup branch along with all the other patches. With a little care this permits
working effectively with multiple patchsets in one project without them being
made into a stack in gerrit.
Refs of the form xx/yy/0 are late-bound references to gerrit - they will use
the gerrit REST API to find out the latest version and will use that.
When running prep-source-repos any additional arguments after the refs and
output dir are used to filter the repositories to fetch - so when working on
(say) two local orthogonal patches to nova, and you need to update your rollup
branch just do::
prep-source-repos foo bar nova
and only nova will be updated.

7
README.rst Normal file
View File

@ -0,0 +1,7 @@
This project is no longer maintained.
The contents of this repository are still available in the Git source code
management system. To see the contents of this repository before it reached
its end of life, please check out the previous commit with
"git checkout HEAD^1".

View File

@ -1,143 +0,0 @@
#!/usr/bin/python
import argparse
import json
import os.path
import re
from subprocess import check_call, check_output
import sys
import yaml
import requests
def normalise_conf(conf):
"""generate full paths etc for easy application later.
The resulting structure is:
basename -> (remotebase, gerrit_API_base).
"""
def make_repos(thing, path_stack):
if isinstance(thing, dict):
repos = {}
for key, subthing in thing.items():
path = path_stack + (key,)
repos.update(make_repos(subthing, path))
return repos
elif isinstance(thing, list):
path = '/'.join(path_stack)
repos = {}
for name in thing:
if name in repos:
raise ValueError("%r defined multiple times" % name)
repos[name] = ('%s/%s' % (path, name), path_stack[0])
return repos
else:
raise ValueError("%r is not a dict or list" % (thing,))
conf['repos'] = make_repos(conf['repos'], ())
return conf
def main():
parser = argparse.ArgumentParser()
parser.add_argument("refs", help="the yaml config file")
parser.add_argument("output", help="where to put the downloaded repositories")
parser.add_argument("repos", help="what repos to update", nargs="*")
args = parser.parse_args()
SRC_ROOT = os.path.abspath(args.output)
with open(args.refs, 'rt') as arg_file:
CONF = yaml.safe_load(arg_file.read())
CONF = normalise_conf(CONF)
if not os.path.lexists(SRC_ROOT):
os.makedirs(SRC_ROOT)
variables = []
session = requests.Session()
session.headers = {'Accept': 'application/json', 'Accept-Encoding': 'gzip'}
resolved_refs = {}
for repo, (remote, gerrit) in CONF['repos'].items():
if args.repos and repo not in args.repos:
continue
rd = os.path.join(SRC_ROOT, repo)
if not os.path.isdir(os.path.join(rd)):
check_call(['git', 'clone', remote, rd])
refs = CONF['gerrit_refs'].get(repo, ())
git_refs = ['+master:review/master']
for ref in refs:
segments = ref.split('/')
if len(segments) != 3:
# Weak heuristic, may need fixing.
continue
if segments[2] == '0':
# pull the latest edition
gerrit_url = gerrit + ('/changes/?q=%s&o=CURRENT_REVISION'
% segments[1])
details = json.loads(session.get(gerrit_url).text[4:])
src = details[0]['revisions'].values()[0]['fetch'].values()[0]
rref = src['ref']
print("Resolved ref %s to %s" % (ref, rref))
resolved_refs[ref] = rref
else:
rref = 'refs/changes/%(ref)s' % dict(ref=ref)
git_refs.append(
'+%(rref)s:%(rref)s' % dict(rref=rref))
print 'fetching from %s %s' % (remote, git_refs)
check_call(['git', 'fetch', remote] + git_refs, cwd=rd)
if not refs:
branch_name = 'master'
else:
components = []
for ref in refs:
segments = ref.split('/')
if len(segments) == 3:
components.append(segments[1])
else:
components.append(ref)
branch_name = 'rollup_' + '_'.join(components)
dirty = check_output(['git', 'status', '-z', '-uno'], cwd=rd)
if dirty:
check_call(['git', 'stash'], cwd=rd)
branches = check_output(['git', 'branch', '-a'], cwd=rd)
if ' ' + branch_name in branches:
print 'Resetting existing branch %s...' % branch_name
check_call(['git', 'checkout', branch_name], cwd=rd)
check_call(['git', 'reset', '--hard', 'review/master'], cwd=rd)
else:
check_call(['git', 'checkout', '-b', branch_name, 'review/master'], cwd=rd)
for ref in refs:
segments = ref.split('/')
if len(segments) == 3:
if ref in resolved_refs:
ref = resolved_refs[ref]
else:
ref = 'refs/changes/%s' % ref
print 'merging in %s' % ref
check_call(['git', 'merge', '--no-edit', ref], cwd=rd)
if dirty:
check_call(['git', 'stash', 'pop'], cwd=rd)
normalised_repo = re.sub('[^A-Za-z0-9_]', '_', repo)
if repo not in CONF['gerrit_refs']:
print 'no refs for %s' % repo
variables.append((normalised_repo, rd, None))
else:
variables.append((normalised_repo, rd, branch_name))
with open(args.refs + '.variables', 'wt') as output:
for name, location, ref in variables:
output.write('export DIB_REPOTYPE_%s=git\n' % name)
output.write('export DIB_REPOLOCATION_%s=%s\n' % (name, location))
if ref:
output.write('export DIB_REPOREF_%s=%s\n' % (name, ref))
else:
output.write('unset DIB_REPOREF_%s\n'% name)
return 0
sys.exit(main())

View File

@ -1,16 +0,0 @@
Here we find:
* sample nodes.json and networks.json files
* an example devtestrc which we use when testing in one of the HP test racks
To use:
* follow the main readme to get your source repos downloaded and variables
defined.
* create appropriate customised nodes and network json files
* run it::
devtest.sh --trash-my-machine --nodes $PATH_TO/nodes.json --bm-networks $PATH_TO/bm-network.json

View File

@ -1,108 +0,0 @@
#PROXY="10.22.167.17"; # Using desktop squid
#PYPI_MIRROR="10.22.167.17";
#### Set these specific to your environment!
####
# IP/Hostname of pypi mirror, or leave blank to not use
export PYPI_MIRROR=${PYPI_MIRROR:-''}
# IP/Hostname:Port of HTTP/HTTPS Proxy, or leave blank to not use
export PROXY=${PROXY:-''}
export TRIPLEO_ROOT=${TRIPLEO_ROOT:-"$PWD/tripleo"}
export TE_DATAFILE=${TE_DATAFILE:-"$TRIPLEO_ROOT/testenv.json"}
export NeutronPublicInterface=eth2
# Scale for overcloud compute/control.
export OVERCLOUD_CONTROLSCALE=${OVERCLOUD_CONTROLSCALE:-"1"}
export OVERCLOUD_COMPUTESCALE=${OVERCLOUD_COMPUTESCALE:-"29"}
# Specific to your network
export FLOATING_START=${FLOATING_START:-"10.22.157.225"}
export FLOATING_END=${FLOATING_END:-"10.22.157.254"}
export FLOATING_CIDR=${FLOATING_CIDR:-"10.22.157.244/27"}
# Relies on https://review.openstack.org/97626
export OVERCLOUD_FIXED_RANGE_CIDR=${OVERCLOUD_FIXED_RANGE_CIDR:-"192.168.10.0/24"}
# Be sure to create a large seed vm
export SEED_CPU=${SEED_CPU:-24}
export SEED_MEM=${SEED_MEM:-24576}
##### end
if [[ -n "$PROXY" ]] ; then
export http_proxy="http://$PROXY/"
export https_proxy="https://$PROXY/"
export no_proxy="${PYPI_MIRROR},localhost";
fi
if [[ -n "$PYPI_MIRROR" ]] ; then
export PYPI_MIRROR_URL="http://${PYPI_MIRROR}/pypi/latest"; # point this at the pypi mirror.
export DIB_NO_PYPI_PIP=1
fi
export DIB_COMMON_ELEMENTS="$LOCAL_DIB_ELEMENTS stackuser pypi -u use-ephemeral mellanox"
export DEVTEST_PERF_COMMENT="$(hostname): clean re-run, using USEast pypi mirror."
# same arch as host machine, so the wheels in the mirror work
export NODE_ARCH=amd64
export NODE_DIST=${NODE_DIST:-"ubuntu"}
export DIB_RELEASE=trusty
export USE_IRONIC=1
# NOTE (adam_g): Limit cloud-init data sources to Ec2 to workaround
# trusty cloud-init bug #1316475.
# Relies on https://review.openstack.org/#/c/95598/
export DIB_CLOUD_INIT_DATASOURCES="Ec2"
export UNDERCLOUD_DIB_EXTRA_ARGS="rabbitmq-server cloud-init-datasources"
export OVERCLOUD_CONTROL_DIB_EXTRA_ARGS="rabbitmq-server cloud-init-datasources"
export OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS="cloud-init-datasources"
if [ -z "$NO_SOURCE_PREP" ]; then
cd $TRIPLE_ROOT/tripleo-end-to-end
bin/prep_source_repos
cd -
fi
# Clone our local git copies. Make devtest.sh prefer your local repositories. You'll still need to have stuff checked in to them!
for n in $TRIPLEO_ROOT/*;
do
[ -d "$n" -a -d "$n/.git" ] || continue
nn=$(basename "$n") # work around older bash
bn=${nn//[^A-Za-z0-9_]/_}
DIB_REPOTYPE="DIB_REPOTYPE_${bn}";
DIB_REPOLOCATION="DIB_REPOLOCATION_${bn}";
DIB_REPOREF="DIB_REPOREF_${bn}";
export "${DIB_REPOTYPE}"="git";
export "${DIB_REPOLOCATION}"="${n}";
unset branch;
if branch=$(cd "${n}" && git symbolic-ref --short -q HEAD);
then
export "${DIB_REPOREF}"="${branch}";
else
unset "${DIB_REPOREF}";
fi
printf "%-25s %-5s %-60s %s\n" "${bn}" "${!DIB_REPOTYPE}" "${!DIB_REPOLOCATION}" "${!DIB_REPOREF}";
pushd "${n}" >/dev/null;
if [[ "$(git rev-parse master)" != "$( git rev-parse HEAD)" ]];
then
IFS=$'\n';
for f in $(git log master.. --oneline); do
printf ' \e[1;31m%-60s \e[1;34m%s\e[m\n' "${f}" "$(git show $(echo $f | cut -d" " -f1) | awk '/Change-Id/ {print "http://review.openstack.org/r/" $2}')";
done
fi
popd >/dev/null;
done
source $TRIPLEO_ROOT/tripleo-incubator/scripts/devtest_variables.sh

View File

@ -1,13 +0,0 @@
{
"cidr": "10.22.157.0/24",
"gateway-ip": "10.22.157.1",
"seed": {
"ip": "10.22.157.150",
"range-start": "10.22.157.151",
"range-end": "10.22.157.152"
},
"undercloud": {
"range-start": "10.22.157.153",
"range-end": "10.22.157.190"
}
}

View File

@ -1,22 +0,0 @@
[{
"pm_password": "foo",
"mac": ["78:e7:d1:24:99:a5"],
"pm_addr": "10.22.51.66",
"pm_type": "pxe_ipmitool",
"memory": 98304,
"disk": 1600,
"arch": "amd64",
"cpu": 24,
"pm_user": "Administrator"
},
{
"pm_password": "AFDJHTVQ",
"mac": ["78:e7:d1:24:6f:c5"],
"pm_addr": "10.22.51.69",
"pm_type": "pxe_ipmitool",
"memory": 98304,
"disk": 1600,
"arch": "amd64",
"cpu": 24,
"pm_user": "Administrator"
}]

View File

@ -1,58 +0,0 @@
# hash of repos to download
repos:
# each hash becomes a path component
# The top one must be the API server root for gerrit's REST API.
http://review.openstack.org:
# until we get down to a list
openstack:
# at which point we're naming a repo and downloading it to disk as ./$name
- cinder
- dib-utils
- diskimage-builder
- glance
- heat
- horizon
- ironic
- keystone
- neutron
- nova
- os-cloud-config
- python-ceilometerclient
- python-cinderclient
- python-glanceclient
- python-heatclient
- python-ironicclient
- python-keystoneclient
- python-neutronclient
- python-novaclient
- python-swiftclient
- swift
- tripleo-heat-templates
- tripleo-image-elements
- tripleo-incubator
openstack-infra:
- tripleo-ci
# A list of patches to pull from gerrit into repos
gerrit_refs:
# The name of said repo from above.
ironic:
# Fix tear_down a node with missing info
# https://review.openstack.org/#/c/103685/
- 85/103685/0
tripleo-image-elements:
# Hack in pending upstream eventlet patch DONT MERGE
# https://review.openstack.org/#/c/105304/
- 04/105304/0
# Permit non-loopback guest access to Rabbit
# https://review.openstack.org/#/c/92815/
# ^ this was one of the only patches from last round of testing not
# yet merged. not sure its critically required or ?
- 15/92815/3
tripleo-incubator:
# User-specified undercloud and overcloud img names
# https://review.openstack.org/#/c/107199/
- 99/107199/4