buildserver: move buildserverid to provisioner

In order to support Docker, this should be able to operate without ssh,
e.g. using vagrant-communicator-docker.  This removes the buildserverid
hack and makes it a provisioner shell script.
This commit is contained in:
Hans-Christoph Steiner 2021-12-15 14:43:14 +01:00
parent a375bae3c9
commit 57447f18e1
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
3 changed files with 11 additions and 9 deletions

View File

@ -86,5 +86,7 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", path: "provision-android-ndk",
args: ["/opt/android-sdk/ndk", "r21e", "r22b"]
config.vm.provision "shell", path: "provision-gradle"
config.vm.provision "shell", path: "provision-buildserverid",
args: [`git rev-parse HEAD`]
end

View File

@ -0,0 +1,9 @@
#!/bin/bash -e
test -n "$1"
echo "Writing buildserver ID ...ID is $1"
set -x
echo "$1" > /home/vagrant/buildserverid
# sync data before we halt() the machine, we had an empty buildserverid otherwise
sync

View File

@ -584,15 +584,6 @@ def main():
run_via_vagrant_ssh(v, ['rm', '-f', '~/.gradle/caches/modules-2/modules-2.lock'])
run_via_vagrant_ssh(v, ['rm', '-fr', '~/.gradle/caches/*/plugin-resolution/'])
p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE,
universal_newlines=True)
buildserverid = p.communicate()[0].strip()
logging.info("Writing buildserver ID ...ID is %s", buildserverid)
# sync data before we halt() the machine, we had an empty buildserverid otherwise
write_bsid_cmd = 'sh -c "echo \'{}\' >/home/vagrant/buildserverid; sync"'.format(buildserverid)
run_via_vagrant_ssh(v, write_bsid_cmd)
logging.debug("+ {}".format(write_bsid_cmd))
logging.info("Stopping build server VM")
v.halt()