screwdriver-cd / screwdriver

An open source build platform designed for continuous delivery.
http://screwdriver.cd
Other
1.02k stars 169 forks source link

Missing Card in Screwdriver UI for chainPR builds #3010

Open VonnyJap opened 9 months ago

VonnyJap commented 9 months ago

What happened: Pipeline 12980 was newly created and chain-pr-example repo has PR on it and the screwdriver config is annotated with screwdriver.cd/chainPR: true.

Did a pr sync

Screenshot 2024-01-30 at 11 30 13 AM

Jobs were created as I looked into the API call https://api.screwdriver.cd/v4/pipelines/12980/jobs The response

[
    {
        "id": 116222,
        "name": "random-job",
        "permutations": [
            {
                "annotations": {},
                "commands": [
                    {
                        "name": "echo",
                        "command": "echo \"this is random job.\""
                    }
                ],
                "environment": {},
                "image": "node:8",
                "secrets": [],
                "settings": {},
                "requires": [
                    "second-job"
                ]
            }
        ],
        "pipelineId": 12980,
        "state": "ENABLED",
        "archived": false
    },
    {
        "id": 116221,
        "name": "second-job",
        "permutations": [
            {
                "annotations": {},
                "commands": [
                    {
                        "name": "echo",
                        "command": "echo \"this is second job.\""
                    }
                ],
                "environment": {},
                "image": "node:8",
                "secrets": [],
                "settings": {},
                "requires": [
                    "first-job"
                ]
            }
        ],
        "pipelineId": 12980,
        "state": "ENABLED",
        "archived": false
    },
    {
        "id": 116220,
        "name": "first-job",
        "permutations": [
            {
                "annotations": {},
                "commands": [
                    {
                        "name": "echo",
                        "command": "echo \"this is first job. Hello World!\""
                    }
                ],
                "environment": {},
                "image": "node:8",
                "secrets": [],
                "settings": {},
                "requires": [
                    "~pr",
                    "~commit"
                ]
            }
        ],
        "pipelineId": 12980,
        "state": "ENABLED",
        "archived": false
    },
    {
        "title": "test pr",
        "createTime": "2024-01-30T00:53:16Z",
        "username": "VonnyJap",
        "userProfile": "https://github.com/VonnyJap",
        "url": "https://github.com/VonnyJap/chain-pr-example/pull/4",
        "id": 116225,
        "name": "PR-4:random-job",
        "prParentJobId": 116222,
        "permutations": [
            {
                "annotations": {},
                "commands": [
                    {
                        "name": "echo",
                        "command": "echo \"this is random job.\""
                    }
                ],
                "environment": {},
                "image": "node:8",
                "secrets": [],
                "settings": {},
                "requires": [
                    "second-job"
                ]
            }
        ],
        "pipelineId": 12980,
        "state": "ENABLED",
        "archived": false
    },
    {
        "title": "test pr",
        "createTime": "2024-01-30T00:53:16Z",
        "username": "VonnyJap",
        "userProfile": "https://github.com/VonnyJap",
        "url": "https://github.com/VonnyJap/chain-pr-example/pull/4",
        "id": 116224,
        "name": "PR-4:second-job",
        "prParentJobId": 116221,
        "permutations": [
            {
                "annotations": {},
                "commands": [
                    {
                        "name": "echo",
                        "command": "echo \"this is second job.\""
                    }
                ],
                "environment": {},
                "image": "node:8",
                "secrets": [],
                "settings": {},
                "requires": [
                    "first-job"
                ]
            }
        ],
        "pipelineId": 12980,
        "state": "ENABLED",
        "archived": false
    },
    {
        "title": "test pr",
        "createTime": "2024-01-30T00:53:16Z",
        "username": "VonnyJap",
        "userProfile": "https://github.com/VonnyJap",
        "url": "https://github.com/VonnyJap/chain-pr-example/pull/4",
        "id": 116223,
        "name": "PR-4:first-job",
        "prParentJobId": 116220,
        "permutations": [
            {
                "annotations": {},
                "commands": [
                    {
                        "name": "echo",
                        "command": "echo \"this is first job. Hello World 123!\""
                    }
                ],
                "environment": {},
                "image": "node:8",
                "secrets": [],
                "settings": {},
                "requires": [
                    "~pr",
                    "~commit"
                ]
            }
        ],
        "pipelineId": 12980,
        "state": "ENABLED",
        "archived": false
    }
]

But PRs tab showed empty.

Screenshot 2024-01-30 at 11 34 19 AM

But this is not a problem with normal PR without the screwdriver.cd/chainPR: true annotation. Please see some of the findings in below thread.

What you expected to happen: There should be event displayed as card under the PR tab for chainPR scenario.

How to reproduce it:

VonnyJap commented 9 months ago

@kumada626 @y-oksaku Are you aware of any recent changes that might cause this regression? @sagar1312 was able in the past to run a PR sync on the local development environment to start a PR job from upstream Github repository. This is useful in most cases when we are investigating user issues pertaining to PR trigger. I have performed some investigations and I could not find any related works on the screwdriver-cd/ui that might have caused this regression. One solution that I have in mind: Upon running PR sync, apart from creating the PR related jobs, an event should be immediately created if there is a path to a job caused by a PR trigger. Please share your thoughts. Thank you!

kumada626 commented 9 months ago

@VonnyJap Unfortunately, I'm not aware of any recent changes that would cause this regression. However, I have confirmed that if chainPR is not set in the pipeline, PR cards will appear in that procedure. https://cd.screwdriver.cd/pipelines/12983/pulls

スクリーンショット 2024-02-01 18 26 59
VonnyJap commented 9 months ago

@kumada626 Thanks for your findings. So I think the current implementation of PR sync just does not handle the case of chainPR as intended. In this case, I should edit the current description to reflect the updated issue. I think chainPR and the normal PR should have the same behavior after the PR sync, which in this case, should show the card and trigger an event.

kumada626 commented 8 months ago

I agree to chainPR and normal PR should have the same behavior after the PR sync. However, whether the event should be triggered is debatable. In the normal PR case, PR cards is appeared but event is not triggered. So I assume that the user does not expect that pressing the sync button will generate an event and initiate a build. Even in the case of chainPR, I think it would be better show the card but not trigger an event.