Move jenkins cache to /opt/cache
For whatever reason, the source-repositories caching element is running in the very early extra-data phase of disk-image-builder. cache-devstack is instructing source-repositories to put the cached urls into /home/jenkins/cache/files (55-cache-devstack-repos makes up the list of images to download from devstack; the other two are just pre-configured URLS). This causes a problem when trying to add the jenkins user later in jenkins-slave/install.d/20-jenkins-slave. Since source repositories has already created /home/jenkins, useradd won't do it again and does not copy in any of the skeleton files. This moves the extra-data phase caching into /opt/cache, which is probably a more logical place for it anyway. To maintain the status quo, after we create the jenkins user, symlink ~jenkins/cache/files to this new location. This was probably going wrong with puppet too. I'm guessing it just ignored the existing homedir when creating the user. I have tested this by building trusty and stopping the build before and after the useradd calls in 20-jenkins-slave. "/home" was empty, the useradd creates the user, group & directory, the symlink is made correctly and /opt/cache/files appears populated as usual. Change-Id: Ibca6867f29b257a5110cb5522a5cca3a97fa9377
This commit is contained in:
parent
0f4e0ef410
commit
2e308fc94a
|
@ -160,7 +160,7 @@ def main():
|
|||
image_filenames.append(fname)
|
||||
args = dict(
|
||||
name=fname,
|
||||
location=os.path.join('/home/jenkins/cache/files', fname),
|
||||
location=os.path.join('/opt/cache/files', fname),
|
||||
url=url)
|
||||
|
||||
images_list.write(line_template % args)
|
||||
|
|
|
@ -1 +1 @@
|
|||
get-pip-py file /home/jenkins/cache/files/get-pip.py https://bootstrap.pypa.io/get-pip.py
|
||||
get-pip-py file /opt/cache/files/get-pip.py https://bootstrap.pypa.io/get-pip.py
|
||||
|
|
|
@ -1 +1 @@
|
|||
stackviz file /home/jenkins/cache/files/stackviz-latest.tar.gz http://tarballs.openstack.org/package-stackviz-element/stackviz-latest.tar.gz
|
||||
stackviz file /opt/cache/files/stackviz-latest.tar.gz http://tarballs.openstack.org/package-stackviz-element/stackviz-latest.tar.gz
|
||||
|
|
|
@ -6,9 +6,18 @@ fi
|
|||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Add jenkins user and group. Note we don't want to rely on
|
||||
# "useradd"'s group adding behaviour, because it might differ across
|
||||
# distros.
|
||||
groupadd jenkins
|
||||
useradd -g jenkins -m jenkins -s /bin/bash
|
||||
|
||||
# a lot of caching happens in extra-data.d (for "historical" reasons).
|
||||
# We've put the cache stuff into /opt/cache/files, but again, for
|
||||
# "historical" reasons, ensure this is available in /home/jenkins
|
||||
mkdir -p /home/jenkins/cache
|
||||
ln -sf /opt/cache/files /home/jenkins/cache/files
|
||||
|
||||
# this was copied from outside the chroot by extras.d
|
||||
_pub_key=/tmp/in_target.d/jenkins-user-ssh-public-key
|
||||
if [ ! -f $_pub_key ]; then
|
||||
|
|
Loading…
Reference in New Issue