• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pomerium / pomerium / 16526957574

25 Jul 2025 04:34PM UTC coverage: 52.172% (-6.4%) from 58.559%
16526957574

push

github

web-flow
ci: restore coverage step in test workflow (#5752)

I think the step to upload coverage to coveralls has been getting 
skipped due to a mismatch in platform name.

23627 of 45287 relevant lines covered (52.17%)

75.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/zero/cmd/command_root.go
1
package cmd
2

3
import (
4
        "context"
5
        "errors"
6

7
        "github.com/spf13/cobra"
8

9
        zero "github.com/pomerium/pomerium/internal/zero/api"
10
)
11

12
type zeroClientContextKeyType struct{}
13

14
var zeroClientContextKey zeroClientContextKeyType
15

16
func zeroClientFromContext(ctx context.Context) *zero.API {
×
17
        return ctx.Value(zeroClientContextKey).(*zero.API)
×
18
}
×
19

20
func BuildRootCmd() *cobra.Command {
×
21
        cmd := &cobra.Command{
×
22
                Use:   "zero",
×
23
                Short: "Interact with the Pomerium Zero cloud service",
×
24
                PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
×
25
                        configFlag := cmd.InheritedFlags().Lookup("config")
×
26
                        var configFile string
×
27
                        if configFlag != nil {
×
28
                                configFile = configFlag.Value.String()
×
29
                        }
×
30

31
                        if err := setupLogger(); err != nil {
×
32
                                return err
×
33
                        }
×
34
                        var token string
×
35
                        if tokenFlag := cmd.InheritedFlags().Lookup("token"); tokenFlag != nil && tokenFlag.Changed {
×
36
                                token = tokenFlag.Value.String()
×
37
                        } else {
×
38
                                token = getToken(configFile)
×
39
                        }
×
40
                        if token == "" {
×
41
                                return errors.New("no token provided")
×
42
                        }
×
43

44
                        var clusterAPIEndpoint string
×
45
                        if endpointFlag := cmd.InheritedFlags().Lookup("cluster-api-endpoint"); endpointFlag != nil && endpointFlag.Changed {
×
46
                                clusterAPIEndpoint = endpointFlag.Value.String()
×
47
                        } else {
×
48
                                clusterAPIEndpoint = getClusterAPIEndpoint()
×
49
                        }
×
50

51
                        client, err := zero.NewAPI(cmd.Context(),
×
52
                                zero.WithAPIToken(token),
×
53
                                zero.WithClusterAPIEndpoint(clusterAPIEndpoint),
×
54
                                zero.WithConnectAPIEndpoint(getConnectAPIEndpoint()),
×
55
                                zero.WithOTELEndpoint(getOTELAPIEndpoint()),
×
56
                        )
×
57
                        if err != nil {
×
58
                                return err
×
59
                        }
×
60
                        cmd.SetContext(context.WithValue(cmd.Context(), zeroClientContextKey, client))
×
61
                        return nil
×
62
                },
63
        }
64

65
        cmd.AddCommand(BuildImportCmd())
×
66
        cmd.PersistentFlags().String("config", "", "Specify configuration file location")
×
67
        cmd.PersistentFlags().String("token", "", "Pomerium Zero Token (default: $POMERIUM_ZERO_TOKEN)")
×
68
        cmd.PersistentFlags().String("cluster-api-endpoint", "", "Pomerium Zero Cluster API Endpoint (default: $CLUSTER_API_ENDPOINT)")
×
69
        cmd.PersistentFlags().Lookup("cluster-api-endpoint").Hidden = true
×
70

×
71
        return cmd
×
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc