diff --git a/auth/auth.go b/auth/auth.go index 8e1a98ac..5bf882c9 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -78,7 +78,6 @@ func (a *Authenticator) GetJWTToken(ctx context.Context) (string, error) { // GetJWTMetricsToken returns a JWT token that can be used to read metrics. // This token is not tied to a user, no user is stored in the db. func (a *Authenticator) GetJWTMetricsToken(ctx context.Context) (string, error) { - if !IsAdmin(ctx) { return "", runnerErrors.ErrUnauthorized } diff --git a/auth/metrics.go b/auth/metrics.go index 3be4577a..1543d56c 100644 --- a/auth/metrics.go +++ b/auth/metrics.go @@ -23,7 +23,6 @@ func NewMetricsMiddleware(cfg config.JWTAuth) (*MetricsMiddleware, error) { func (m *MetricsMiddleware) Middleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() authorizationHeader := r.Header.Get("authorization") if authorizationHeader == "" { diff --git a/cmd/garm-cli/cmd/enterprise.go b/cmd/garm-cli/cmd/enterprise.go index fe49545a..f1eeda00 100644 --- a/cmd/garm-cli/cmd/enterprise.go +++ b/cmd/garm-cli/cmd/enterprise.go @@ -175,7 +175,6 @@ var enterpriseUpdateCmd = &cobra.Command{ } func init() { - enterpriseAddCmd.Flags().StringVar(&enterpriseName, "name", "", "The name of the enterprise") enterpriseAddCmd.Flags().StringVar(&enterpriseWebhookSecret, "webhook-secret", "", "The webhook secret for this enterprise") enterpriseAddCmd.Flags().StringVar(&enterpriseCreds, "credentials", "", "Credentials name. See credentials list.") diff --git a/cmd/garm-cli/cmd/organization.go b/cmd/garm-cli/cmd/organization.go index d833e2dd..946d8646 100644 --- a/cmd/garm-cli/cmd/organization.go +++ b/cmd/garm-cli/cmd/organization.go @@ -300,7 +300,6 @@ var orgDeleteCmd = &cobra.Command{ } func init() { - orgAddCmd.Flags().StringVar(&orgName, "name", "", "The name of the organization") orgAddCmd.Flags().StringVar(&orgWebhookSecret, "webhook-secret", "", "The webhook secret for this organization") orgAddCmd.Flags().StringVar(&orgCreds, "credentials", "", "Credentials name. See credentials list.") diff --git a/cmd/garm-cli/cmd/repository.go b/cmd/garm-cli/cmd/repository.go index 8482264b..077416e4 100644 --- a/cmd/garm-cli/cmd/repository.go +++ b/cmd/garm-cli/cmd/repository.go @@ -303,7 +303,6 @@ var repoDeleteCmd = &cobra.Command{ } func init() { - repoAddCmd.Flags().StringVar(&repoOwner, "owner", "", "The owner of this repository") repoAddCmd.Flags().StringVar(&repoName, "name", "", "The name of the repository") repoAddCmd.Flags().StringVar(&repoWebhookSecret, "webhook-secret", "", "The webhook secret for this repository") diff --git a/runner/metrics/enterprise.go b/runner/metrics/enterprise.go index 8cce89d6..17c2fa0d 100644 --- a/runner/metrics/enterprise.go +++ b/runner/metrics/enterprise.go @@ -10,7 +10,6 @@ import ( // CollectOrganizationMetric collects the metrics for the enterprise objects func CollectEnterpriseMetric(ctx context.Context, r *runner.Runner) error { - // reset metrics metrics.EnterpriseInfo.Reset() metrics.EnterprisePoolManagerStatus.Reset() diff --git a/runner/metrics/instance.go b/runner/metrics/instance.go index a32fa081..1d8fc83c 100644 --- a/runner/metrics/instance.go +++ b/runner/metrics/instance.go @@ -10,7 +10,6 @@ import ( // CollectInstanceMetric collects the metrics for the runner instances // reflecting the statuses and the pool they belong to. func CollectInstanceMetric(ctx context.Context, r *runner.Runner) error { - // reset metrics metrics.InstanceStatus.Reset() @@ -54,7 +53,6 @@ func CollectInstanceMetric(ctx context.Context, r *runner.Runner) error { } for _, instance := range instances { - metrics.InstanceStatus.WithLabelValues( instance.Name, // label: name string(instance.Status), // label: status diff --git a/runner/metrics/organization.go b/runner/metrics/organization.go index 0be9ced6..6b9f6b71 100644 --- a/runner/metrics/organization.go +++ b/runner/metrics/organization.go @@ -10,7 +10,6 @@ import ( // CollectOrganizationMetric collects the metrics for the organization objects func CollectOrganizationMetric(ctx context.Context, r *runner.Runner) error { - // reset metrics metrics.OrganizationInfo.Reset() metrics.OrganizationPoolManagerStatus.Reset() diff --git a/runner/metrics/pool.go b/runner/metrics/pool.go index 817cb104..fd4b6ee0 100644 --- a/runner/metrics/pool.go +++ b/runner/metrics/pool.go @@ -11,7 +11,6 @@ import ( // CollectPoolMetric collects the metrics for the pool objects func CollectPoolMetric(ctx context.Context, r *runner.Runner) error { - // reset metrics metrics.PoolInfo.Reset() metrics.PoolStatus.Reset() diff --git a/runner/metrics/provider.go b/runner/metrics/provider.go index 398f8ee3..e2b38a9f 100644 --- a/runner/metrics/provider.go +++ b/runner/metrics/provider.go @@ -8,7 +8,6 @@ import ( ) func CollectProviderMetric(ctx context.Context, r *runner.Runner) error { - // reset metrics metrics.ProviderInfo.Reset() diff --git a/runner/metrics/repository.go b/runner/metrics/repository.go index ba2fab29..b76fcc0e 100644 --- a/runner/metrics/repository.go +++ b/runner/metrics/repository.go @@ -9,7 +9,6 @@ import ( ) func CollectRepositoryMetric(ctx context.Context, r *runner.Runner) error { - // reset metrics metrics.EnterpriseInfo.Reset() metrics.EnterprisePoolManagerStatus.Reset() diff --git a/runner/providers/external/external.go b/runner/providers/external/external.go index 11b614de..6b35b3e5 100644 --- a/runner/providers/external/external.go +++ b/runner/providers/external/external.go @@ -145,7 +145,6 @@ func (e *external) DeleteInstance(ctx context.Context, instance string) error { ).Inc() return garmErrors.NewProviderError("provider binary %s returned error: %s", e.execPath, err) } - } return nil }