fix: var-naming linter findings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
This commit is contained in:
parent
bd0b27ab10
commit
3b9f8b555b
11 changed files with 26 additions and 26 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue