Commit Graph

58 Commits

Author SHA1 Message Date
James E. Blair f1e7ffab93 Remove zuul-migrate
This was intended as a one-time helper program to help people upgrade
from Zuul v2 to v3.  It did not cover all use cases, and has not been
kept up to date or improved.  It's time to remove it before the v4
release.

Change-Id: I12cdcedb5baabd8fa0937a6ea21590259093ead1
2021-02-17 09:22:46 -08:00
Fabien Boucher 31b83dd2e8 Remove ununecessary shebangs
The commands are managed as entry-points so remove
ununecessary shebangs. Also lib/re2util.py does not
require a shebang as well.

zuul_return.py does not have a main and is not supposed
to be run directly.

Ununecessary shebangs for non executable script causes
rpmlint issues.

Change-Id: I6015daaa0fe35b6935fcbffca1907c01c9a26134
2020-05-18 19:10:33 +02:00
confi-surya e2bcc15c8d dict_object.keys() is not required for *in* operator
cleanup of .keys() from dict_object.keys() *in* operator

Change-Id: Ic79633899db628a7572840392933293426d0c187
2018-12-03 12:04:55 +05:30
Andreas Jaeger d9059524e0 Fix flake 3.6.0 warnings
flake 3.6.0 introduces a couple of new tests, handle them in the zuul
base:

* Disable "W504 line break after binary operator", this is a new warning
  with different coding style.
* Fix "F841 local variable 'e' is assigned to but never used"
* Fix "W605 invalid escape sequence" - use raw strings for regexes.
* Fix "F901 'raise NotImplemented' should be 'raise
  NotImplementedError'"
* Ignore "E252 missing whitespace around parameter equals" since it
  reports on parameters like:
  def makeNewJobs(self, old_job, parent: Job=None):

Change "flake8: noqa" to "noqa" since "flake8: noqa" is a file level
noqa and gets ignored with flake 3.6.0 if it's not at beginning of line
- this results in many warnings for files ./zuul/driver/bubblewrap/__init__.py and
./zuul/cmd/migrate.py. Fix any issues there.

Change-Id: Ia79bbc8ac0cd8e4819f61bda0091f4398464c5dc
2018-10-28 16:39:30 +01:00
Andreas Jaeger f856841c49 Remove vars assigned to but never used
zuul/cmd/migrate.py contained two variables that are assigned but never
used, flake 3.6.0 found these. They were hidden by the earlier "flake8:
noqa" in the file that earlier flake8 versions treated as file level
ignore wherever it appeared.

Remove the two variables found.

Change-Id: I7dca305da5bf605386590d96bec0150e06b8ff6d
2018-10-28 16:03:40 +01:00
Paul Belanger 175bb50380
zuul-migrate: run / post-run playbooks need .yaml extensions
Zuul now requires playbooks to have .yaml extensions in the job
stanza.

Change-Id: I71af1cc421b2a0c3560f133244663b7fe3c7c481
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-06-04 12:14:32 -04:00
Paul Belanger 81ce288f22
Add the ability for a user to skip macros
In the case of RDO, there is logic in JJB we don't actually want to
convert with zuul-migrate. We could modify JJB and remove this logic,
however it is also just as easy to add the ability to a user to choose
which macros to skip for migration.

Change-Id: I0b169fa66be2d7030c271caaf223a2cbc1ca5db2
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-05-30 15:26:46 -04:00
Paul Belanger 9b06ea20b8
Allow for projects only names in zuul-migrate
It is possible for a project not to have a '/' in its name, add
support for it.

Change-Id: Ic773da4ec552a55c8b647fb38e54e300368d8be1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-05-30 12:54:38 -04:00
Paul Belanger bfa8bd0b5b
Allow templates to be optional for zuul-migrate
It is possible for layout.yaml not to use project-templates sections,
in this case allow zuul-migrate to skip converting them.

Change-Id: I00e7fe252d951281d96fd10022289a912948a520
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-05-30 12:53:30 -04:00
Zuul 127a567517 Merge "Parent legacy jobs with artifacts legacy-publish-openstack-artifacts" into feature/zuulv3 2017-09-28 20:35:02 +00:00
Monty Taylor 85731f1291
Set BUILD_TIMEOUT environment variable in zuul_legacy_vars
Jobs that need this expect it as an environment variable.

