Skip to content

Conversation

@sebastienros
Copy link
Member

Ability to upload a ZIP file or have the agent pull one from a URL. This allows setup without the git client.

Copy link
Member

@LoopedBard3 LoopedBard3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once the GitClientIntegrationTests.cs is fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an extra or unsaved file.

public string Repository { get; set; }
public bool InitSubmodules { get; set; }
public string LocalFolder { get; set; }
public string Archive { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spacing

@LoopedBard3 LoopedBard3 requested a review from Copilot August 28, 2025 17:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds archive source option functionality to Crank, allowing users to upload ZIP files or have the agent pull them from URLs as an alternative to git-based source code delivery. This enables benchmark setup without requiring a git client.

Key changes:

  • Added Archive property to source models to support ZIP archive sources
  • Implemented archive handling logic in both controller and agent components
  • Added validation to ensure each source has at least one code location defined

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
hello-archive.benchmarks.yml Test configuration demonstrating archive source usage
CommonTests.cs Integration test for archive functionality
Source.cs Added Archive property to source models
Job.cs Updated job source mapping to include Archive property
README.md Updated documentation with archive source option
Program.cs Added source validation and archive path resolution logic
JobConnection.cs Added local archive upload functionality
Documentation.cs Updated help documentation for archive option
Startup.cs Added archive extraction logic in the agent

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


if (archivePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
var tempArchive = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".zip");
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Path.GetRandomFileName() for temporary files can create predictable filenames. Consider using Path.GetTempFileName() which creates a unique temporary file with proper permissions, or use a cryptographically secure random generator for the filename.

Suggested change
var tempArchive = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".zip");
// Use Path.GetTempFileName() to securely create a unique temp file, then rename to .zip
var tempFile = Path.GetTempFileName();
var tempArchive = Path.ChangeExtension(tempFile, ".zip");
File.Move(tempFile, tempArchive);

Copilot uses AI. Check for mistakes.

ZipFile.ExtractToDirectory(tempArchive, targetDir);

try { File.Delete(tempArchive); } catch { }
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silent exception swallowing in cleanup code can hide important errors. Consider logging the exception or at minimum catching specific exceptions like IOException or UnauthorizedAccessException that are expected during file cleanup.

Suggested change
try { File.Delete(tempArchive); } catch { }
try
{
File.Delete(tempArchive);
}
catch (IOException ex)
{
Log.Warning(ex, $"Failed to delete temporary archive file '{tempArchive}' due to IO error.");
}
catch (UnauthorizedAccessException ex)
{
Log.Warning(ex, $"Failed to delete temporary archive file '{tempArchive}' due to insufficient permissions.");
}

Copilot uses AI. Check for mistakes.
}
finally
{
try { File.Delete(helloZip); } catch { }
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silent exception swallowing in cleanup code can hide important errors. Consider logging the exception or at minimum catching specific exceptions like IOException or UnauthorizedAccessException that are expected during file cleanup.

Suggested change
try { File.Delete(helloZip); } catch { }
try
{
File.Delete(helloZip);
}
catch (Exception ex)
{
_output.WriteLine($"[CLEANUP] Failed to delete {helloZip}: {ex.GetType().Name}: {ex.Message}");
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants