-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notification: store commit status and commit status delivery #432
Conversation
8b5632c
to
410bad6
Compare
410bad6
to
e3c890e
Compare
@sgotti can you do the review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests like done for the runevents?
@sgotti to do the tests like runevents(in notification_test) I need to use also the configstore because the delivery need the gitsource. For the moment I added only the integration test TestCommitStatusDelivery. |
No or it'll become an integration test. What should be done is to create a stub gitsource and related receiver, use an interface for the a function to get the remotesource (and so the configstore calls) and use a different implementation only for tests. |
bbb82fd
to
ef55539
Compare
Status: cs.Status, | ||
TargetURL: targetURLTest, | ||
Description: cs.Description, | ||
Context: cs.Context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you just save all the values provided by *types.CommitStatus?
cs.CommitSHA = commitShaTest | ||
cs.Context = contextTest | ||
cs.Description = commitStatusDescription | ||
cs.ProjectID = projectIDTest | ||
cs.RunCounter = 1 | ||
cs.Status = types.CommitStatusSuccess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you generating the same identical commit status?
|
||
t.Logf("starting ns") | ||
|
||
time.Sleep(1 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why time.Sleep?
|
||
t.Logf("starting ns") | ||
|
||
time.Sleep(1 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why time.Sleep?
ef55539
to
2d9a085
Compare
tests/setup_test.go
Outdated
} | ||
} | ||
|
||
func webRunURL(webExposedURL, projectID string, runNumber uint64) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has been copied from the notification service. Define it inline inside the test instead of globally and add a comment that it has been copied from the notification service.
tests/setup_test.go
Outdated
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
wr := setupWebhooksReceiver(ctx, t, wrDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really needed for this test?
|
||
err := ns.d.Do(ctx, func(tx *sql.Tx) error { | ||
cs = types.NewCommitStatus(tx) | ||
cs.CommitSHA = commitShaTest + fmt.Sprint(n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Sprintf("commitSHA-%d", n)
cs.Context = contextTest + fmt.Sprint(n) | ||
cs.Description = commitStatusDescription | ||
cs.ProjectID = projectIDTest + fmt.Sprint(n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
projectIDTest = "projectid" | ||
commitShaTest = "commitSha" | ||
contextTest = "context" | ||
commitStatusDescription = "The run finished successfully" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for consts since they are used only one time.
}, nil | ||
} | ||
|
||
u := &GitSourceCommitStatusUpdater{n: n} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create it before NotificationService and set it in the struct.
|
||
t.Logf("starting ns") | ||
|
||
s := &StubCommitStatusUpdater{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use setupStub... as in the other test.
@@ -40,6 +41,12 @@ type NotificationService struct { | |||
|
|||
runserviceClient *rsclient.Client | |||
configstoreClient *csclient.Client | |||
|
|||
u updaterCommitStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commitStatusUpdater
u updaterCommitStatus | ||
} | ||
|
||
type updaterCommitStatus interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commitStatusUpdater
} | ||
|
||
type GitSourceCommitStatusUpdater struct { | ||
n *NotificationService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't set notification service inside status updater. Set the configstore client, config etc....
2d9a085
to
20d6cf0
Compare
tests/setup_test.go
Outdated
// it has been copied from the notification service | ||
u, err := url.Parse(sc.config.Notification.WebExposedURL + "/run") | ||
if err != nil { | ||
t.Fatalf("unexpected err: %v", err) | ||
} | ||
q := url.Values{} | ||
q.Set("projectref", project.ID) | ||
q.Set("runnumber", strconv.FormatUint(runs[0].Number, 10)) | ||
u.RawQuery = q.Encode() | ||
targetURL := u.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outside the tests range but inside the TestFunction define an inline function and use it here.
20d6cf0
to
935e9a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this files has been changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this files has been changed?
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"2e7d8e4f-6614-495f-b5f5-7a3a589c4ee1","creationTime":"2023-04-03T12:07:11.837436311Z","updateTime":"2023-04-03T12:07:11.837436311Z","sequence":1,"delivery_status":"delivered", "run_webhook_id":"0f324898-442d-477c-93df-eb2229b3f922", "delivered_at":"2023-04-03T12:07:11.837436311Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"960ba478-b117-490e-9ae2-cb19b8d081e2","creationTime":"2023-04-03T12:07:16.840625135Z","updateTime":"2023-04-03T12:07:16.840625135Z","sequence":2,"delivery_status":"delivered", "run_webhook_id":"11016652-3c7a-4519-9fbf-7422d7c8cbc1", "delivered_at":"2023-04-03T12:07:16.840625135Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"2934275f-160c-468c-9c76-b50a411a9712","creationTime":"2023-04-03T12:07:11.835348076Z","updateTime":"2023-04-03T12:07:11.835348076Z","sequence":3,"delivery_status":"delivered", "run_webhook_id":"21a3b09b-f30f-4167-9e1b-516217af58d0", "delivered_at":"2023-04-03T12:07:11.835348076Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"2393e6d9-4d43-4078-a2e5-2cfedccb014e","creationTime":"2023-04-03T12:07:11.834466379Z","updateTime":"2023-04-03T12:07:11.834466379Z","sequence":4,"delivery_status":"delivered", "run_webhook_id":"30590789-e1fd-44c5-9cfc-6854ebb8110d", "delivered_at":"2023-04-03T12:07:11.834466379Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"1108e91b-bed1-4506-9af5-bf98e9c30153","creationTime":"2023-04-03T12:07:11.835961926Z","updateTime":"2023-04-03T12:07:11.835961926Z","sequence":5,"delivery_status":"delivered", "run_webhook_id":"41bf0d4b-78e8-4ed2-9a1d-a0278c67bf89", "delivered_at":"2023-04-03T12:07:11.835961926Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"f13de536-59c6-4057-93d6-d97a3820cf74","creationTime":"2023-04-03T12:07:16.841611527Z","updateTime":"2023-04-03T12:07:16.841611527Z","sequence":6,"delivery_status":"delivered", "run_webhook_id":"439d278c-433e-4268-b98d-769139e83419", "delivered_at":"2023-04-03T12:07:16.841611527Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"78065d4d-68ac-4b26-9db1-dac584ef67db","creationTime":"2023-04-03T12:07:16.840050048Z","updateTime":"2023-04-03T12:07:16.840050048Z","sequence":7,"delivery_status":"delivered", "run_webhook_id":"4dd0ff39-8d53-4614-90a4-90ac406c73a9", "delivered_at":"2023-04-03T12:07:16.840050048Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"f02ad0fe-db1f-470c-8ab9-31fb82f9a534","creationTime":"2023-04-03T12:07:11.835003681Z","updateTime":"2023-04-03T12:07:11.835003681Z","sequence":8,"delivery_status":"delivered", "run_webhook_id":"4e2c3472-e6c9-4edf-a8ce-1bdeaddc5567", "delivered_at":"2023-04-03T12:07:11.835003681Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"375decce-f04b-43e9-8a40-da55629861ac","creationTime":"2023-04-03T12:07:11.836335516Z","updateTime":"2023-04-03T12:07:11.836335516Z","sequence":9,"delivery_status":"delivered", "run_webhook_id":"65571310-6c65-4d5e-a76b-395b59dd71f0", "delivered_at":"2023-04-03T12:07:11.836335516Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"301d9c55-1737-4960-8317-2528862d370a","creationTime":"2023-04-03T12:07:16.84037838Z","updateTime":"2023-04-03T12:07:16.84037838Z","sequence":10,"delivery_status":"delivered", "run_webhook_id":"6f5d2a6c-9232-4765-b2ea-943b41f15356", "delivered_at":"2023-04-03T12:07:16.84037838Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"db6fbd51-e349-40e0-ba72-39c5459dbd93","creationTime":"2023-04-03T12:07:16.841367077Z","updateTime":"2023-04-03T12:07:16.841367077Z","sequence":11,"delivery_status":"delivered", "run_webhook_id":"71bff3a2-7671-4b97-889d-04b6ef9090f5", "delivered_at":"2023-04-03T12:07:16.841367077Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"58c5e7c5-1fad-425e-b8e5-e17fab21220c","creationTime":"2023-04-03T12:07:16.840859039Z","updateTime":"2023-04-03T12:07:16.840859039Z","sequence":12,"delivery_status":"delivered", "run_webhook_id":"79aefd75-f299-4bd8-993c-3dc4d94d97f9", "delivered_at":"2023-04-03T12:07:16.840859039Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"4ca49423-6c8b-40b3-91e9-4ea8183d23da","creationTime":"2023-04-03T12:07:11.836894609Z","updateTime":"2023-04-03T12:07:11.836894609Z","sequence":13,"delivery_status":"delivered", "run_webhook_id":"7ee51f5e-5621-405b-a6f9-3fca65f168ee", "delivered_at":"2023-04-03T12:07:11.836894609Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"81a2213a-c830-4876-846e-3045337542f6","creationTime":"2023-04-03T12:07:16.838801606Z","updateTime":"2023-04-03T12:07:16.838801606Z","sequence":14,"delivery_status":"delivered", "run_webhook_id":"88d1cb99-b3be-4d40-b463-3e1991b26dd9", "delivered_at":"2023-04-03T12:07:16.838801606Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"e00aacd1-e9ba-4bdc-b258-6f014a975e51","creationTime":"2023-04-03T12:07:11.83768104Z","updateTime":"2023-04-03T12:07:11.83768104Z","sequence":15,"delivery_status":"delivered", "run_webhook_id":"9b68e5f8-1606-49f4-ac9f-ce8d86b0fc3c", "delivered_at":"2023-04-03T12:07:11.83768104Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"c2166ee0-3e75-4489-8cc1-9f8e493d2e9a","creationTime":"2023-04-03T12:07:11.837169581Z","updateTime":"2023-04-03T12:07:11.837169581Z","sequence":16,"delivery_status":"delivered", "run_webhook_id":"a3945814-5756-4485-90b8-e3b015c1a799", "delivered_at":"2023-04-03T12:07:11.837169581Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"d6de8ee9-574d-45da-bb69-b40c1265622b","creationTime":"2023-04-03T12:07:11.836628298Z","updateTime":"2023-04-03T12:07:11.836628298Z","sequence":17,"delivery_status":"delivered", "run_webhook_id":"c2fbf754-f314-43bb-8163-1b4ada575441", "delivered_at":"2023-04-03T12:07:11.836628298Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"b7c6f5eb-539c-4616-909c-00fea5f7f713","creationTime":"2023-04-03T12:07:16.839654667Z","updateTime":"2023-04-03T12:07:16.839654667Z","sequence":18,"delivery_status":"delivered", "run_webhook_id":"ce98dd37-b7fd-4d0a-a744-8e1545de3a6c", "delivered_at":"2023-04-03T12:07:16.839654667Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"1f2aaf7f-115b-4d31-856e-470d2814bc03","creationTime":"2023-04-03T12:07:16.84108568Z","updateTime":"2023-04-03T12:07:16.84108568Z","sequence":19,"delivery_status":"delivered", "run_webhook_id":"d07ec67f-7a81-48e7-9d94-a87d29ca6ca3", "delivered_at":"2023-04-03T12:07:16.84108568Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"196d9e3c-6ed7-49ed-a7fc-46b07ff71903","creationTime":"2023-04-03T12:07:16.839229324Z","updateTime":"2023-04-03T12:07:16.839229324Z","sequence":20,"delivery_status":"delivered", "run_webhook_id":"ed2599f1-3cfc-4d09-afaf-934e2a4e1515", "delivered_at":"2023-04-03T12:07:16.839229324Z", "status_code":200} | ||
{"exportMeta":{"kind":"LastRunEventSequence"},"id":"891f133f-ad98-431d-bed6-6e0db7ab0dd4","creationTime":"2023-04-03T12:07:11.837436311Z","updateTime":"2023-04-03T12:07:11.837436311Z","value":20} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the ids of these entries has been changed?
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"2e7d8e4f-6614-495f-b5f5-7a3a589c4ee1","creationTime":"2023-04-03T12:07:11.837436311Z","updateTime":"2023-04-03T12:07:11.837436311Z","sequence":1,"delivery_status":"delivered", "run_webhook_id":"0f324898-442d-477c-93df-eb2229b3f922", "delivered_at":"2023-04-03T12:07:11.837436311Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"960ba478-b117-490e-9ae2-cb19b8d081e2","creationTime":"2023-04-03T12:07:16.840625135Z","updateTime":"2023-04-03T12:07:16.840625135Z","sequence":2,"delivery_status":"delivered", "run_webhook_id":"11016652-3c7a-4519-9fbf-7422d7c8cbc1", "delivered_at":"2023-04-03T12:07:16.840625135Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"2934275f-160c-468c-9c76-b50a411a9712","creationTime":"2023-04-03T12:07:11.835348076Z","updateTime":"2023-04-03T12:07:11.835348076Z","sequence":3,"delivery_status":"delivered", "run_webhook_id":"21a3b09b-f30f-4167-9e1b-516217af58d0", "delivered_at":"2023-04-03T12:07:11.835348076Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"2393e6d9-4d43-4078-a2e5-2cfedccb014e","creationTime":"2023-04-03T12:07:11.834466379Z","updateTime":"2023-04-03T12:07:11.834466379Z","sequence":4,"delivery_status":"delivered", "run_webhook_id":"30590789-e1fd-44c5-9cfc-6854ebb8110d", "delivered_at":"2023-04-03T12:07:11.834466379Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"1108e91b-bed1-4506-9af5-bf98e9c30153","creationTime":"2023-04-03T12:07:11.835961926Z","updateTime":"2023-04-03T12:07:11.835961926Z","sequence":5,"delivery_status":"delivered", "run_webhook_id":"41bf0d4b-78e8-4ed2-9a1d-a0278c67bf89", "delivered_at":"2023-04-03T12:07:11.835961926Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"f13de536-59c6-4057-93d6-d97a3820cf74","creationTime":"2023-04-03T12:07:16.841611527Z","updateTime":"2023-04-03T12:07:16.841611527Z","sequence":6,"delivery_status":"delivered", "run_webhook_id":"439d278c-433e-4268-b98d-769139e83419", "delivered_at":"2023-04-03T12:07:16.841611527Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"78065d4d-68ac-4b26-9db1-dac584ef67db","creationTime":"2023-04-03T12:07:16.840050048Z","updateTime":"2023-04-03T12:07:16.840050048Z","sequence":7,"delivery_status":"delivered", "run_webhook_id":"4dd0ff39-8d53-4614-90a4-90ac406c73a9", "delivered_at":"2023-04-03T12:07:16.840050048Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"f02ad0fe-db1f-470c-8ab9-31fb82f9a534","creationTime":"2023-04-03T12:07:11.835003681Z","updateTime":"2023-04-03T12:07:11.835003681Z","sequence":8,"delivery_status":"delivered", "run_webhook_id":"4e2c3472-e6c9-4edf-a8ce-1bdeaddc5567", "delivered_at":"2023-04-03T12:07:11.835003681Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"375decce-f04b-43e9-8a40-da55629861ac","creationTime":"2023-04-03T12:07:11.836335516Z","updateTime":"2023-04-03T12:07:11.836335516Z","sequence":9,"delivery_status":"delivered", "run_webhook_id":"65571310-6c65-4d5e-a76b-395b59dd71f0", "delivered_at":"2023-04-03T12:07:11.836335516Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"301d9c55-1737-4960-8317-2528862d370a","creationTime":"2023-04-03T12:07:16.84037838Z","updateTime":"2023-04-03T12:07:16.84037838Z","sequence":10,"delivery_status":"delivered", "run_webhook_id":"6f5d2a6c-9232-4765-b2ea-943b41f15356", "delivered_at":"2023-04-03T12:07:16.84037838Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"db6fbd51-e349-40e0-ba72-39c5459dbd93","creationTime":"2023-04-03T12:07:16.841367077Z","updateTime":"2023-04-03T12:07:16.841367077Z","sequence":11,"delivery_status":"delivered", "run_webhook_id":"71bff3a2-7671-4b97-889d-04b6ef9090f5", "delivered_at":"2023-04-03T12:07:16.841367077Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"58c5e7c5-1fad-425e-b8e5-e17fab21220c","creationTime":"2023-04-03T12:07:16.840859039Z","updateTime":"2023-04-03T12:07:16.840859039Z","sequence":12,"delivery_status":"delivered", "run_webhook_id":"79aefd75-f299-4bd8-993c-3dc4d94d97f9", "delivered_at":"2023-04-03T12:07:16.840859039Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"4ca49423-6c8b-40b3-91e9-4ea8183d23da","creationTime":"2023-04-03T12:07:11.836894609Z","updateTime":"2023-04-03T12:07:11.836894609Z","sequence":13,"delivery_status":"delivered", "run_webhook_id":"7ee51f5e-5621-405b-a6f9-3fca65f168ee", "delivered_at":"2023-04-03T12:07:11.836894609Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"81a2213a-c830-4876-846e-3045337542f6","creationTime":"2023-04-03T12:07:16.838801606Z","updateTime":"2023-04-03T12:07:16.838801606Z","sequence":14,"delivery_status":"delivered", "run_webhook_id":"88d1cb99-b3be-4d40-b463-3e1991b26dd9", "delivered_at":"2023-04-03T12:07:16.838801606Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"e00aacd1-e9ba-4bdc-b258-6f014a975e51","creationTime":"2023-04-03T12:07:11.83768104Z","updateTime":"2023-04-03T12:07:11.83768104Z","sequence":15,"delivery_status":"delivered", "run_webhook_id":"9b68e5f8-1606-49f4-ac9f-ce8d86b0fc3c", "delivered_at":"2023-04-03T12:07:11.83768104Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"c2166ee0-3e75-4489-8cc1-9f8e493d2e9a","creationTime":"2023-04-03T12:07:11.837169581Z","updateTime":"2023-04-03T12:07:11.837169581Z","sequence":16,"delivery_status":"delivered", "run_webhook_id":"a3945814-5756-4485-90b8-e3b015c1a799", "delivered_at":"2023-04-03T12:07:11.837169581Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"d6de8ee9-574d-45da-bb69-b40c1265622b","creationTime":"2023-04-03T12:07:11.836628298Z","updateTime":"2023-04-03T12:07:11.836628298Z","sequence":17,"delivery_status":"delivered", "run_webhook_id":"c2fbf754-f314-43bb-8163-1b4ada575441", "delivered_at":"2023-04-03T12:07:11.836628298Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"b7c6f5eb-539c-4616-909c-00fea5f7f713","creationTime":"2023-04-03T12:07:16.839654667Z","updateTime":"2023-04-03T12:07:16.839654667Z","sequence":18,"delivery_status":"delivered", "run_webhook_id":"ce98dd37-b7fd-4d0a-a744-8e1545de3a6c", "delivered_at":"2023-04-03T12:07:16.839654667Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"1f2aaf7f-115b-4d31-856e-470d2814bc03","creationTime":"2023-04-03T12:07:16.84108568Z","updateTime":"2023-04-03T12:07:16.84108568Z","sequence":19,"delivery_status":"delivered", "run_webhook_id":"d07ec67f-7a81-48e7-9d94-a87d29ca6ca3", "delivered_at":"2023-04-03T12:07:16.84108568Z", "status_code":200} | ||
{"exportMeta":{"kind":"RunWebhookDelivery"},"id":"196d9e3c-6ed7-49ed-a7fc-46b07ff71903","creationTime":"2023-04-03T12:07:16.839229324Z","updateTime":"2023-04-03T12:07:16.839229324Z","sequence":20,"delivery_status":"delivered", "run_webhook_id":"ed2599f1-3cfc-4d09-afaf-934e2a4e1515", "delivered_at":"2023-04-03T12:07:16.839229324Z", "status_code":200} | ||
{"exportMeta":{"kind":"LastRunEventSequence"},"id":"891f133f-ad98-431d-bed6-6e0db7ab0dd4","creationTime":"2023-04-03T12:07:11.837436311Z","updateTime":"2023-04-03T12:07:11.837436311Z","value":20} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also not needed multiple spaces in the json (but these should be cleaned in a different PR)
context := fmt.Sprintf("%s/%s/%s", n.gc.ID, project.Name, run.RunConfig.Name) | ||
|
||
if err := gitSource.CreateCommitStatus(project.RepositoryPath, run.Run.Annotations[action.AnnotationCommitSHA], commitStatus, targetURL, description, context); err != nil { | ||
return errors.WithStack(err) | ||
retVal := &CommitStatus{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return &commitStatus ...
State: state, | ||
CommitSHA: run.Run.Annotations[action.AnnotationCommitSHA], | ||
RunCounter: run.Run.Counter, | ||
Description: description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: statusDescription(state),
rstypes "agola.io/agola/services/runservice/types" | ||
) | ||
|
||
func (n *NotificationService) updateCommitStatus(ctx context.Context, ev *rstypes.RunEvent) error { | ||
var commitStatus gitsource.CommitStatus | ||
type CommitStatus struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could probably be left unexported.
add CommitStatus and CommitStatusDelivery type
935e9a5
to
6c88206
Compare
Resolves #430