acquia / cli

Acquia CLI
GNU General Public License v2.0
42 stars 47 forks source link

CLI-1102: Misleading notifications and Acquid Cloud UI when code swicthing to a tag without the `tags/` prefix #1557

Closed cdubz closed 1 year ago

cdubz commented 1 year ago

Describe the bug

If I attempt an api:environments:code-switch task and set the branch to a tag name without the tags/ prefix the resulting notification completes successfully and the Acquia Cloud UI claims the environment is using the tag but it has not actually been switched.

To Reproduce

Steps to reproduce the behavior:

  1. Push a new tag (e.g. 2023-06-28.1639) to an Acquia remote.
  2. Execute the api:environments:code-switch task: acli api:environments:code-switch myapp.dev 2023-06-28.1639.
  3. Observe notification ID and confirm notification completes (via API and Acquia Cloud UI).
  4. Confirm that application code has not actually been switched (in my case this was based on config changes associated with the tag but maybe there is a more direct way to confirm this?).

Expected behavior

The code for the target environment is switched to the provided tag OR the notification fails with some useful indication about why.

Screenshots

Here is an example of the issue with a real tag:

~ > acli api:environments:code-switch "$ACQUIA_SITE_GROUP".prod "$RELEASE_TAG"                                                                                                                                                                                       16:15:46
{
    "message": "Switching code.",
    "notification": "417a1c3c-65f5-460a-8cfd-d6c3e7f62a38",
    "_links": {
        "self": {
            "href": "https:\/\/cloud.acquia.com\/api\/environments\/71943-cf63c408-c12a-464c-9518-0fd97306b4dd\/code\/actions\/switch"
        },
        "notification": {
            "href": "https:\/\/cloud.acquia.com\/api\/notifications\/417a1c3c-65f5-460a-8cfd-d6c3e7f62a38"
        }
    }
}
~ > acli api:notifications:find 417a1c3c-65f5-460a-8cfd-d6c3e7f62a38
{
    "uuid": "417a1c3c-65f5-460a-8cfd-d6c3e7f62a38",
    "event": "CodeSwitched",
    "label": "Code switched",
    "description": "Code switched to \"2023-06-28.1610\" on the \"Prod\" environment.",
    "created_at": "2023-06-28T23:17:17+00:00",
    "completed_at": "2023-06-28T23:17:44+00:00",
    "status": "completed",
    "progress": 100,
    "context": {
        "code": {
            "branches": [
                "2023-06-28.1610"
            ]
        },
        "application": {
            "uuids": [
                "cf63c408-c12a-464c-9518-0fd97306b4dd"
            ]
        },
        "team": {
            "uuids": [
                "5a0d399f-11cc-4d99-86be-9746eee9de5f",
                "11684bff-4981-4554-8d1a-2d76bf46ee4d"
            ]
        },
        "organization": {
            "uuids": [
                "cddc864f-0f36-4dbe-83e7-555ca7111574"
            ]
        },
        "subscription": {
            "uuids": [
                "643b5bf3-d73c-4661-82a8-73e3d99a9479"
            ]
        },
        "environment": {
            "ids": [
                "71943-cf63c408-c12a-464c-9518-0fd97306b4dd"
            ]
        },
        "author": {
            "uuid": "956115e9-475b-4c59-8cb0-f78fc9231fb3",
            "actual_uuid": "956115e9-475b-4c59-8cb0-f78fc9231fb3"
        },
        "user": {
            "uuids": [
                "956115e9-475b-4c59-8cb0-f78fc9231fb3"
            ]
        }
    },
    "_links": {
        "self": {
            "href": "https:\/\/cloud.acquia.com\/api\/notifications\/417a1c3c-65f5-460a-8cfd-d6c3e7f62a38"
        }
    },
    "_embedded": { ... }
}

And here is what the Acquia Cloud UI showed after this series of commands:

Screenshot 2023-06-28 at 16-18-23 Crosscut Environments Cloud Platform

Screenshot 2023-06-28 at 16-19-17 Crosscut Environments Cloud Platform

Additional context

Acquia CLI version: 2.12.3

Running the same command with the tags/ prefix (acli api:environments:code-switch "$ACQUIA_SITE_GROUP".prod tags/"$RELEASE_TAG") works as expected -- the notification succeeded, the Acquia Cloud UI indicated the tag is switched, and the code was in fact switched to the tag.

cdubz commented 1 year ago

Ah shoot I just noticed this is a duplicate of #1540 :hurtrealbad:...

anavarre commented 1 year ago

I'm closing this issue in favor of #1540 and have referenced the issue so we can also have your feedback to best address the issue. Thanks.