Skip to content

fix(docs-infra): handle CircleCI API v2 responses in preview server#45934

Closed
gkalpak wants to merge 1 commit intoangular:mainfrom
gkalpak:fix-aio-circle-api-v2
Closed

fix(docs-infra): handle CircleCI API v2 responses in preview server#45934
gkalpak wants to merge 1 commit intoangular:mainfrom
gkalpak:fix-aio-circle-api-v2

Conversation

@gkalpak
Copy link
Member

@gkalpak gkalpak commented May 9, 2022

In PR #45349 we switched to using version 2 of the CircleCI API. It turns out that this version of the API (in addition to different URLs) also returns different info from some endpoints, which we have failed to account for.

More specifically, the v2 API response for a job does not contain info that we need in BuildRetriever.

As an example, see the API responses for an aio_preview run:

This commit updates the code to handle API v2 responses. In addition, since the info we need is not present in the job info (as it was with the previous version of the API), we now also retrieve the pipeline
info.

NOTE:
This issue did not manifest earlier, because the preview server code on the VM was not updated to the latest version (that tried to use API v2) due to a different error. This error was fixed with PR #45895, which allowed the preview server to be updated on the VM and uncovered the API v2 incompatibility.

Fixes #45931.

In PR angular#45349 we switched to using version 2 of the CircleCI API. It
turns out that this version of the API (in addition to different URLs)
also returns different info from some endpoints, which we have failed to
account for.

More specifically, the v2 API response for a job does not contain info
that we need in [BuildRetriever][1].

As an example, see the API responses for an `aio_preview` run:
- [API v1.1][2]
- [API v2][3]

This commit updates the code to handle API v2 responses. In addition,
since the info we need is not present in the job info (as it was with
the previous version of the API), we now also retrieve the pipeline
info.

NOTE:
This issue did not manifest earlier, because the preview server code on
the VM was not updated to the latest version (that tried to use API v2)
due to a different error. This error was fixed with PR angular#45895, which
allowed the preview server to be updated on the VM and uncovered the API
v2 incompatibility.

[1]: https://github.com/angular/angular/blob/baa3e18812127e7266580f4cd202a4cb3204cbcb/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/build-retriever.ts#L39-L45
[2]: https://circleci.com/api/v1.1/project/github/angular/angular/1163816
[3]: https://circleci.com/api/v2/project/gh/angular/angular/job/1163816

Fixes angular#45931
@gkalpak gkalpak added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer comp: docs-infra target: patch This PR is targeted for the next patch release labels May 9, 2022
@ngbot ngbot bot modified the milestone: Backlog May 9, 2022
@gkalpak gkalpak marked this pull request as ready for review May 9, 2022 17:26
@gkalpak gkalpak requested a review from josephperrott May 9, 2022 17:42
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 9, 2022
@ngbot
Copy link

ngbot bot commented May 9, 2022

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "ci/circleci: aio_preview" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit c434097.

AndrewKushnir pushed a commit that referenced this pull request May 9, 2022
…45934)

In PR #45349 we switched to using version 2 of the CircleCI API. It
turns out that this version of the API (in addition to different URLs)
also returns different info from some endpoints, which we have failed to
account for.

More specifically, the v2 API response for a job does not contain info
that we need in [BuildRetriever][1].

As an example, see the API responses for an `aio_preview` run:
- [API v1.1][2]
- [API v2][3]

This commit updates the code to handle API v2 responses. In addition,
since the info we need is not present in the job info (as it was with
the previous version of the API), we now also retrieve the pipeline
info.

NOTE:
This issue did not manifest earlier, because the preview server code on
the VM was not updated to the latest version (that tried to use API v2)
due to a different error. This error was fixed with PR #45895, which
allowed the preview server to be updated on the VM and uncovered the API
v2 incompatibility.

[1]: https://github.com/angular/angular/blob/baa3e18812127e7266580f4cd202a4cb3204cbcb/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/build-retriever.ts#L39-L45
[2]: https://circleci.com/api/v1.1/project/github/angular/angular/1163816
[3]: https://circleci.com/api/v2/project/gh/angular/angular/job/1163816

Fixes #45931

PR Close #45934
AndrewKushnir pushed a commit that referenced this pull request May 9, 2022
…45934)

In PR #45349 we switched to using version 2 of the CircleCI API. It
turns out that this version of the API (in addition to different URLs)
also returns different info from some endpoints, which we have failed to
account for.

More specifically, the v2 API response for a job does not contain info
that we need in [BuildRetriever][1].

As an example, see the API responses for an `aio_preview` run:
- [API v1.1][2]
- [API v2][3]

This commit updates the code to handle API v2 responses. In addition,
since the info we need is not present in the job info (as it was with
the previous version of the API), we now also retrieve the pipeline
info.

NOTE:
This issue did not manifest earlier, because the preview server code on
the VM was not updated to the latest version (that tried to use API v2)
due to a different error. This error was fixed with PR #45895, which
allowed the preview server to be updated on the VM and uncovered the API
v2 incompatibility.

[1]: https://github.com/angular/angular/blob/baa3e18812127e7266580f4cd202a4cb3204cbcb/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/build-retriever.ts#L39-L45
[2]: https://circleci.com/api/v1.1/project/github/angular/angular/1163816
[3]: https://circleci.com/api/v2/project/gh/angular/angular/job/1163816

Fixes #45931

PR Close #45934
@gkalpak gkalpak deleted the fix-aio-circle-api-v2 branch May 9, 2022 19:01
gkalpak added a commit to gkalpak/angular that referenced this pull request May 10, 2022
Previously, the preview server would incorrectly identify a running
`aio_preview` CI job as failed and therefore skip creating a preview.
This happened because it only checked whether the job's status is
`success`, failing to account for the fact that the job would have a
`running` status.
(This bug was accidentally introduced in angular#45934.)

This commit avoids the problem by getting rid of the job status check
altogether. This check does not offer any benefit, since the CI job will
always be in a `running` state (i.e. neither successfully completed nor
failed).
jessicajaniuk pushed a commit that referenced this pull request May 12, 2022
Previously, the preview server would incorrectly identify a running
`aio_preview` CI job as failed and therefore skip creating a preview.
This happened because it only checked whether the job's status is
`success`, failing to account for the fact that the job would have a
`running` status.
(This bug was accidentally introduced in #45934.)

This commit avoids the problem by getting rid of the job status check
altogether. This check does not offer any benefit, since the CI job will
always be in a `running` state (i.e. neither successfully completed nor
failed).

PR Close #45948
jessicajaniuk pushed a commit that referenced this pull request May 12, 2022
Previously, the preview server would incorrectly identify a running
`aio_preview` CI job as failed and therefore skip creating a preview.
This happened because it only checked whether the job's status is
`success`, failing to account for the fact that the job would have a
`running` status.
(This bug was accidentally introduced in #45934.)

This commit avoids the problem by getting rid of the job status check
altogether. This check does not offer any benefit, since the CI job will
always be in a `running` state (i.e. neither successfully completed nor
failed).

PR Close #45948
jessicajaniuk pushed a commit that referenced this pull request May 12, 2022
Previously, the preview server would incorrectly identify a running
`aio_preview` CI job as failed and therefore skip creating a preview.
This happened because it only checked whether the job's status is
`success`, failing to account for the fact that the job would have a
`running` status.
(This bug was accidentally introduced in #45934.)

This commit avoids the problem by getting rid of the job status check
altogether. This check does not offer any benefit, since the CI job will
always be in a `running` state (i.e. neither successfully completed nor
failed).

PR Close #45948
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: aio_preview CI job is failing for PRs

3 participants