Skip to content
Merged
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
23 changes: 23 additions & 0 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ func init() {
deployCmd.AddCommand(deployGithubCmd)
}

// reservedDeployEnvVars are set by the platform on every deployment; a
// user-supplied value is overridden and ignored. Mirrors the reserved set in
// the API's deploy activity.
var reservedDeployEnvVars = []string{"KERNEL_API_KEY", "ENTRYPOINT_RELPATH"}

// warnReservedEnvVars notifies the user when a supplied env var is reserved and
// will be ignored, so a silently-dropped value doesn't surprise them later.
func warnReservedEnvVars(envVars map[string]string) {
for _, k := range reservedDeployEnvVars {
if _, ok := envVars[k]; ok {
pterm.Warning.Printfln("%s is reserved by Kernel and will be ignored (Kernel sets it automatically). Use a different variable name if you need your own value.", k)
}
}
}

func runDeployGithub(cmd *cobra.Command, args []string) error {
client := getKernelClient(cmd)

Expand Down Expand Up @@ -152,6 +167,10 @@ func runDeployGithub(cmd *cobra.Command, args []string) error {
envVars[parts[0]] = parts[1]
}

if output != "json" {
warnReservedEnvVars(envVars)
}

// Build the multipart request body directly for source-based deploy

if output != "json" {
Expand Down Expand Up @@ -312,6 +331,10 @@ func runDeploy(cmd *cobra.Command, args []string) (err error) {
envVars[parts[0]] = parts[1]
}

if output != "json" {
warnReservedEnvVars(envVars)
}

logger.Debug("deploying app", logger.Args("version", version, "force", force, "entrypoint", filepath.Base(resolvedEntrypoint)))
if output != "json" {
pterm.Info.Println("Deploying...")
Expand Down
Loading