Commit Graph

16 Commits

Author SHA1 Message Date
Sorin Sbarnea 6b8cc6d468 More E208 (final)
Change-Id: I705d1b10696326f3d4d5bef4b5a88a83f2c3d960
2020-11-10 19:34:45 +00:00
Ian Wienand c877323de3 fetch-zuul-cloner: use ensure-pip
Firstly, the "destination" variable was replaced with a virtualenv in
6bb1f6046b692ee2038eafd0965bd3095d6fa787; update the documentation and
prefix the name as is now standard for variables in this repo.  This
is not set anywhere so I think the prefixing is OK.

Call ensure-pip before installing, and use the virtualenv_command it
exports to create the environment for the zuul-cloner binary.

Story: #2007386
Task: #39311
Change-Id: I057191bf20ab1650a8926971dd386ce9cb1f03f5
2020-04-15 15:34:21 -07:00
Paul Belanger 6bb1f6046b
Setup virtualenv for zuul-cloner
The zuul-cloner shim require PyYAML as a dependency, create a
virtualenv and install it.

This replaces the destination with virtualenv variable.

Change-Id: I3e55a3a1582aa7dea21c7de67260c2c906c2192b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-11-22 02:19:56 -05:00
Monty Taylor 1253d3da37
Make git repos writable so that hard links work
When people try to zuul-cloner from not zuul user, it fails with making
hard links. We can prevent the hard linking - or we can just make them
writable.

Change-Id: If0601116c8f3b3db2a43d77f7c609ab7f2330e80
2017-10-16 08:12:30 -05:00
Ian Wienand e46b67a1d9 zuul-cloner-shim: Use st_dev to check for filesystem
Rather than check mounts, check if the source and destination reside
on the same st_dev; if so use hardlinks, otherwise copy.

Change-Id: Ic5fdc899d70c67ddcfc19994c254a8efcd0fd3d6
2017-10-11 10:59:40 +11:00
Zuul 98d3f2ac4d Merge "Handle z-c shim copies across filesystems" 2017-10-03 08:27:13 +00:00
Clark Boylan 6f4cb962a7 Handle z-c shim copies across filesystems
The zuulv3 zuul-cloner shim was using cp -l which uses hardlinks to
"copy" files. You cannot hard link across filesystem boundaries and
there is at least one case where jobs copy using z-c shim across
filesystem boundaries (tripleo-ci jobs).

Handle this by listing all of the filesystem mounts, finding the longest
filepath prefix that our source and destination dirs match and comparing
if they are on the same filesystem to determine if we can hardlink or
not.

Change-Id: I7cf211fc43df1b86c54fcc1b62e4321a658d9c84
2017-10-02 08:47:27 -07:00
Jeremy Stanley daf3a03da9 Correct cloner shim missing project error
When asked to clone a project which is not present in REPO_SRC_DIR,
the error message should suggest adding the missing project's name
to the required-projects list for the job rather than its file path.

Also, while we're at it, implement Clint's suggestion from
Ia94d03a9fe59677129e23e849e0437200a66f4c3 to embed REPO_SRC_DIR's
value into the error rather than hard-coding an OpenStack-specific
implementation value.

Change-Id: I068ab7df86338794b71b23eab748e01ccd0d90f3
2017-10-01 14:22:08 +00:00
Monty Taylor f2ed79c7a0
Add helpful error message about required-projects
This is a very common issue people are encountering - add some help
text.

Change-Id: Ia94d03a9fe59677129e23e849e0437200a66f4c3
2017-09-29 13:10:46 -05:00
Ian Wienand 38a46bcf21 Revert "zuul-cloner: enter directory before copying"
This reverts commit 26b66a6a9e.

It doesn't seem we can stop "--preserve=all" from modifying the
directory permissions.  Remove the -a and just do a regular copy.

Change-Id: I4937924e0dd1a0537343472f80b991a4e4410d3f
2017-09-27 13:14:26 +10:00
Ian Wienand 26b66a6a9e zuul-cloner: enter directory before copying
The "-a" argument to cp implies "--preserve=all" which changes the
permissions of the target directory; e.g.

 mkdir /tmp/foo
 chmod 700 /tmp/foo
 cp -al /some/dir/. /tmp/foo
 ls -l /tmp/foo

and you will find that /tmp/foo is probably not 700 any more.  This
causes problems when /tmp/foo is a home directory, because it can make
them world-writable and hence ssh won't log into them any more.

For simplicity, switch into the directory we want to copy into, and
then copy everything in.  This should stop cp touching the parent
directory in any way.

Change-Id: Icd842b6fba220d41601adeaa0c5a41b2dab582bc
2017-09-27 11:42:26 +10:00
Zuul 3274bfdfbb Merge "Always create dest dir in zuul-cloner shim" 2017-09-27 00:30:26 +00:00
James E. Blair 658865e1ed Always create dest dir in zuul-cloner shim
The "cp" command copies the source files into the destination
directory.  The zuul-cloner shim relied on this behavior and so
specified one level above the intended destination as the destination
directory, so that cp would end up creating the final directory based
on the final component of the source directory.

This did not behave as expected if the destination directory was not
intended to be the name of the project.  For example, some uses clone
directly into the workspace directory.  Others may be intentionally
altering the name of the destination directory (eg, to strip "puppet-"
from the project name).

To correct this, always ensure the full destination directory exists,
and always copy the entire source directory contents *into* the
destination directory.

Change-Id: If80df82b73c59a3c81e0c8ed5ff0d135dd5c26c9
2017-09-26 16:00:28 -07:00
Monty Taylor 6120d543c1
Set shebang line of zuul-cloner script
To run a script in a virtualenv, you need to us the python in the
virtualenv. This script needs things (yaml) that arent' on the base
system but instead are only in the virtualenv.

Change-Id: Ic915c4db30814b7deefd8adc234df594d1eb20fa
2017-09-22 10:25:36 -05:00
David Shrewsbury 520f8a6059 Fixes for fetch-zuul-cloner
Remove the delegate-to, use elevated privs, and add new task
to make sure the destination directory exists.

Change-Id: I258d39afd77dd090198456950d873c99f98dbda7
2017-09-07 12:52:54 -04:00
David Shrewsbury 167a423370 Create fetch-zuul-cloner role.
Moves the zuul-cloner shim from the zuul repo to this repo as a
role, and templates the script to allow specifying the Zuul repo
source directory.

Change-Id: Id1609ce069cce6018b53025b1bd148ad0c36ae13
2017-09-07 10:09:15 -04:00