Monty Taylor | 245a371 | 2017-08-07 16:42:23 -0500 | [diff] [blame] | 1 | #!/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 Taylor | 9625385 | 2017-09-26 08:36:15 -0500 | [diff] [blame] | 20 | OPTS=$(getopt -o v --long final -n $0 -- "$@") |
| 21 | if [ $? != 0 ] ; then |
| 22 | echo "Failed parsing options." >&2 |
| 23 | exit 1 |
| 24 | fi |
| 25 | eval set -- "$OPTS" |
| 26 | set -ex |
| 27 | |
| 28 | FINAL=0 |
| 29 | VERBOSE="" |
| 30 | |
| 31 | while 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 |
| 46 | done |
| 47 | |
Monty Taylor | 245a371 | 2017-08-07 16:42:23 -0500 | [diff] [blame] | 48 | BASE_DIR=$(cd $(dirname $0)/../..; pwd) |
| 49 | cd $BASE_DIR/project-config |
Monty Taylor | 9dcb71c | 2017-09-27 11:15:23 -0500 | [diff] [blame] | 50 | if [[ $FINAL = 1 ]] ; then |
Monty Taylor | 9625385 | 2017-09-26 08:36:15 -0500 | [diff] [blame] | 51 | git reset --hard |
| 52 | fi |
Monty Taylor | 245a371 | 2017-08-07 16:42:23 -0500 | [diff] [blame] | 53 | python3 $BASE_DIR/zuul/zuul/cmd/migrate.py --mapping=zuul/mapping.yaml \ |
Monty Taylor | 9625385 | 2017-09-26 08:36:15 -0500 | [diff] [blame] | 54 | zuul/layout.yaml jenkins/jobs nodepool/nodepool.yaml . $VERBOSE |
Monty Taylor | 9dcb71c | 2017-09-27 11:15:23 -0500 | [diff] [blame] | 55 | if [[ $FINAL = 1 ]] ; then |
Monty Taylor | 9625385 | 2017-09-26 08:36:15 -0500 | [diff] [blame] | 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/ |
| 60 | fi |