diff --git a/roles/prepare-workspace-git/library/repo_prep.py b/roles/prepare-workspace-git/library/repo_prep.py index 89819a9c1..113e9e8d2 100644 --- a/roles/prepare-workspace-git/library/repo_prep.py +++ b/roles/prepare-workspace-git/library/repo_prep.py @@ -33,19 +33,20 @@ except ImportError: def prep_one_project(args, project, output): start = time.monotonic() - dest = f"{args['zuul_workspace_root']}/{project['src_dir']}" + dest = "%s/%s" % (args['zuul_workspace_root'], project['src_dir']) output['dest'] = dest if not os.path.isdir(dest): - cache = f"{args['cached_repos_root']}/{project['canonical_name']}" + cache = "%s/%s" % (args['cached_repos_root'], + project['canonical_name']) if os.path.isdir(cache): # We do a bare clone here first so that we skip creating a working # copy that will be overwritten later anyway. output['initial_state'] = 'cloned-from-cache' - out = run(f"git clone --bare {cache} {dest}/.git") + out = run("git clone --bare %s %s/.git" % (cache, dest)) output['clone'] = out.stdout.decode('utf8').strip() else: output['initial_state'] = 'git-init' - out = run(f"git init {dest}") + out = run("git init %s" % (dest,)) output['init'] = out.stdout.decode('utf8').strip() else: output['initial_state'] = 'pre-existing' diff --git a/roles/prepare-workspace-git/library/repo_sync.py b/roles/prepare-workspace-git/library/repo_sync.py index 599cc6095..c9596fa1b 100644 --- a/roles/prepare-workspace-git/library/repo_sync.py +++ b/roles/prepare-workspace-git/library/repo_sync.py @@ -33,27 +33,28 @@ except ImportError: def get_ssh_dest(args, dest): return ( - f"git+ssh://{args['ansible_user']}" - f"@{args['ansible_host']}" - f":{args['ansible_port']}" - f"/{dest}" + "git+ssh://%s@%s:%s/%s" % ( + args['ansible_user'], + args['ansible_host'], + args['ansible_port'], + dest) ) def get_k8s_dest(args, dest): resources = args['zuul_resources'][args['inventory_hostname']] return ( - f"\"ext::kubectl " - f"--context {resources['context']} " - f"-n {resources['namespace']} " - f"exec -i {resources['pod']} " - f"-- %S {dest}\"" + "\"ext::kubectl --context %s -n %s exec -i %s -- %%S %s\"" % ( + resources['context'], + resources['namespace'], + resources['pod'], + dest) ) def sync_one_project(args, project, output): - cwd = f"{args['executor_work_root']}/{project['src_dir']}" - dest = f"{args['zuul_workspace_root']}/{project['src_dir']}" + cwd = "%s/%s" % (args['executor_work_root'], project['src_dir']) + dest = "%s/%s" % (args['zuul_workspace_root'], project['src_dir']) output['src'] = cwd output['dest'] = dest env = os.environ.copy() @@ -70,7 +71,7 @@ def sync_one_project(args, project, output): git_dest = get_k8s_dest(args, dest) else: git_dest = get_ssh_dest(args, dest) - out = run(f"git push --quiet --mirror {git_dest}", + out = run("git push --quiet --mirror %s" % (git_dest,), cwd=cwd, env=env) output['push'] = out.stdout.decode('utf8').strip() break diff --git a/roles/prepare-workspace-git/library/repo_update.py b/roles/prepare-workspace-git/library/repo_update.py index 1e1cd5547..668481d3b 100644 --- a/roles/prepare-workspace-git/library/repo_update.py +++ b/roles/prepare-workspace-git/library/repo_update.py @@ -31,7 +31,7 @@ except ImportError: def update_one_project(args, project, output): - cwd = f"{args['zuul_workspace_root']}/{project['src_dir']}" + cwd = "%s/%s" % (args['zuul_workspace_root'], project['src_dir']) output['dest'] = cwd start = time.monotonic() @@ -43,7 +43,7 @@ def update_one_project(args, project, output): run("git config --local --unset receive.denyCurrentBranch", cwd=cwd) run("git config --local --unset receive.denyDeleteCurrent", cwd=cwd) # checkout the branch matching the branch set up by the executor - out = run(f"git checkout --quiet {project['checkout']}", cwd=cwd) + out = run("git checkout --quiet %s" % (project['checkout'],), cwd=cwd) output['checkout'] = out.stdout.decode('utf8').strip() # put out a status line with the current HEAD out = run("git log --pretty=oneline -1", cwd=cwd) diff --git a/roles/prepare-workspace-git/library/test_prepare_workspace.py b/roles/prepare-workspace-git/library/test_prepare_workspace.py index f09cc05eb..419b2bcca 100644 --- a/roles/prepare-workspace-git/library/test_prepare_workspace.py +++ b/roles/prepare-workspace-git/library/test_prepare_workspace.py @@ -44,7 +44,7 @@ class TestPrepareWorkspace(testtools.TestCase): run("git commit -a -m init", cwd=project_root) except Exception as e: if hasattr(e, 'output'): - msg = f'{str(e)} : {e.output}' + msg = '%s : %s' % (str(e), e.output) else: msg = str(e) print(msg) @@ -139,7 +139,7 @@ class TestPrepareWorkspace(testtools.TestCase): self.assertEqual(dest, project_output['dest']) head = run("git rev-parse HEAD", cwd=dest, ).stdout.decode('utf8').strip() - self.assertEqual(f'{head} init', project_output['HEAD']) + self.assertEqual('%s init' % (head,), project_output['HEAD']) self.assertTrue(project_output['elapsed'] > 0) def test_prepare_workspace_ssh_new(self): diff --git a/roles/prepare-workspace-git/module_utils/zuul_jobs/workspace_utils.py b/roles/prepare-workspace-git/module_utils/zuul_jobs/workspace_utils.py index 70964bf6e..0663eff23 100644 --- a/roles/prepare-workspace-git/module_utils/zuul_jobs/workspace_utils.py +++ b/roles/prepare-workspace-git/module_utils/zuul_jobs/workspace_utils.py @@ -45,7 +45,7 @@ def for_each_project(func, args, output): except Exception as e: msg = str(e) if hasattr(e, 'output'): - msg = f'{str(e)} : {e.output}' + msg = '%s : %s' % (str(e), e.output) else: msg = str(e) project_out['error'] = msg diff --git a/zuul-tests.d/general-roles-jobs.yaml b/zuul-tests.d/general-roles-jobs.yaml index 44269026f..1dae96cda 100644 --- a/zuul-tests.d/general-roles-jobs.yaml +++ b/zuul-tests.d/general-roles-jobs.yaml @@ -193,6 +193,19 @@ - name: ubuntu-noble label: ubuntu-noble +- job: + name: zuul-jobs-test-base-roles-ubuntu-xenial + description: Tests roles in the 'base' job on ubuntu-xenial + parent: zuul-jobs-test-base-roles + # Note this is manually curated since xenial is not really + # supported on opendev, but we want the job to run until the last + # possible moment. + ansible-version: '8' + nodeset: + nodes: + - name: ubuntu-xenial + label: ubuntu-xenial + - job: name: zuul-jobs-test-base-test-roles description: | @@ -846,6 +859,7 @@ - zuul-jobs-test-base-roles-ubuntu-focal - zuul-jobs-test-base-roles-ubuntu-jammy - zuul-jobs-test-base-roles-ubuntu-noble + - zuul-jobs-test-base-roles-ubuntu-xenial - zuul-jobs-test-base-test-roles-centos-9-stream - zuul-jobs-test-base-test-roles-debian-bookworm - zuul-jobs-test-base-test-roles-debian-bullseye