Update the migration script in case it gets used again.

Change-Id: Ic4d372a795e17a33116d19e9e4603fb5a08fe152
2017-09-28 13:26:55 -05:00
Monty Taylor bcf725a275
Parent legacy jobs with artifacts legacy-publish-openstack-artifacts
Change-Id: Ia6163cda485b56c6dca15ea031b9f3532ec7f26f
2017-09-27 15:06:53 -05:00
Monty Taylor 9dcb71cb87
Add an additional pass through project templates
In order to find project templates that need to be expanded from job
matchers that are not project specific, we need to make a pass through
all of the projects assuming all templates need to be expanded. We then
look at the result of the expansion to see if anything was actually
done. As part of this, we also collect same-expansions on a job basis to
track if a given job always has the same matcher expansion. If it does,
we can apply that to the job definition and not to the project-pipeline
defintion, which could lower the number of templates that need to be
expanded.

This may be the ugliest code I've ever written. I'm sorry.

Also fix a bash bug in the run-migration script that caused final to
always get run regardless of flag setting. Whoops.

Change-Id: I523909e5242e0db125b7560cbdcd9ac41ca6c72f
2017-09-27 14:56:31 -05:00
Monty Taylor 5d7d2c6439
Put legacy jobs down a directory level into workspace
Change-Id: I39f13d615cdf117aae00e0fe30c281c5fb01c1fd
2017-09-27 08:11:21 -05:00
Monty Taylor 0784850c62
Don't emit yaml suffixes in run and post-run lines
Change-Id: I16374d866faae3899c2cf8c09791774c968f3c66
2017-09-26 11:37:37 -05:00
Monty Taylor 221a252f73
Consume project templates correctly in projects
It's a list of strings, not a list of dicts, and the key is 'templates'
not 'template'.

Change-Id: Ia1ea9ac3d6526346d2c1d956fdebe3c7cf77d6d0
2017-09-26 11:07:34 -05:00
Monty Taylor ac574ef386
Sort fields in post playbook
Change-Id: Iad821708c70bb10800c639e1d4d85fe241a1c687
2017-09-26 10:05:35 -05:00
Monty Taylor 5b59c7aa4b
Set a max on timeout
Change-Id: Id981eebe0d5b3c64396c55d8868421cafc232c06
2017-09-26 10:05:35 -05:00
Monty Taylor 8b506beb4c
Sort list of required projects
Change-Id: Ibb5b8003e2906fec35686978b1ee2d6ae8cba86b
2017-09-26 10:05:35 -05:00
Monty Taylor f567193d98
Rename outfiles to zuul- to match rollout
Turns out 99 isn't a good prefix.

Also, remove the move argument now that we're merging with the existing
projects.yaml.

Also, stop running zuul unittests on migration script changes. They are
not relevant.

