feat: onboard canonical E2E sources #55
|
|
@ -20,8 +20,6 @@ type onboardingRepoManager interface {
|
||||||
EnsureProtectedBranch(string, string) error
|
EnsureProtectedBranch(string, string) error
|
||||||
PublishDeliveryBranch(string, string, string, string, func(string) error) (bool, error)
|
PublishDeliveryBranch(string, string, string, string, func(string) error) (bool, error)
|
||||||
EnsurePullRequest(string, string, string, string) error
|
EnsurePullRequest(string, string, string, string) error
|
||||||
HasOpenPullRequest(string, string) (bool, error)
|
|
||||||
MergePullRequest(string, string) error
|
|
||||||
PublishRepositoryPullRequest(string, string, string, string, func(string) error) (bool, error)
|
PublishRepositoryPullRequest(string, string, string, string, func(string) error) (bool, error)
|
||||||
EnsureWebhook(string, string, string) error
|
EnsureWebhook(string, string, string) error
|
||||||
TriggerWebhookTest(string, string, string) error
|
TriggerWebhookTest(string, string, string) error
|
||||||
|
|
@ -80,13 +78,6 @@ func OnboardApp(cfg config.Config, sourceDir string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if open, err := sourceManager.HasOpenPullRequest(repository, deliveryBranch); err != nil {
|
|
||||||
return err
|
|
||||||
} else if open {
|
|
||||||
if err := sourceManager.MergePullRequest(repository, deliveryBranch); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
registrationBranch := "maidn/register-" + resolved.Delivery.AppName
|
registrationBranch := "maidn/register-" + resolved.Delivery.AppName
|
||||||
clusterManager := newOnboardingRepoManager(resolved.Git.BaseURL, resolved.Git.Token, resolved.Git.Owner, resolved.Git.Username, "", "", resolved.Flux.Branch, "")
|
clusterManager := newOnboardingRepoManager(resolved.Git.BaseURL, resolved.Git.Token, resolved.Git.Owner, resolved.Git.Username, "", "", resolved.Flux.Branch, "")
|
||||||
|
|
|
||||||
|
|
@ -311,12 +311,14 @@ func TestOnboardAppUsesCanonicalSourceAndExecutionClusterManagers(t *testing.T)
|
||||||
"remote https://git.example.test/Maidn/maidn-e2e-web.git:production",
|
"remote https://git.example.test/Maidn/maidn-e2e-web.git:production",
|
||||||
"protect Maidn/maidn-e2e-web:production",
|
"protect Maidn/maidn-e2e-web:production",
|
||||||
"delivery https://git.example.test/Maidn/maidn-e2e-web.git:maidn/delivery-web-ui",
|
"delivery https://git.example.test/Maidn/maidn-e2e-web.git:maidn/delivery-web-ui",
|
||||||
"open-pr Maidn/maidn-e2e-web:maidn/delivery-web-ui",
|
|
||||||
} {
|
} {
|
||||||
if !strings.Contains(sourceCalls, want) {
|
if !strings.Contains(sourceCalls, want) {
|
||||||
t.Fatalf("source manager calls = %q, missing %q", sourceCalls, want)
|
t.Fatalf("source manager calls = %q, missing %q", sourceCalls, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if strings.Contains(sourceCalls, "merge-pr") {
|
||||||
|
t.Fatalf("source delivery PR was merged without review: %q", sourceCalls)
|
||||||
|
}
|
||||||
if got := strings.Join(clusterManager.calls, "\n"); got != "register test-org-2/cluster:maidn/register-web-ui" {
|
if got := strings.Join(clusterManager.calls, "\n"); got != "register test-org-2/cluster:maidn/register-web-ui" {
|
||||||
t.Fatalf("cluster manager calls = %q", got)
|
t.Fatalf("cluster manager calls = %q", got)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue