Giter Club home page Giter Club logo

Comments (3)

dosubot avatar dosubot commented on July 4, 2024 2

Hey @yoramshai! 👋 I'm here to help you with any bugs, questions, or contributions you have regarding this project. Let's squash those bugs together!

The error message you're encountering after upgrading to v1.0.0-beta9 is likely due to changes in the Incident struct, which introduced new fields that might not be handled correctly in your existing codebase. Specifically, the following fields were added to the Incident struct in v1.0.0-beta9:

  • Priority
  • Self
  • Service
  • Status
  • Summary
  • Teams
  • Title
  • Type
  • Urgency

Ensure that your task options are correctly decoded and validated. The PagerDutyOptions struct and related functions in task_data.go should properly handle the new fields and any required parameters. Here is an example of how the task options are managed:

type PagerDutyOptions struct {
	ConnectionId  uint64                       `json:"connectionId" mapstructure:"connectionId,omitempty"`
	ServiceId     string                       `json:"serviceId,omitempty" mapstructure:"serviceId,omitempty"`
	ServiceName   string                       `json:"serviceName,omitempty" mapstructure:"serviceName,omitempty"`
	ScopeConfigId uint64                       `json:"scopeConfigId,omitempty" mapstructure:"scopeConfigId,omitempty"`
	ScopeConfig   *models.PagerdutyScopeConfig `json:"service_name,omitempty" mapstructure:"serviceName,omitempty"`
}

type PagerDutyTaskData struct {
	Options *PagerDutyOptions
	Client  api.RateLimitedApiClient
}

func DecodeAndValidateTaskOptions(options map[string]interface{}) (*PagerDutyOptions, errors.Error) {
	op, err := DecodeTaskOptions(options)
	if err != nil {
		return nil, err
	}
	err = ValidateTaskOptions(op)
	if err != nil {
		return nil, err
	}
	return op, nil
}

func DecodeTaskOptions(options map[string]interface{}) (*PagerDutyOptions, errors.Error) {
	var op PagerDutyOptions
	err := api.Decode(options, &op, nil)
	if err != nil {
		return nil, err
	}
	return &op, nil
}

func EncodeTaskOptions(op *PagerDutyOptions) (map[string]interface{}, errors.Error) {
	var result map[string]interface{}
	err := api.Decode(op, &result, nil)
	if err != nil {
		return nil, err
	}
	return result, nil
}

func ValidateTaskOptions(op *PagerDutyOptions) errors.Error {
	if op.ServiceName == "" {
		return errors.BadInput.New("not enough info for Pagerduty execution")
	}
	if op.ServiceId == "" {
		return errors.BadInput.New("not enough info for Pagerduty execution")
	}
	if op.ConnectionId == 0 {
		return errors.BadInput.New("connectionId is invalid")
	}
	return nil
}

Ensure that your code handles these new fields appropriately to avoid errors [1][2].

To continue talking to Dosu, mention @dosu.

from incubator-devlake.

klesh avatar klesh commented on July 4, 2024

Hi, can you share the plan detail of the failed pipeline?
image

from incubator-devlake.

yoramshai avatar yoramshai commented on July 4, 2024

@klesh absolutely
{ "id": 632, "name": "foo-Blueprint", "plan": [ [ { "plugin": "org", "subtasks": [ "setProjectMapping" ], "options": { "projectMappings": [ { "projectName": "foo", "scopes": [ { "rowId": "github:GithubRepo:1:569576293", "table": "repos" }, { "rowId": "github:GithubRepo:1:569576293", "table": "cicd_scopes" }, { "rowId": "github:GithubRepo:1:569576293", "table": "boards" }, { "rowId": "pagerduty:Service:1:P5GD7S8", "table": "cicd_scopes" }, { "rowId": "webhook:27", "table": "cicd_scopes" }, { "rowId": "webhook:27", "table": "boards" } ] } ] } } ], [ { "plugin": "github_graphql", "subtasks": [ "Collect Milestones", "Extract Milestones", "Collect Issues", "Extract Issues", "Collect Pull Requests", "Extract Pull Requests", "Collect Workflow Runs", "Extract Workflow Runs", "Collect Job Runs", "Extract Jobs", "Collect Comments", "Extract Comments", "Collect Events", "Extract Events", "Collect PR Review Comments", "Extract PR Review Comments", "Collect Users", "Extract Users", "Convert Workflow Runs", "Convert Jobs", "Enrich PR Issues", "Convert Repos", "Convert Issues", "Convert Issue Labels", "Convert PR Commits", "Convert Pull Requests", "Convert PR Reviews", "Convert PR Labels", "Convert PR Issues", "Convert Issue Assignees", "Convert Issue Comments", "Convert PR Comments", "Convert Milestones", "Convert Users", "Collect Deployments", "Extract Deployments", "Convert Deployments", "Collect Releases", "Extract Releases", "Convert Releases" ], "options": { "connectionId": 1, "fullName": "bar/foo", "githubId": 569576293, "name": "bar/foo" } }, { "plugin": "gitextractor", "subtasks": null, "options": { "fullName": "bar/foo", "name": "bar/foo", "proxy": "", "repoId": "github:GithubRepo:1:569576293", "url": "https://git:****************************************@github.com/bar/foo.git" } }, { "plugin": "pagerduty", "subtasks": [ "collectIncidents", "extractIncidents", "convertIncidents", "convertServices" ], "options": { "connectionId": 1, "serviceId": "P5G****" } } ], [ { "plugin": "dora", "subtasks": [ "generateDeployments", "generateDeploymentCommits", "enrichPrevSuccessDeploymentCommits" ], "options": { "projectName": "foo" } } ], [ { "plugin": "refdiff", "subtasks": [ "calculateDeploymentCommitsDiff" ], "options": { "projectName": "foo" } } ], [ { "plugin": "dora", "subtasks": [ "calculateChangeLeadTime", "ConnectIncidentToDeployment" ], "options": { "projectName": "foo" } } ] ], "skipOnFail": true }

from incubator-devlake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.