Problem/Motivation

When using generic frontend environment the only allowed response status to consider a deploy triggered is 200.
There are some systems that, on the successful trigger of deploy, return status 201, which seems like a legitimate response because it means "Created".
If 201 is not accepted the new deployment never gets created and we are always stuck with the first deployment. In addition, the content changes never get cleaned, but stack forever as never deployed changes.

Steps to reproduce

Create a generic frontend environment with a hook from a system that returns status 201 on successful trigger of deployment (example: vercel).
Change some content.
Trigger a deployment for this environment.
There is a warning message "created".
The deployment is not processed, there is no new deployment, but the first deployment is still there with all the old changes.

Proposed resolution

Allow response status 201 in the FrontendEnvironmentBase. 201 seems legitimate for the particular task of checking whether the deployment was triggered. This is allowed in build_hooks_bitbucket as well.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

petar_basic created an issue. See original summary.

petar_basic’s picture

Here's a patch for the proposed solution.

petar_basic’s picture

StatusFileSize
new551 bytes

Just changing the name of the patch.

larowlan’s picture

Version: 3.1.4 » 3.x-dev
Status: Active » Needs work
Issue tags: +Needs tests

Thanks for this.

Can you add another test case to \Drupal\Tests\build_hooks\Kernel\BuildTriggerTest for this.

The method \Drupal\Tests\build_hooks\Kernel\BuildHooksKernelTestBase::assertFrontendEnvironmentBuildHook accepts a Response object, so you should be able to pass a 201.

There's an example in \Drupal\Tests\build_hooks_bitbucket\Kernel\BitbucketBuildHooksTest::testBitbucketFrontendEnvironment of using a 201

larowlan’s picture

Issue tags: +Novice
petar_basic’s picture

StatusFileSize
new1.87 KB

Added another test case to \Drupal\Tests\build_hooks\Kernel\BuildTriggerTest which checks if 201 response is fine.

Please let me know if there should be any changes.

petar_basic’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: allow_response_created.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

petar_basic’s picture

StatusFileSize
new1.97 KB
larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new808 bytes
new5.37 KB

Looks great, we just need to get it passing.

Status: Needs review » Needs work

The last submitted patch, 10: 3219061-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.09 KB
new6.45 KB

Ah! there's no schema at all for that plugin

Status: Needs review » Needs work

The last submitted patch, 12: 3219061-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

petar_basic’s picture

StatusFileSize
new8.58 KB

I don't know what is wrong with the test now, lets try with expected_url.

petar_basic’s picture

StatusFileSize
new8.56 KB
petar_basic’s picture

StatusFileSize
new8.65 KB

Ok, figured I need to provide it with dummy url.

petar_basic’s picture

Status: Needs work » Needs review
larowlan’s picture

Thanks @petar_basic I'll commit this on Monday, ran out of time today sorry

  • larowlan committed 18c30f8 on 3.x authored by petar_basic
    Issue #3219061 by petar_basic, larowlan: Generic frontend environment...
larowlan’s picture

Status: Needs review » Fixed
larowlan’s picture

Will wait for #3219055: Toolbar shows frontend environments with status 0 before cutting a new release

larowlan’s picture

Will cut a release because that issue is failing

larowlan’s picture

Title: Generic frontend environment does not regard 201 response as triggered deploy » Allow Generic frontend environment to regard 201 response as triggered deploy
Category: Bug report » Feature request

This will go out as 3.2.0

petar_basic’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.