Merge pull request #314 from mercedes-benz/improve_error_message
Improve error messages in garm log
This commit is contained in:
commit
8e13588edd
5 changed files with 27 additions and 3 deletions
|
|
@ -38,3 +38,7 @@ linters-settings:
|
|||
|
||||
goimports:
|
||||
local-prefixes: github.com/cloudbase/garm
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G115
|
||||
|
|
|
|||
11
Makefile
11
Makefile
|
|
@ -57,6 +57,17 @@ create-release-files:
|
|||
release: build-static create-release-files ## Create a release
|
||||
|
||||
##@ Lint / Verify
|
||||
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
|
||||
|
||||
## Tool Versions
|
||||
GOLANGCI_LINT_VERSION ?= v1.61.0
|
||||
|
||||
.PHONY: golangci-lint
|
||||
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. If wrong version is installed, it will be overwritten.
|
||||
$(GOLANGCI_LINT): $(LOCALBIN)
|
||||
test -s $(LOCALBIN)/golangci-lint && $(LOCALBIN)/golangci-lint --version | grep -q $(GOLANGCI_LINT_VERSION) || \
|
||||
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
||||
|
||||
.PHONY: lint
|
||||
lint: golangci-lint $(GOLANGCI_LINT) ## Run linting.
|
||||
$(GOLANGCI_LINT) run -v --build-tags=testing,integration $(GOLANGCI_LINT_EXTRA_ARGS)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ func (s *sqlDatabase) paramsJobToWorkflowJob(ctx context.Context, job params.Job
|
|||
if job.RunnerName != "" {
|
||||
instance, err := s.getInstanceByName(s.ctx, job.RunnerName)
|
||||
if err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get instance by name")
|
||||
// This usually is very normal as not all jobs run on our runners.
|
||||
slog.DebugContext(ctx, "failed to get instance by name", "instance_name", job.RunnerName)
|
||||
} else {
|
||||
workflofJob.InstanceID = &instance.ID
|
||||
}
|
||||
|
|
@ -244,7 +245,8 @@ func (s *sqlDatabase) CreateOrUpdateJob(ctx context.Context, job params.Job) (pa
|
|||
if err == nil {
|
||||
workflowJob.InstanceID = &instance.ID
|
||||
} else {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to get instance by name")
|
||||
// This usually is very normal as not all jobs run on our runners.
|
||||
slog.DebugContext(ctx, "failed to get instance by name", "instance_name", job.RunnerName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ func (s *sqlDatabase) updatePool(tx *gorm.DB, pool Pool, param params.UpdatePool
|
|||
}
|
||||
|
||||
tags := []Tag{}
|
||||
if param.Tags != nil && len(param.Tags) > 0 {
|
||||
if len(param.Tags) > 0 {
|
||||
for _, val := range param.Tags {
|
||||
t, err := s.getOrCreateTag(tx, val)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -145,6 +145,13 @@ func (r *basePoolManager) HandleWorkflowJob(job params.WorkflowJob) error {
|
|||
return errors.Wrap(err, "validating owner")
|
||||
}
|
||||
|
||||
// we see events where the lables seem to be missing. We should ignore these
|
||||
// as we can't know if we should handle them or not.
|
||||
if len(job.WorkflowJob.Labels) == 0 {
|
||||
slog.WarnContext(r.ctx, "job has no labels", "workflow_job", job.WorkflowJob.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
var jobParams params.Job
|
||||
var err error
|
||||
var triggeredBy int64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue