diff --git a/database/common/common.go b/database/common/common.go index dcc05882..d059245c 100644 --- a/database/common/common.go +++ b/database/common/common.go @@ -28,7 +28,7 @@ type RepoStore interface { DeleteRepository(ctx context.Context, repoID string) error UpdateRepository(ctx context.Context, repoID string, param params.UpdateEntityParams) (params.Repository, error) - CreateRepositoryPool(ctx context.Context, repoId string, param params.CreatePoolParams) (params.Pool, error) + CreateRepositoryPool(ctx context.Context, repoID string, param params.CreatePoolParams) (params.Pool, error) GetRepositoryPool(ctx context.Context, repoID, poolID string) (params.Pool, error) DeleteRepositoryPool(ctx context.Context, repoID, poolID string) error @@ -47,7 +47,7 @@ type OrgStore interface { DeleteOrganization(ctx context.Context, orgID string) error UpdateOrganization(ctx context.Context, orgID string, param params.UpdateEntityParams) (params.Organization, error) - CreateOrganizationPool(ctx context.Context, orgId string, param params.CreatePoolParams) (params.Pool, error) + CreateOrganizationPool(ctx context.Context, orgID string, param params.CreatePoolParams) (params.Pool, error) GetOrganizationPool(ctx context.Context, orgID, poolID string) (params.Pool, error) DeleteOrganizationPool(ctx context.Context, orgID, poolID string) error UpdateOrganizationPool(ctx context.Context, orgID, poolID string, param params.UpdatePoolParams) (params.Pool, error) diff --git a/runner/pool/pool.go b/runner/pool/pool.go index f073961f..83331709 100644 --- a/runner/pool/pool.go +++ b/runner/pool/pool.go @@ -244,7 +244,7 @@ func (r *basePoolManager) HandleWorkflowJob(job params.WorkflowJob) error { return errors.Wrap(err, "updating runner") } // Set triggeredBy here so we break the lock on any potential queued job. - triggeredBy = jobIdFromLabels(instance.AditionalLabels) + triggeredBy = jobIDFromLabels(instance.AditionalLabels) // A runner has picked up the job, and is now running it. It may need to be replaced if the pool has // a minimum number of idle runners configured. @@ -261,14 +261,14 @@ func (r *basePoolManager) HandleWorkflowJob(job params.WorkflowJob) error { return nil } -func jobIdFromLabels(labels []string) int64 { +func jobIDFromLabels(labels []string) int64 { for _, lbl := range labels { if strings.HasPrefix(lbl, jobLabelPrefix) { - jobId, err := strconv.ParseInt(lbl[len(jobLabelPrefix):], 10, 64) + jobID, err := strconv.ParseInt(lbl[len(jobLabelPrefix):], 10, 64) if err != nil { return 0 } - return jobId + return jobID } } return 0 diff --git a/test/integration/e2e/client.go b/test/integration/e2e/client.go index ee500383..db841983 100644 --- a/test/integration/e2e/client.go +++ b/test/integration/e2e/client.go @@ -17,18 +17,18 @@ var ( ) func InitClient(baseURL string) { - garmUrl, err := url.Parse(baseURL) + garmURL, err := url.Parse(baseURL) if err != nil { panic(err) } - apiPath, err := url.JoinPath(garmUrl.Path, client.DefaultBasePath) + apiPath, err := url.JoinPath(garmURL.Path, client.DefaultBasePath) if err != nil { panic(err) } transportCfg := client.DefaultTransportConfig(). - WithHost(garmUrl.Host). + WithHost(garmURL.Host). WithBasePath(apiPath). - WithSchemes([]string{garmUrl.Scheme}) + WithSchemes([]string{garmURL.Scheme}) cli = client.NewHTTPClientWithConfig(nil, transportCfg) } diff --git a/test/integration/e2e/e2e.go b/test/integration/e2e/e2e.go index 0c0c27e2..516c1e10 100644 --- a/test/integration/e2e/e2e.go +++ b/test/integration/e2e/e2e.go @@ -44,7 +44,7 @@ func GetControllerInfo() *params.ControllerInfo { if err := appendCtrlInfoToGitHubEnv(&controllerInfo); err != nil { panic(err) } - if err := printJsonResponse(controllerInfo); err != nil { + if err := printJSONResponse(controllerInfo); err != nil { panic(err) } return &controllerInfo diff --git a/test/integration/e2e/instances.go b/test/integration/e2e/instances.go index 1200f3a3..569edba7 100644 --- a/test/integration/e2e/instances.go +++ b/test/integration/e2e/instances.go @@ -27,7 +27,7 @@ func waitInstanceStatus(name string, status commonParams.InstanceStatus, runnerS timeWaited += 5 * time.Second } - if err := printJsonResponse(*instance); err != nil { + if err := printJSONResponse(*instance); err != nil { return nil, err } return nil, fmt.Errorf("timeout waiting for instance %s status to reach status %s and runner status %s", name, status, runnerStatus) @@ -68,7 +68,7 @@ func WaitInstanceToBeRemoved(name string, timeout time.Duration) error { timeWaited += 5 * time.Second } - if err := printJsonResponse(*instance); err != nil { + if err := printJSONResponse(*instance); err != nil { return err } return fmt.Errorf("instance %s was not removed within the timeout", name) diff --git a/test/integration/e2e/jobs.go b/test/integration/e2e/jobs.go index f3a1f3c6..179cf495 100644 --- a/test/integration/e2e/jobs.go +++ b/test/integration/e2e/jobs.go @@ -75,7 +75,7 @@ func waitLabelledJob(label string, timeout time.Duration) (*params.Job, error) { timeWaited += 5 * time.Second } - if err := printJsonResponse(jobs); err != nil { + if err := printJSONResponse(jobs); err != nil { return nil, err } return nil, fmt.Errorf("failed to wait job with label %s", label) @@ -116,7 +116,7 @@ func waitJobStatus(id int64, status params.JobStatus, timeout time.Duration) (*p timeWaited += 5 * time.Second } - if err := printJsonResponse(*job); err != nil { + if err := printJSONResponse(*job); err != nil { return nil, err } return nil, fmt.Errorf("timeout waiting for job %d to reach status %s", id, status) diff --git a/test/integration/e2e/organizations.go b/test/integration/e2e/organizations.go index 8f511215..7a7d0e0d 100644 --- a/test/integration/e2e/organizations.go +++ b/test/integration/e2e/organizations.go @@ -116,7 +116,7 @@ func dumpOrgInstancesDetails(orgID string) error { if err != nil { return err } - if err := printJsonResponse(org); err != nil { + if err := printJSONResponse(org); err != nil { return err } @@ -132,7 +132,7 @@ func dumpOrgInstancesDetails(orgID string) error { return err } slog.Info("Instance info", "instance_name", instance.Name) - if err := printJsonResponse(instance); err != nil { + if err := printJSONResponse(instance); err != nil { return err } } diff --git a/test/integration/e2e/pools.go b/test/integration/e2e/pools.go index f00e07eb..2ebc0165 100644 --- a/test/integration/e2e/pools.go +++ b/test/integration/e2e/pools.go @@ -37,7 +37,7 @@ func dumpPoolInstancesDetails(poolID string) error { if err != nil { return err } - if err := printJsonResponse(pool); err != nil { + if err := printJSONResponse(pool); err != nil { return err } for _, instance := range pool.Instances { @@ -46,7 +46,7 @@ func dumpPoolInstancesDetails(poolID string) error { return err } slog.Info("Instance details", "instance_name", instance.Name) - if err := printJsonResponse(instanceDetails); err != nil { + if err := printJSONResponse(instanceDetails); err != nil { return err } } diff --git a/test/integration/e2e/repositories.go b/test/integration/e2e/repositories.go index b1e9236d..9366c728 100644 --- a/test/integration/e2e/repositories.go +++ b/test/integration/e2e/repositories.go @@ -126,7 +126,7 @@ func dumpRepoInstancesDetails(repoID string) error { if err != nil { return err } - if err := printJsonResponse(repo); err != nil { + if err := printJSONResponse(repo); err != nil { return err } @@ -142,7 +142,7 @@ func dumpRepoInstancesDetails(repoID string) error { return err } slog.Info("Instance info", "instance_name", instance.Name) - if err := printJsonResponse(instance); err != nil { + if err := printJSONResponse(instance); err != nil { return err } } diff --git a/test/integration/e2e/utils.go b/test/integration/e2e/utils.go index ed8c2d62..37e48fe4 100644 --- a/test/integration/e2e/utils.go +++ b/test/integration/e2e/utils.go @@ -5,7 +5,7 @@ import ( "log/slog" ) -func printJsonResponse(resp interface{}) error { +func printJSONResponse(resp interface{}) error { b, err := json.MarshalIndent(resp, "", " ") if err != nil { return err diff --git a/test/integration/gh_cleanup/main.go b/test/integration/gh_cleanup/main.go index b841652e..2c9c3735 100644 --- a/test/integration/gh_cleanup/main.go +++ b/test/integration/gh_cleanup/main.go @@ -16,16 +16,16 @@ var ( ) func main() { - controllerID, ctrlIdFound := os.LookupEnv("GARM_CONTROLLER_ID") - if ctrlIdFound { + controllerID, ctrlIDFound := os.LookupEnv("GARM_CONTROLLER_ID") + if ctrlIDFound { _ = e2e.GhOrgRunnersCleanup(ghToken, orgName, controllerID) _ = e2e.GhRepoRunnersCleanup(ghToken, orgName, repoName, controllerID) } else { slog.Warn("Env variable GARM_CONTROLLER_ID is not set, skipping GitHub runners cleanup") } - baseURL, baseUrlFound := os.LookupEnv("GARM_BASE_URL") - if ctrlIdFound && baseUrlFound { + baseURL, baseURLFound := os.LookupEnv("GARM_BASE_URL") + if ctrlIDFound && baseURLFound { webhookURL := fmt.Sprintf("%s/webhooks/%s", baseURL, controllerID) _ = e2e.GhOrgWebhookCleanup(ghToken, webhookURL, orgName) _ = e2e.GhRepoWebhookCleanup(ghToken, webhookURL, orgName, repoName)