Browse Source

Add local file copying steps

These are the things one does after running the script. Update the job
to run the actual script we're running to generate the data the way
we're running it.

Change-Id: I62d75d561efbb290d2fccbabf4fabfbf705e6288
changes/44/507544/6
Monty Taylor 5 years ago
parent
commit
9625385fe9
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
  1. 14
      .zuul.yaml
  2. 26
      playbooks/zuul-migrate.yaml
  3. 26
      playbooks/zuul-migrate/post.yaml
  4. 10
      playbooks/zuul-migrate/run.yaml
  5. 39
      tools/run-migration.sh

14
.zuul.yaml

@ -31,10 +31,12 @@
- job:
name: zuul-migrate
parent: unittests
run: playbooks/zuul-migrate
run: playbooks/zuul-migrate/run
post-run: playbooks/zuul-migrate/post
# We're adding zuul to the required-projects so that we can also trigger
# this from project-config changes
required-projects:
- openstack-infra/openstack-zuul-jobs
- openstack-infra/project-config
- name: openstack-infra/zuul
override-branch: feature/zuulv3
@ -47,22 +49,22 @@
success-url: 'html/feature/zuulv3/'
irrelevant-files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate.yaml
- playbooks/zuul-migrate/.*
- tox-cover:
irrelevant-files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate.yaml
- playbooks/zuul-migrate/.*
voting: false
- tox-pep8
- tox-py35:
irrelevant-files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate.yaml
- playbooks/zuul-migrate/.*
- zuul-stream-functional
- zuul-migrate:
files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate.yaml
- playbooks/zuul-migrate/.*
gate:
jobs:
- build-openstack-infra-sphinx-docs:
@ -71,7 +73,7 @@
- tox-py35:
irrelevant-files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate.yaml
- playbooks/zuul-migrate/.*
- zuul-stream-functional
post:
jobs:

26
playbooks/zuul-migrate.yaml

@ -1,26 +0,0 @@
- hosts: all
tasks:
- name: Install migration dependencies
command: "python3 -m pip install --user src/git.openstack.org/openstack-infra/zuul[migrate]"
- name: Migrate the data
command: "python3 ../zuul/zuul/cmd/migrate.py zuul/layout.yaml jenkins/jobs nodepool/nodepool.yaml . --mapping=zuul/mapping.yaml -v"
args:
chdir: src/git.openstack.org/openstack-infra/project-config
- name: Collect generated job config
synchronize:
dest: "{{ zuul.executor.log_root }}"
mode: pull
src: "src/git.openstack.org/openstack-infra/project-config/zuul.d"
verify_host: true
no_log: true
- name: Collect generated playbooks
synchronize:
dest: "{{ zuul.executor.log_root }}/playbooks"
mode: pull
src: "src/git.openstack.org/openstack-infra/project-config/playbooks/legacy"
verify_host: true
no_log: true

26
playbooks/zuul-migrate/post.yaml

@ -0,0 +1,26 @@
- hosts: all
tasks:
- name: Collect openstack-zuul-jobs generated job config
synchronize:
dest: "{{ zuul.executor.log_root }}/openstack-zuul-jobs"
mode: pull
src: "src/git.openstack.org/openstack-infra/openstack-zuul-jobs/zuul.d"
verify_host: true
no_log: true
- name: Collect project generated job config
synchronize:
dest: "{{ zuul.executor.log_root }}/openstack-zuul-jobs"
mode: pull
src: "src/git.openstack.org/openstack-infra/project-config/zuul.d"
verify_host: true
no_log: true
- name: Collect generated playbooks
synchronize:
dest: "{{ zuul.executor.log_root }}/playbooks"
mode: pull
src: "src/git.openstack.org/openstack-infra/openstack-zuul-jobs/playbooks/legacy"
verify_host: true
no_log: true

10
playbooks/zuul-migrate/run.yaml

@ -0,0 +1,10 @@
- hosts: all
tasks:
- name: Install migration dependencies
command: "python3 -m pip install --user src/git.openstack.org/openstack-infra/zuul[migrate]"
- name: Migrate the data
command: tools/run-migration.sh -v --final
args:
chdir: src/git.openstack.org/openstack-infra/zuul

39
tools/run-migration.sh

@ -17,7 +17,44 @@
# Stupid script I'm using to test migration script locally
# Assumes project-config is adjacent to zuul and has the mapping file
OPTS=$(getopt -o v --long final -n $0 -- "$@")
if [ $? != 0 ] ; then
echo "Failed parsing options." >&2
exit 1
fi
eval set -- "$OPTS"
set -ex
FINAL=0
VERBOSE=""
while true; do
case "$1" in
--final)
FINAL=1
shift
;;
-v)
VERBOSE=-v
shift
;;
--)
shift
break
;;
esac
done
BASE_DIR=$(cd $(dirname $0)/../..; pwd)
cd $BASE_DIR/project-config
if [[ $FINAL ]] ; then
git reset --hard
fi
python3 $BASE_DIR/zuul/zuul/cmd/migrate.py --mapping=zuul/mapping.yaml \
zuul/layout.yaml jenkins/jobs nodepool/nodepool.yaml .
zuul/layout.yaml jenkins/jobs nodepool/nodepool.yaml . $VERBOSE
if [[ $FINAL ]] ; then
find ../openstack-zuul-jobs/playbooks/legacy -maxdepth 1 -mindepth 1 \
-type d | xargs rm -rf
mv zuul.d/zuul-legacy-* ../openstack-zuul-jobs/zuul.d/
mv playbooks/legacy/* ../openstack-zuul-jobs/playbooks/legacy/
fi

Loading…
Cancel
Save