summaryrefslogtreecommitdiff
path: root/internal/executor
diff options
context:
space:
mode:
Diffstat (limited to 'internal/executor')
-rw-r--r--internal/executor/executor.go15
-rw-r--r--internal/executor/executor_test.go1
2 files changed, 16 insertions, 0 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index 972c254..440294c 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -32,6 +32,7 @@ type Store interface {
UpdateTaskAgent(id string, agent task.AgentConfig) error
UpdateExecutionChangestats(execID string, stats *task.Changestats) error
RecordAgentEvent(e storage.AgentEvent) error
+ GetProject(id string) (*task.Project, error)
}
// LogPather is an optional interface runners can implement to provide the log
@@ -268,6 +269,13 @@ func (p *Pool) executeResume(ctx context.Context, t *task.Task, exec *storage.Ex
p.mu.Unlock()
}()
+ // Populate RepositoryURL from Project registry if missing (ADR-007).
+ if t.RepositoryURL == "" && t.Project != "" {
+ if proj, err := p.store.GetProject(t.Project); err == nil && proj.RemoteURL != "" {
+ t.RepositoryURL = proj.RemoteURL
+ }
+ }
+
err = runner.Run(ctx, t, exec)
exec.EndTime = time.Now().UTC()
@@ -701,6 +709,13 @@ func (p *Pool) execute(ctx context.Context, t *task.Task) {
priorExecs, priorErr := p.store.ListExecutions(t.ID)
t = withFailureHistory(t, priorExecs, priorErr)
+ // Populate RepositoryURL from Project registry if missing (ADR-007).
+ if t.RepositoryURL == "" && t.Project != "" {
+ if proj, err := p.store.GetProject(t.Project); err == nil && proj.RemoteURL != "" {
+ t.RepositoryURL = proj.RemoteURL
+ }
+ }
+
// Run the task.
err = runner.Run(ctx, t, exec)
exec.EndTime = time.Now().UTC()
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go
index 9dfd860..1f4e92f 100644
--- a/internal/executor/executor_test.go
+++ b/internal/executor/executor_test.go
@@ -1057,6 +1057,7 @@ func (m *minimalMockStore) UpdateExecutionChangestats(execID string, stats *task
return nil
}
func (m *minimalMockStore) RecordAgentEvent(_ storage.AgentEvent) error { return nil }
+func (m *minimalMockStore) GetProject(_ string) (*task.Project, error) { return nil, nil }
func (m *minimalMockStore) lastStateUpdate() (string, task.State, bool) {
m.mu.Lock()