diff --git a/launchable/commands/record/build.py b/launchable/commands/record/build.py index ddaec2547..321aceeff 100644 --- a/launchable/commands/record/build.py +++ b/launchable/commands/record/build.py @@ -221,7 +221,7 @@ def list_sources() -> List[Workspace]: def collect_commits(): if not no_commit_collection: for w in ws: - ctx.invoke(commit, source=w.dir, max_days=max_days, scrub_pii=scrub_pii) + ctx.invoke(commit, name=w.name, source=w.dir, max_days=max_days) else: click.echo(click.style( "Warning: Commit collection is turned off. The commit data must be collected separately.", diff --git a/launchable/commands/record/commit.py b/launchable/commands/record/commit.py index 16128f101..a3a43e33b 100644 --- a/launchable/commands/record/commit.py +++ b/launchable/commands/record/commit.py @@ -23,6 +23,10 @@ @click.command() +@click.option( + '--name', + help="repository name", +) @click.option( '--source', help="repository path", @@ -51,7 +55,7 @@ resolve_path=True, allow_dash=True), ) @click.pass_context -def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, import_git_log_output: str): +def commit(ctx, name: str, source: str, executable: bool, max_days: int, scrub_pii: bool, import_git_log_output: str): if executable == 'docker': sys.exit("--executable docker is no longer supported") @@ -80,8 +84,10 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i client.print_exception_and_recover(e) cwd = os.path.abspath(source) + if not name: + name = os.path.basename(cwd) try: - exec_jar(cwd, max_days, ctx.obj, is_collect_message, is_collect_files) + exec_jar(name, cwd, max_days, ctx.obj, is_collect_message, is_collect_files) except Exception as e: if os.getenv(REPORT_ERROR_KEY): raise e @@ -91,7 +97,7 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i "If not, please set a directory use by --source option.\nerror: {}".format(cwd, e)) -def exec_jar(source: str, max_days: int, app: Application, is_collect_message: bool, is_collect_files: bool): +def exec_jar(name: str, source: str, max_days: int, app: Application, is_collect_message: bool, is_collect_files: bool): java = get_java_command() if not java: @@ -106,7 +112,6 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b command.extend([ "-jar", cygpath(jar_file_path), - "ingest:commit", "-endpoint", "{}/intake/".format(base_url), "-max-days", @@ -126,6 +131,7 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b command.append("-files") if os.getenv(COMMIT_TIMEOUT): command.append("-enable-timeout") + command.append(name) command.append(cygpath(source)) subprocess.run(