Skip to content

Conversation

@magichair
Copy link
Contributor

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation. N/A
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

Add a nil check on CreatedDate during convertWorkflows task for edge case malformed CircleCI workflow objects.

Does this close any open issues?

Closes #8309

Screenshots

N/A - See #8309 for JSON snippets from CircleCI API responses

Other Information

I need to run the test suite to get a failing test first, I'm not sure that this extra raw data will be enough to hit this workflow bug.

Adds a nil check during `convertWorkflows` task when CircleCI workflows API returns a weird malformed pipeline data with no created_date. Previously, the entire task fails and panics when trying to get convert a nil in ToTime util.

Fixes Issue apache#8309
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug severity/p1 This bug affects functionality or significantly affect ux labels Feb 26, 2025
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 26, 2025
1,89054eb2-8e85-4f5c-9a93-66d753a0e970,github/coldgust/coldgust.github.io,625ca634-68fe-4515-91f0-7ba8af51dc99,,say-hello-workflow,,,success,1c762fc2-b0fb-4fe2-97d2-5e54ddd1eba7,3,2023-03-25T17:39:23.000+00:00,2023-03-25T17:39:28.000+00:00,5
1,8971a56b-5547-4824-94dd-07bb467524c5,github/coldgust/coldgust.github.io,87aad008-1ad5-486a-8174-fdeed846561a,,say-hello-workflow,,,success,1c762fc2-b0fb-4fe2-97d2-5e54ddd1eba7,2,2023-03-25T17:12:18.000+00:00,2023-03-25T17:12:23.000+00:00,5
1,8fe60291-68f7-40e2-acec-d99bff4da713,github/coldgust/coldgust.github.io,afef32b3-5ffe-48d2-8d9e-46dcedd82554,,say-hello-workflow,,,success,1c762fc2-b0fb-4fe2-97d2-5e54ddd1eba7,1,2023-03-25T17:12:18.000+00:00,2023-03-25T17:12:22.000+00:00,4
1,b3b77371-e27a-4e93-a554-c728f757cd24,github/coldgust/coldgust.github.io,f5a2a6e8-4430-4935-8bec-77ca2b26c61d,,workflow,,,failed,,16,,,0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me if it's going to be OK or not for there to be NULL created_date columns in the _tool_circleci_workflows table later in the pipeline for processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local testing, so far, doesn't show any obvious issues with the NULL values in the database in the _tool tables.

@klesh
Copy link
Contributor

klesh commented Feb 28, 2025

LGTM, would you like to cherrypick it back to v1.0 by putting up another PR to the release-v1.0 branch? Thanks in advance.

@klesh klesh merged commit e0584d6 into apache:main Feb 28, 2025
9 of 10 checks passed
magichair added a commit to magichair/incubator-devlake that referenced this pull request Feb 28, 2025
* fix(circleci): Add CircleCI workflow nil check for CreatedDate

Adds a nil check during `convertWorkflows` task when CircleCI workflows API returns a weird malformed pipeline data with no created_date. Previously, the entire task fails and panics when trying to get convert a nil in ToTime util.

Fixes Issue apache#8309

* Update to fix compile problems

* Tweak the _tool csv to allow for the NULL value entries

---------

Co-authored-by: John Ibsen <[email protected]>
@magichair
Copy link
Contributor Author

Thanks for the merge! Cherry-pick ready now #8314

klesh added a commit that referenced this pull request Mar 7, 2025
… check for CreatedDate (#8310) (#8314)

* fix(circleci): CircleCI Workflow nil check for CreatedDate (#8310)

* fix(circleci): Add CircleCI workflow nil check for CreatedDate

Adds a nil check during `convertWorkflows` task when CircleCI workflows API returns a weird malformed pipeline data with no created_date. Previously, the entire task fails and panics when trying to get convert a nil in ToTime util.

Fixes Issue #8309

* Update to fix compile problems

* Tweak the _tool csv to allow for the NULL value entries

---------

Co-authored-by: John Ibsen <[email protected]>

* Update with latest updates in circleci plugin for createdAt

---------

Co-authored-by: John Ibsen <[email protected]>
Co-authored-by: Klesh Wong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug severity/p1 This bug affects functionality or significantly affect ux size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][CircleCI] Need better error handling in convertWorkflows when API is malformed

3 participants