blob: be297f44f184cdfda61b782db7bfac25a6619d13 [file] [log] [blame]
Monty Taylor245a3712017-08-07 16:42:23 -05001#!/bin/bash
2# Copyright (c) 2017 Red Hat, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Stupid script I'm using to test migration script locally
18# Assumes project-config is adjacent to zuul and has the mapping file
19
Monty Taylor96253852017-09-26 08:36:15 -050020OPTS=$(getopt -o v --long final -n $0 -- "$@")
21if [ $? != 0 ] ; then
22 echo "Failed parsing options." >&2
23 exit 1
24fi
25eval set -- "$OPTS"
26set -ex
27
28FINAL=0
29VERBOSE=""
30
31while true; do
32 case "$1" in
33 --final)
34 FINAL=1
35 shift
36 ;;
37 -v)
38 VERBOSE=-v
39 shift
40 ;;
41 --)
42 shift
43 break
44 ;;
45 esac
46done
47
Monty Taylor245a3712017-08-07 16:42:23 -050048BASE_DIR=$(cd $(dirname $0)/../..; pwd)
49cd $BASE_DIR/project-config
Monty Taylor96253852017-09-26 08:36:15 -050050if [[ $FINAL ]] ; then
51 git reset --hard
52fi
Monty Taylor245a3712017-08-07 16:42:23 -050053python3 $BASE_DIR/zuul/zuul/cmd/migrate.py --mapping=zuul/mapping.yaml \
Monty Taylor96253852017-09-26 08:36:15 -050054 zuul/layout.yaml jenkins/jobs nodepool/nodepool.yaml . $VERBOSE
55if [[ $FINAL ]] ; then
56 find ../openstack-zuul-jobs/playbooks/legacy -maxdepth 1 -mindepth 1 \
57 -type d | xargs rm -rf
58 mv zuul.d/zuul-legacy-* ../openstack-zuul-jobs/zuul.d/
59 mv playbooks/legacy/* ../openstack-zuul-jobs/playbooks/legacy/
60fi