Change-Id: I10ed8cae64c82ed5afd01bb03a74ffc4fd2d87ee
2017-09-26 10:04:40 -05:00
Monty Taylor cbc4e298c8
It's branches, not branch
Change-Id: I6e8a70d122b63a03abef371cb7e8fd9ba6edf99b
2017-09-25 16:39:42 -05:00
Monty Taylor a8179ad17f
Merge project pipeline definitions
It's important to have legacy files for legacy jobs, project-templates
and a legacy dir for legacy playbooks. HOWEVER - the project pipeline
configs are the project pipeline configs. Rather than emitting
99legacy-projects -if there is already a zuul.d/projects.yaml, assume
that it contains a list of projects, read it in, and then merge the
generated project-pipeline definitions with the existing ones. This will
give us a unified project-pipeline definition list. (It loses the
comments in the original file, but there were only a couple that can be
added back by hand.

Change-Id: Ia2f440df47aac0a5b1e6baae3c081bf69d7add03
2017-09-25 09:43:16 -05:00
Monty Taylor b09aaf2fd7
Sort output in generated legacy files
We prefer output in files like this to be sorted - so sort these.

Also, rename the files from 99converted- to 99legacy- and split jobs
into jobs and project-templates to match the other split.

Change-Id: I126fe240b64987684e433cbf8f9f72a729e416f1
2017-09-25 09:03:30 -05:00
Monty Taylor baba1d70bc
Don't double quote rsync options
We needed to in Ansible 2.1 - but in 2.3 it breaks things.

Change-Id: Iecac280fdcbbf89ad28bd2e09936eed222bdc373
2017-09-22 18:00:50 -05:00
Monty Taylor 7c9824c837
Actually, you know, return the timeout
self.getTimeout isn't any good without a return statement.

Change-Id: Icd62967043df7ac69ec706440eafba66049b0052
2017-09-22 15:24:38 -05:00
Monty Taylor d2194b283c
Append / to end of ansible_user_dir for rsync src
Change-Id: Id0056c8072714e4c672bb2ba0f1d846f47c9b5e9
2017-09-22 13:13:31 -05:00
Monty Taylor 00a21beb6f
Re-add the mapping for logs/$LOG_PATH
Change-Id: I5cef667f394d3549e791e08541b6eb6e6889b124
2017-09-22 12:49:15 -05:00
Monty Taylor fe27d1b3f6
Use zuul | zuul_legacy_vars for legacy environment
Change-Id: I2ffe5731df66683a75fe3713b0d2416032bf6273
2017-09-22 12:39:19 -05:00
Monty Taylor 81aa20b1a4
Use legacy-base job for base of all converted jobs
Change-Id: I0c2f1a46ca27330d34539f5ae899a4fcc87c10cb
2017-09-22 11:56:01 -05:00
Monty Taylor 2bd6b001e8
Put shell snippets into task.shell.cmd
Putting them directly into shell: breaks here docs. We can also use
the same dict for setting executable.

Change-Id: I050a17085f342e5765215bcde140649a9c740773
2017-09-22 11:55:34 -05:00
Monty Taylor 8f68fcc3ae
Correctly apply irrelevant-files to simple job names
If a job hits the logic as a string, it gets overwritten, but since it's
just a string element of a list it's not a reference member so it does
not update the original list.

Instead, make a new list that we return and then overwrite the old list.
This gets the exclusions added properly.

Also, throw in a set conversion in the middle so that we don't
accumulate multiple copies of the same file exclusions. One copy of each
one is just fine.

Change-Id: Ia8a0d32f3221b252fa093662e6fcd860ba0cabf7
2017-09-21 18:38:05 -05:00
Monty Taylor 8c1f410629
Don't emit net-info macro
We do this in the zuul v3 base job now, so we don't need to
paste it into all of the new jobs.

Change-Id: I053af44e7bd22bb2a35d438819c75850d2b93087
2017-09-21 17:46:20 -05:00
Monty Taylor 15859f336a
Fixed a few earlier review nits
Change-Id: I7669f64ca2e358361490d8fb3615cc21ee4c7b9d
2017-09-21 17:21:08 -05:00
Monty Taylor 7a519a0273
Migrate node information to nodeset instead of nodes
Nodeset is the term now. For all the cases.

Change-Id: Ib58bdfa1744b2851ae6c6b79ece52600d905f53e
2017-09-21 17:19:26 -05:00
Monty Taylor db65501762
Add support for puppet-openstack-integration based jobs
These run zuul-cloner to clone puppet-openstack-integration and then
run a script in puppet-openstack-integration to clone the base repos.
We can't detect that normally - but we can map them to a base job
similar to the dsvm jobs.

Change-Id: I0d994e5c2a02f826e9cafd7df3870e2912e4db12
2017-09-21 16:50:38 -05:00
Monty Taylor 80670886a0
Use legacy-dsvm-base as base job for dsvm jobs
Depends-On: Iccbfa2a06d4a1f2c39567483467dd2998e9e916b
Change-Id: I0b2f3556f0ed98c83d2c7da26ff8a5e8da2bc70c
2017-09-21 16:50:01 -05:00
Monty Taylor 9640081e12
Support zuul-cloner command line arguments
Change-Id: If4dfe88b4dde382f3107879a25e660713b16656b
2017-09-21 16:47:49 -05:00
Monty Taylor c4805936fa
Extract required projects from embedded clonemaps
Some jobs write out a clone map directly. We can pull from them.

Change-Id: I681e864a8550b1166fa078e875e975f4a17ba4fd
2017-09-21 16:46:05 -05:00
Monty Taylor 72252b7e05
Allow dict-based new jobs to have templated names
Change-Id: I99d4b6c36da20c55e4a490e27d8013317c564e12
2017-09-21 16:44:22 -05:00
Monty Taylor 9b8485dc04
Extract required-projects from job content
In v2, PROJECTS was fed to zuul-cloner and it would then try to clone
things. That's not how v3 works. In v3, we need required-projects stated
in the job definition so that Zuul can properly clone things.

Extract PROJECTS and DEVSTACK_PROJECT_FROM_GIT from job definitions to
try to attach appropriate required-projects lists.

dsvm jobs still have a larger list this doesn't account for though.

This also removes support for specifying a required-projects list in the
mapping, since we weren't actually using it and the semantics of which
thing should win were confusing.

Change-Id: I01156b38a1e907677f69042a003eb580ba3d224c
2017-09-21 16:44:16 -05:00
Monty Taylor 73fe104252
Migrate docs-draft jobs to emit to logs/html
Instead of publishing to docs-draft, we're just going to pull the
results into the log dir and set the success-url.

Change-Id: Ibb7cfa82b9e01233fb9062ed5d5dddde0b8f5fcc
2017-09-21 16:19:06 -05:00
Monty Taylor 6ecbb8b180
Deal with link-logs macro
Change-Id: I5f4a3b46cce5148301c50544a616ac7bf5006913
2017-09-21 16:19:06 -05:00
Monty Taylor a86f9cd788
Omit some jobs from shared queue calculation
A setting has been added to migration.yaml to allow listing jobs that
should not result in a shared queue. noop is an example.

Change-Id: I2df7202fea591190e7962e04e71f42cd75ccbe0b
2017-09-21 16:19:06 -05:00
Monty Taylor feec38afe6
Emit shell instead of script tasks
Unmatched single quotes is what killed us before. Add an option which
does a test with ansible-playbook --syntax-check to validate whether a
playbook emitted with shell instead of script works.

Running that way takes around 90 minutes. So default to shell, but
provide --syntax-check as a way to check using shell and fallback to
script. This can then be used to fix pre-migration jobs if desired.

Also separate task entries with an extra '\n' for readability.

And only collect the generated playbooks - not all of them.

Change-Id: I147a7562e6578ab300ef56ae7b1c9d9d3f8f920f
2017-09-21 16:19:06 -05:00
Monty Taylor 661433409f Use publish-docs-draft base job for docs-draft publishers
The docs-draft jobs all need to publish to docs-draft. We have a base
job for that now, use it.

(Re-proposed from I52b9b72e29560e5667895f2d99c642ffa375d4d8)

Change-Id: Id7ea9eb94cc3e84a348fe8c411ff9f8b60bd0b1a
2017-09-21 13:41:45 -07:00
Monty Taylor 9de39ffc41
Cleanup migration script pep8 errors
Still not sure why this isn't getting caught by tox.

Change-Id: Id6037a5d876dc272d98e0b1b66a3cebfc8b86257
2017-09-16 13:36:02 -05:00
Monty Taylor aa7a69bb5b
Don't try to write jobs that came from mappings
When we mark a job in the mapping, it's becaues we have a new job for
it. There is, therefore, no need to emit one.

Change-Id: Ic1eee1e86915b5d984c66f281aec295259849a9d
2017-09-16 12:28:18 -05:00
Monty Taylor 6be5a8b0dc
Order post playbook content properly
These are extra ugly currently.

Change-Id: I2c7ae50fdb5e5614dd8ab2f51e8fd29516d233c9
2017-09-15 15:22:54 -06:00
Monty Taylor 843ae74c1f
Actually emit job content
Change-Id: I828aaf7641c9a9baaf9b6c3ff79182a3ab5eb39f
2017-09-15 15:22:54 -06:00
Monty Taylor 85c987060d
Split output into jobs+project_templates and projects
We need to put jobs and project_templates into openstack-zuul-jobs and
we need to put project pipelines into project-config.

Change-Id: I97c45547f2a550a3d6e188637b1d9958006d1178
2017-09-15 15:22:54 -06:00