Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
- 'e2e/**'
- 'hack/microsandbox/**'
- 'hack/provider_update_ci/**'
- 'hack/run-managed-policy-e2e.sh'
- '.github/workflows/pr-ci.yml'
- '.github/workflows/docker-buildkit-windows.yml'
- 'hack/licenses/**'
Expand Down
28 changes: 23 additions & 5 deletions hack/microsandbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import (
)

const (
installLinuxCommand = "install-linux"
runSuiteCommand = "run"
verifyReportCommand = "verify-report"
buildPerformanceToolsCommand = "build-performance-tools"
installLinuxCommand = "install-linux"
runSuiteCommand = "run"
verifyReportCommand = "verify-report"
buildPerformanceToolsCommand = "build-performance-tools"
managedPolicyE2ECommand = "managed-policy-e2e"
managedPolicyNamespaceCommand = "managed-policy-namespace"
)

func main() {
Expand All @@ -25,10 +27,13 @@ func runCLI(args []string, stdout, stderr io.Writer) int {
if len(args) == 0 {
_, _ = fmt.Fprintln(
stderr,
"usage: devsy-ci-microsandbox <install-linux|run|verify-report|build-performance-tools>",
"usage: devsy-ci-microsandbox <install-linux|run|verify-report|build-performance-tools|managed-policy-e2e>",
)
return 2
}
if code, ok := runManagedPolicyCommand(args, stderr); ok {
return code
}
switch args[0] {
case installLinuxCommand:
return installLinuxCLI(args[1:], stdout, stderr)
Expand All @@ -44,6 +49,19 @@ func runCLI(args []string, stdout, stderr io.Writer) int {
}
}

// runManagedPolicyCommand dispatches the managed-policy commands and reports
// whether args[0] named one of them.
func runManagedPolicyCommand(args []string, stderr io.Writer) (int, bool) {
switch args[0] {
case managedPolicyE2ECommand:
return managedPolicyE2ECLI(args[1:], stderr), true
case managedPolicyNamespaceCommand:
return managedPolicyNamespaceCLI(args[1:], stderr), true
default:
return 0, false
}
}

func installLinuxCLI(args []string, stdout, stderr io.Writer) int {
if len(args) != 0 || runtime.GOOS != "linux" {
_, _ = fmt.Fprintln(stderr, "install-linux requires Linux and takes no arguments")
Expand Down
Loading
Loading