From 19d9360b557d7b2f2795e21fc9b3b5f5b48542ed Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 4 Apr 2023 08:33:31 +1000 Subject: [PATCH] install-launch-node: upgrade launch env periodically This writes the date of the pyproject.toml into a stamp file in the venv. If it updates, we run pip with "latest" which should update the environment. The normal "latest" run should ensure any changes to launch-node get populated as usual. This should ensure we keep things like openstackclient updated, but just once per day. Change-Id: I50674a25da9e1761af8daa78970c473e651791b0 --- playbooks/roles/install-launch-node/tasks/main.yaml | 10 ++++++++++ .../templates/launch-env-req.txt.j2 | 1 + 2 files changed, 11 insertions(+) create mode 100644 playbooks/roles/install-launch-node/templates/launch-env-req.txt.j2 diff --git a/playbooks/roles/install-launch-node/tasks/main.yaml b/playbooks/roles/install-launch-node/tasks/main.yaml index 9b71f070df..2bc08db962 100644 --- a/playbooks/roles/install-launch-node/tasks/main.yaml +++ b/playbooks/roles/install-launch-node/tasks/main.yaml @@ -12,10 +12,20 @@ group: root mode: '0600' +# This is used to timestamp the launch-env-req.txt file. This means +# we will run --upgrade on the venv once a day, but otherwise leave it +# alone. +- name: Install node launcher stamp + template: + src: launch-env-req.txt.j2 + dest: /usr/launcher-venv/launch-env-req.txt + register: _upgrade + - name: Install node launcher pip: name: 'file:///home/zuul/src/opendev.org/opendev/system-config/launch' virtualenv: '/usr/launcher-venv' + state: '{{ "latest" if _upgrade.changed else "present" }}' # Admins use openstackclient on the bastion host to deal with cloud # issues. The best version to use is the one from launch node, as diff --git a/playbooks/roles/install-launch-node/templates/launch-env-req.txt.j2 b/playbooks/roles/install-launch-node/templates/launch-env-req.txt.j2 new file mode 100644 index 0000000000..f88788721c --- /dev/null +++ b/playbooks/roles/install-launch-node/templates/launch-env-req.txt.j2 @@ -0,0 +1 @@ +# Update timestamp: {{ now(fmt='%Y-%m-%d') }}