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
8 changes: 6 additions & 2 deletions .github/workflows/smoke-crush.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions pkg/workflow/crush_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,34 @@ func (e *CrushEngine) GetInstallationSteps(workflowData *WorkflowData) []GitHubA
return []GitHubActionStep{}
}

npmSteps := BuildStandardNpmEngineInstallSteps(
// Use version from engine config if provided, otherwise default to pinned version
version := string(constants.DefaultCrushVersion)
if workflowData.EngineConfig != nil && workflowData.EngineConfig.Version != "" {
version = workflowData.EngineConfig.Version
}

// Crush requires post-install scripts (native binaries) so --ignore-scripts must
// NOT be passed. This is intentionally different from other engine installs.
npmSteps := GenerateNpmInstallSteps(
"@charmland/crush",
string(constants.DefaultCrushVersion),
version,
"Install Crush CLI",
"crush",
workflowData,
true, // Include Node.js setup
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Me like version override! Good cave code. But maybe add log line when version overridden? Help debug later.

true, // Crush requires post-install scripts for native binaries
)

// Run crush --version to verify the installation and force any deferred binary downloads
commandName := "crush"
if workflowData.EngineConfig != nil && workflowData.EngineConfig.Command != "" {
commandName = workflowData.EngineConfig.Command
}
versionStep := GitHubActionStep{
" - name: Verify Crush CLI installation",
" run: " + commandName + " --version",
Comment on lines +80 to +86
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ug! Me agree with other caveman reviewer. Dead code bad. Simplify good!

📰 BREAKING: Report filed by Smoke Copilot · ● 860K

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ug! Me see commandName logic never reach here. Early return block above take over when EngineConfig.Command not empty. Maybe just use hardcoded crush --version?

}
npmSteps = append(npmSteps, versionStep)

return BuildNpmEngineInstallStepsWithAWF(npmSteps, workflowData)
}

Expand Down
28 changes: 26 additions & 2 deletions pkg/workflow/crush_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,32 @@ func TestCrushEngineInstallation(t *testing.T) {
steps := engine.GetInstallationSteps(workflowData)
require.NotEmpty(t, steps, "Should generate installation steps")

// Should have at least: Node.js setup + Install Crush
assert.GreaterOrEqual(t, len(steps), 2, "Should have at least 2 installation steps")
// Should have at least: Node.js setup + Install Crush + Verify Crush CLI installation
assert.GreaterOrEqual(t, len(steps), 3, "Should have at least 3 installation steps")

// Find install step and verify --ignore-scripts is NOT present (Crush needs post-install scripts for native binaries)
var installStep string
for _, step := range steps {
content := strings.Join(step, "\n")
if strings.Contains(content, "@charmland/crush@") {
installStep = content
break
}
}
require.NotEmpty(t, installStep, "Should find a step installing @charmland/crush")
assert.NotContains(t, installStep, "--ignore-scripts", "Should not use --ignore-scripts for Crush (requires post-install scripts for native binaries)")

// Find crush --version step to confirm binary download is forced
var versionStep string
for _, step := range steps {
content := strings.Join(step, "\n")
if strings.Contains(content, "crush --version") {
versionStep = content
break
}
}
require.NotEmpty(t, versionStep, "Should find crush --version step to force binary download")
assert.Contains(t, versionStep, "Verify Crush CLI installation", "Should have a descriptive step name")
})

t.Run("custom command skips installation", func(t *testing.T) {
Expand Down
Loading