railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

cli/common_test.go

cli/common_test.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
package cli import (	"encoding/json"	"fmt"	"testing" 	"github.com/railwayapp/railpack/core/config"	"github.com/railwayapp/railpack/core/mise"	"github.com/railwayapp/railpack/core/plan"	"github.com/stretchr/testify/require") func TestAddSchemaToPlanMap_IncludesSchemaAndPreservesPlan(t *testing.T) {	// Create a minimal non-empty plan	p := plan.NewBuildPlan()	p.Deploy.StartCmd = "run"	p.Secrets = []string{"FOO"} 	// Marshal the original plan to a map for comparison	baseBytes, err := json.Marshal(p)	require.NoError(t, err)	var baseMap map[string]any	require.NoError(t, json.Unmarshal(baseBytes, &baseMap)) 	// Get the map with schema and validate	outMap, err := addSchemaToPlanMap(p)	require.NoError(t, err)	require.Equal(t, config.SchemaUrl, outMap["$schema"]) 	// Remove the added $schema and compare with the original	delete(outMap, "$schema")	require.Equal(t, baseMap, outMap)} func TestExitCodeForError(t *testing.T) {	temporary := &mise.TemporaryError{URL: "https://example.com/mise.tar.gz", Err: fmt.Errorf("i/o timeout")} 	tests := []struct {		name     string		err      error		expected int	}{		{name: "temporary", err: temporary, expected: ExitCodeTransient},		{name: "wrapped temporary", err: fmt.Errorf("failed to ensure mise is installed: %w", temporary), expected: ExitCodeTransient},		{name: "deterministic", err: fmt.Errorf("no start command was found"), expected: ExitCodeFailure},	} 	for _, tt := range tests {		t.Run(tt.name, func(t *testing.T) {			require.Equal(t, tt.expected, exitCodeForError(tt.err))		})	}} func TestAddSchemaToPlanMap_NilPlan(t *testing.T) {	outMap, err := addSchemaToPlanMap(nil)	require.NoError(t, err)	require.Len(t, outMap, 1)	require.Equal(t, config.SchemaUrl, outMap["$schema"])}