Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ linters:
# - depguard
- dogsled
- dupl
- dupword
# - dupword
- durationcheck
# - err113
# - errcheck
Expand Down
7 changes: 4 additions & 3 deletions src/cmd/cli/command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/DefangLabs/defang/src/pkg/cli/client/byoc/gcp"
"github.com/DefangLabs/defang/src/pkg/cli/compose"
"github.com/DefangLabs/defang/src/pkg/clouds/aws"
"github.com/DefangLabs/defang/src/pkg/github"
"github.com/DefangLabs/defang/src/pkg/logs"
"github.com/DefangLabs/defang/src/pkg/mcp"
"github.com/DefangLabs/defang/src/pkg/scope"
Expand Down Expand Up @@ -149,7 +150,7 @@ func Execute(ctx context.Context) error {
}

if hasTty && !hideUpdate && pkg.RandomIndex(10) == 0 {
if latest, err := GetLatestVersion(ctx); err == nil && isNewer(GetCurrentVersion(), latest) {
if latest, err := github.GetLatestReleaseTag(ctx); err == nil && isNewer(GetCurrentVersion(), latest) {
term.Debug("Latest Version:", latest, "Current Version:", GetCurrentVersion())
fmt.Println("A newer version of the CLI is available at https://github.com/DefangLabs/defang/releases/latest")
if pkg.RandomIndex(10) == 0 && !pkg.GetenvBool("DEFANG_HIDE_HINTS") {
Expand Down Expand Up @@ -730,7 +731,7 @@ var getVersionCmd = &cobra.Command{
fmt.Println(GetCurrentVersion())

term.Printc(term.BrightCyan, "Latest CLI: ")
ver, err := GetLatestVersion(cmd.Context())
ver, err := github.GetLatestReleaseTag(cmd.Context())
fmt.Println(ver)

term.Printc(term.BrightCyan, "Defang Fabric: ")
Expand Down Expand Up @@ -808,7 +809,7 @@ var configSetCmd = &cobra.Command{
value = strings.TrimSuffix(string(bytes), "\n")
} else if random {
// Generate a random value for the config
value = CreateRandomConfigValue()
value = cli.CreateRandomConfigValue()
term.Info("Generated random value: " + value)
} else {
// Prompt for sensitive value
Expand Down
15 changes: 14 additions & 1 deletion src/cmd/cli/command/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ import (
"github.com/spf13/cobra"
)

const DEFANG_PORTAL_HOST = "portal.defang.io"
const SERVICE_PORTAL_URL = "https://" + DEFANG_PORTAL_HOST + "/service"

func printPlaygroundPortalServiceURLs(serviceInfos []*defangv1.ServiceInfo) {
// We can only show services deployed to the prod1 defang SaaS environment.
if providerID == cliClient.ProviderDefang && cluster == cli.DefaultCluster {
term.Info("Monitor your services' status in the defang portal")
for _, serviceInfo := range serviceInfos {
term.Println(" -", SERVICE_PORTAL_URL+"/"+serviceInfo.Service.Name)
}
}
}

func createProjectForDebug(loader *compose.Loader) (*compose.Project, error) {
projOpts, err := loader.NewProjectOptions()
if err != nil {
Expand Down Expand Up @@ -193,7 +206,7 @@ func makeComposeUpCmd() *cobra.Command {
}

// Print the current service states of the deployment
err = printServiceStatesAndEndpoints(deploy.Services)
err = cli.PrintServiceStatesAndEndpoints(ctx, deploy.Services)
if err != nil {
return err
}
Expand Down
30 changes: 30 additions & 0 deletions src/cmd/cli/command/compose_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package command

import (
"bytes"
"os"
"testing"

"github.com/DefangLabs/defang/src/pkg/cli"
cliClient "github.com/DefangLabs/defang/src/pkg/cli/client"
"github.com/DefangLabs/defang/src/pkg/term"
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
)

func TestInitializeTailCmd(t *testing.T) {
Expand All @@ -14,3 +21,26 @@ func TestInitializeTailCmd(t *testing.T) {
}
})
}

func TestPrintPlaygroundPortalServiceURLs(t *testing.T) {
defaultTerm := term.DefaultTerm
t.Cleanup(func() {
term.DefaultTerm = defaultTerm
})

var stdout, stderr bytes.Buffer
term.DefaultTerm = term.NewTerm(os.Stdin, &stdout, &stderr)

providerID = cliClient.ProviderDefang
cluster = cli.DefaultCluster
printPlaygroundPortalServiceURLs([]*defangv1.ServiceInfo{
{
Service: &defangv1.Service{Name: "service1"},
}})
const want = ` * Monitor your services' status in the defang portal
- https://portal.defang.io/service/service1
`
if got := stdout.String(); got != want {
t.Errorf("got %q, want %q", got, want)
}
}
86 changes: 0 additions & 86 deletions src/cmd/cli/command/deploymentinfo.go

This file was deleted.

145 changes: 0 additions & 145 deletions src/cmd/cli/command/deploymentinfo_test.go

This file was deleted.

Loading
Loading