Skip to content

Commit 94cd3d7

Browse files
authored
Merge pull request #1088 from cloudbees-oss/AIENG-183
[AIENG-183] changes for PTS v2
2 parents 7c309ae + b7d340d commit 94cd3d7

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

launchable/commands/record/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def list_sources() -> List[Workspace]:
221221
def collect_commits():
222222
if not no_commit_collection:
223223
for w in ws:
224-
ctx.invoke(commit, source=w.dir, max_days=max_days, scrub_pii=scrub_pii)
224+
ctx.invoke(commit, name=w.name, source=w.dir, max_days=max_days)
225225
else:
226226
click.echo(click.style(
227227
"Warning: Commit collection is turned off. The commit data must be collected separately.",

launchable/commands/record/commit.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424

2525
@click.command()
26+
@click.option(
27+
'--name',
28+
help="repository name",
29+
)
2630
@click.option(
2731
'--source',
2832
help="repository path",
@@ -51,7 +55,7 @@
5155
resolve_path=True, allow_dash=True),
5256
)
5357
@click.pass_context
54-
def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, import_git_log_output: str):
58+
def commit(ctx, name: str, source: str, executable: bool, max_days: int, scrub_pii: bool, import_git_log_output: str):
5559
if executable == 'docker':
5660
sys.exit("--executable docker is no longer supported")
5761

@@ -80,8 +84,10 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i
8084
client.print_exception_and_recover(e)
8185

8286
cwd = os.path.abspath(source)
87+
if not name:
88+
name = os.path.basename(cwd)
8389
try:
84-
exec_jar(cwd, max_days, ctx.obj, is_collect_message, is_collect_files)
90+
exec_jar(name, cwd, max_days, ctx.obj, is_collect_message, is_collect_files)
8591
except Exception as e:
8692
if os.getenv(REPORT_ERROR_KEY):
8793
raise e
@@ -91,7 +97,7 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i
9197
"If not, please set a directory use by --source option.\nerror: {}".format(cwd, e))
9298

9399

94-
def exec_jar(source: str, max_days: int, app: Application, is_collect_message: bool, is_collect_files: bool):
100+
def exec_jar(name: str, source: str, max_days: int, app: Application, is_collect_message: bool, is_collect_files: bool):
95101
java = get_java_command()
96102

97103
if not java:
@@ -106,7 +112,6 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b
106112
command.extend([
107113
"-jar",
108114
cygpath(jar_file_path),
109-
"ingest:commit",
110115
"-endpoint",
111116
"{}/intake/".format(base_url),
112117
"-max-days",
@@ -125,6 +130,7 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b
125130
command.append("-files")
126131
if os.getenv(COMMIT_TIMEOUT):
127132
command.append("-enable-timeout")
133+
command.append(name)
128134
command.append(cygpath(source))
129135

130136
subprocess.run(

0 commit comments

Comments
 (0)