add lib-forward-testing-python3
When a project has lib-forward-testing, add lib-forward-testing-python3. Change-Id: Ifd57f23eb6568d49a52a081bf7e75fdc40bec0ca Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
f2ced32a6a
commit
090bc60588
@ -922,6 +922,60 @@ class JobsAddPy36(command.Command):
|
||||
yaml.dump(in_tree_settings, f)
|
||||
|
||||
|
||||
class JobsAddLibForwardTestingPy3(command.Command):
|
||||
"update the project settings to include lib-forward-testing-python3"
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--default-zuul-file',
|
||||
default='.zuul.yaml',
|
||||
help='the default file to create when one does not exist',
|
||||
)
|
||||
parser.add_argument(
|
||||
'repo_dir',
|
||||
help='the repository location',
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
LOG.debug('determining repository name from .gitreview')
|
||||
gitreview_filename = os.path.join(parsed_args.repo_dir, '.gitreview')
|
||||
cp = configparser.ConfigParser()
|
||||
cp.read(gitreview_filename)
|
||||
gerrit = cp['gerrit']
|
||||
repo = gerrit['project']
|
||||
if repo.endswith('.git'):
|
||||
repo = repo[:-4]
|
||||
LOG.info('working on %s', repo)
|
||||
|
||||
in_repo = find_project_settings_in_repo(parsed_args.repo_dir)
|
||||
in_tree_file, in_tree_project, in_tree_settings = in_repo
|
||||
if not in_tree_file:
|
||||
raise RuntimeError('Could not find project settings in {}'.format(
|
||||
parsed_args.repo_dir))
|
||||
|
||||
changed = False
|
||||
templates = in_tree_project['project'].get('templates', [])
|
||||
has_lib_job = 'lib-forward-testing' in templates
|
||||
tests_py3 = 'lib-forward-testing-python3' in templates
|
||||
if has_lib_job and not tests_py3:
|
||||
idx = templates.index('lib-forward-testing')
|
||||
templates.insert(idx + 1, 'lib-forward-testing-python3')
|
||||
changed = True
|
||||
|
||||
if not changed:
|
||||
LOG.info('No updates needed for %s', repo)
|
||||
return 1
|
||||
|
||||
LOG.info('# {} add lib-forward-testing-python3 jobs'.format(repo))
|
||||
yaml = projectconfig_ruamellib.YAML()
|
||||
# yaml.dump([in_tree_project], self.app.stdout)
|
||||
LOG.info('updating %s', in_tree_file)
|
||||
with open(in_tree_file, 'w', encoding='utf-8') as f:
|
||||
yaml.dump(in_tree_settings, f)
|
||||
|
||||
|
||||
class JobsSwitchPackaging(command.Command):
|
||||
"update the project-config settings for the new packaging job"
|
||||
|
||||
|
@ -52,6 +52,7 @@ python3_first =
|
||||
jobs switch docs = goal_tools.python3_first.jobs:JobsSwitchDocs
|
||||
jobs switch packaging = goal_tools.python3_first.jobs:JobsSwitchPackaging
|
||||
jobs add py36 = goal_tools.python3_first.jobs:JobsAddPy36
|
||||
jobs add lib = goal_tools.python3_first.jobs:JobsAddLibForwardTestingPy3
|
||||
repos clone = goal_tools.python3_first.repos:ReposClone
|
||||
repos list = goal_tools.python3_first.repos:ReposList
|
||||
patches list = goal_tools.python3_first.patches:PatchesList
|
||||
|
62
tools/python3-first/add_lib_job.sh
Executable file
62
tools/python3-first/add_lib_job.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
bindir=$(dirname $0)
|
||||
source $bindir/functions
|
||||
|
||||
echo $0 $*
|
||||
echo
|
||||
|
||||
function usage {
|
||||
echo "add_py36_job.sh WORKDIR TEAM TASK"
|
||||
}
|
||||
|
||||
workdir=$1
|
||||
team="$2"
|
||||
task="$3"
|
||||
|
||||
if [ -z "$workdir" ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$team" ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$task" ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
enable_tox
|
||||
|
||||
commit_message="add lib-forward-testing-python3 test job
|
||||
|
||||
This is a mechanically generated patch to add a functional test job
|
||||
running under Python 3 as part of the python3-first goal.
|
||||
|
||||
See the python3-first goal document for details:
|
||||
https://governance.openstack.org/tc/goals/stein/python3-first.html
|
||||
|
||||
Story: #2002586
|
||||
Task: #$task
|
||||
|
||||
"
|
||||
|
||||
tracking_file="$workdir/master"
|
||||
for repo in $(cat "$tracking_file"); do
|
||||
|
||||
echo
|
||||
echo "=== $repo doc jobs ==="
|
||||
echo
|
||||
|
||||
repo_dir="$workdir/$repo"
|
||||
git -C "$repo_dir" checkout python3-first-master
|
||||
if python3-first -v --debug jobs add lib "$repo_dir"
|
||||
then
|
||||
git -C "$repo_dir" add .
|
||||
git -C "$repo_dir" commit -m "$commit_message"
|
||||
git -C "$repo_dir" show
|
||||
fi
|
||||
done
|
@ -58,6 +58,7 @@ python3-first repos clone "$out_dir" "$team"
|
||||
$bindir/process_team.sh "$out_dir" "$team" master $task_id
|
||||
$bindir/update_doc_job.sh "$out_dir" "$team" $task_id
|
||||
$bindir/add_py36_job.sh "$out_dir" "$team" $task_id
|
||||
$bindir/add_lib_job.sh "$out_dir" "$team" $task_id
|
||||
$bindir/process_team.sh "$out_dir" "$team" stable/ocata $task_id
|
||||
$bindir/process_team.sh "$out_dir" "$team" stable/pike $task_id
|
||||
$bindir/process_team.sh "$out_dir" "$team" stable/queens $task_id
|
||||
|
Loading…
Reference in New Issue
Block a user