Fix artifacts url parsing#66
Conversation
|
Apologies, closing this as I realize my PR is not appropriately formated. I'll open a better one soon. |
|
Reopening as I could not fix the formatting issue from github. Real diff is around lines 7996 - 8033. |
|
Ideally you would edit the root |
* upstream/master: Update NCC; pin fetch to v2 (scientific-python#71) ENH: Add automatic rebuild (scientific-python#72) Build(deps): Bump undici from 5.28.5 to 5.29.0 Making config example and narrative consistent (scientific-python#67)
| { headers: { 'Circle-Token': apiToken } } | ||
| ); | ||
| const jobs = await jobsRes.json(); | ||
| if (!jobs.items.length) { |
There was a problem hiding this comment.
@matthieutrs you had if (!jobs.items?.length) { (note the ?) and eslint complained, so I removed the ?
larsoner
left a comment
There was a problem hiding this comment.
Okay I pushed this branch to my fork as master and verified that it still worked okay:
@matthieutrs can you verify that your fix still works? If not, can you push any necessary changes to index.js and let the autofix.ci bot update dist/index.js?
|
Something I want to mention about this is that it won't work in the case where a workflow contains multiple jobs, and the artifacts are produced by a job which is not first in the workflow. Here is an example value of {
"next_page_token": null,
"items": [
{
"job_number": 29,
"stopped_at": "2025-05-20T02:55:05Z",
"started_at": "2025-05-20T02:31:58Z",
"name": "build_scipy",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {},
"status": "success",
"id": "24c4aaeb-5226-4b55-a475-ce7b4edddfa3",
"dependencies": []
},
{
"job_number": 31,
"stopped_at": "2025-05-20T02:59:40Z",
"started_at": "2025-05-20T02:55:08Z",
"name": "refguide_check",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3": [
"success"
]
},
"status": "success",
"id": "0f0cfb08-2cb8-4d4c-a5fd-9f541248bfd7",
"dependencies": [
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3"
]
},
{
"job_number": 30,
"stopped_at": "2025-05-20T03:20:25Z",
"started_at": "2025-05-20T02:55:08Z",
"name": "run_benchmarks",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3": [
"success"
]
},
"status": "success",
"id": "ad088988-083d-4142-9440-655371fdb48e",
"dependencies": [
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3"
]
},
{
"job_number": 32,
"stopped_at": "2025-05-20T03:12:01Z",
"started_at": "2025-05-20T02:55:08Z",
"name": "build_docs",
"project_slug": "circleci/TZE2qTnF4tD2yK4HmPgb3V/TZakiCrqyJ21zbxV5HZURU",
"type": "build",
"requires": {
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3": [
"success"
]
},
"status": "success",
"id": "241b350e-8cc1-4b48-b8e0-1e889098e35c",
"dependencies": [
"24c4aaeb-5226-4b55-a475-ce7b4edddfa3"
]
}
]
}This code attempts to read the artifacts from |
|
@nickodell is that behavior you're describing a regression with this PR? If it's something broken on |
This PR doesn't break anything for old style organizations. On |
|
Thanks @nickodell ! @matthieutrs good to go from your end / have you had a chance to test following my changes? |
|
Hey @larsoner , sorry I've not had the time to review properly but LGTM! |
|
Okay let's give it a shot, thanks @matthieutrs ! |
This PR proposes a fix for #65. I did not check that this fix still works on the legacy urls, although this should!
Details
In my case,
was not working, the proper url being in the format
Proposed solution
Check whether the target url fits in the legacy or in the new format, and apply appropriate parsing depending on the case: