Merge "Add zuul.project.src_dir variable" into feature/zuulv3

This commit is contained in:
Jenkins 2017-08-11 20:50:46 +00:00 committed by Gerrit Code Review
commit b8955ecd9e
3 changed files with 21 additions and 2 deletions

View File

@ -205,6 +205,13 @@ of item.
The full canonical name of the project including hostname.
E.g., `git.example.com/org/project`.
.. var:: src_dir
The path to the source code on the remote host, relative
to the home dir of the remote user.
E.g., `src/git.example.com/org/project`.
.. var:: tenant
The name of the current Zuul tenant.
@ -246,6 +253,12 @@ of item.
The full canonical name of the project including hostname.
E.g., `git.example.com/org/project`.
.. var:: src_dir
The path to the source code on the remote host, relative
to the home dir of the remote user.
E.g., `src/git.example.com/org/project`.
.. var:: branch
The target branch of the change (without the `refs/heads/` prefix).

View File

@ -21,6 +21,7 @@
- zuul.project.name == 'org/project'
- zuul.project.canonical_hostname == 'review.example.com'
- zuul.project.canonical_name == 'review.example.com/org/project'
- zuul.project.src_dir == 'src/review.example.com/org/project'
- debug:
msg: "vartest secret {{ vartest_secret }}"

View File

@ -16,6 +16,7 @@ import copy
import gear
import json
import logging
import os
import time
import threading
from uuid import uuid4
@ -154,7 +155,9 @@ class ExecutorClient(object):
name=item.change.project.name,
short_name=item.change.project.name.split('/')[-1],
canonical_hostname=item.change.project.canonical_hostname,
canonical_name=item.change.project.canonical_name)
canonical_name=item.change.project.canonical_name,
src_dir=os.path.join('src', item.change.project.canonical_name),
)
zuul_params = dict(build=uuid,
buildset=item.current_build_set.uuid,
@ -186,7 +189,9 @@ class ExecutorClient(object):
name=i.change.project.name,
short_name=i.change.project.name.split('/')[-1],
canonical_hostname=i.change.project.canonical_hostname,
canonical_name=i.change.project.canonical_name)
canonical_name=i.change.project.canonical_name,
src_dir=os.path.join('src', i.change.project.canonical_name),
)
if hasattr(i.change, 'number'):
d['change'] = str(i.change.number)
if hasattr(i.change, 'patchset'):