umbraco / Umbraco.Deploy.Issues

1 stars 0 forks source link

Some artifacts collide on unique identifiers #188

Closed bjarnef closed 9 months ago

bjarnef commented 9 months ago

On an Umbraco Project I had a element type named "Block Education Progress" which I renamed to "Education Progress" and created a new element type with name "Block Education Progress".

Now after transfer to remove environment and extraction schema files, I get the following error.

{
  "Date": "2023-11-14T14:16:16.4700931+00:00",
  "Message": "Some artifacts collide on unique identifiers.\r\nThis means that they have different Udis, yet\r\nthey refer to the same unique Umbraco object\r\nand therefore cannot be processed.\r\n---------------------------------------------\r\nCollisions for entity type \"document-type\": \r\n  Collisions for unique identifier \"blockEducationProgress\":\r\n    Artifact: umb://document-type/471d6288d0f54a688d71dde5a829959c\r\n    {ContentType umb://document-type/99f2b4c4e6464446a0b04bf61e0333ae}\r\n",
  "Ex": {
    "Report": {
      "HasCollisions": true,
      "TotalCollisions": 2,
      "Collisions": {
        "document-type": {
          "blockEducationProgress": [
            "Artifact: umb://document-type/471d6288d0f54a688d71dde5a829959c",
            "{ContentType umb://document-type/99f2b4c4e6464446a0b04bf61e0333ae}"
          ]
        }
      }
    },
    "EnvironmentName": "source",
    "HasMeaningForUi": false,
    "Message": "Some artifacts collide on unique identifiers.\r\nThis means that they have different Udis, yet\r\nthey refer to the same unique Umbraco object\r\nand therefore cannot be processed.\r\n---------------------------------------------\r\nCollisions for entity type \"document-type\": \r\n  Collisions for unique identifier \"blockEducationProgress\":\r\n    Artifact: umb://document-type/471d6288d0f54a688d71dde5a829959c\r\n    {ContentType umb://document-type/99f2b4c4e6464446a0b04bf61e0333ae}\r\n",
    "Data": {},
    "InnerException": null,
    "HelpLink": null,
    "Source": "Umbraco.Deploy.Infrastructure",
    "HResult": -2146233088,
    "StackTrace": "   at Umbraco.Deploy.Infrastructure.Connectors.ServiceConnectors.ContentTypeConnector.ContentTypeConnectorBase`2.Process(DeployState state, IDeployContext context, Int32 pass)\r\n   at Umbraco.Deploy.Infrastructure.Connectors.ServiceConnectors.ServiceConnectorBase`3.Process(ArtifactDeployState dart, IDeployContext context, Int32 pass)\r\n   at Umbraco.Deploy.Infrastructure.Environments.CurrentEnvironment.ProcessArtifacts(IEnumerable`1 arts, IDeployContext context, CancellationToken token)"
  },
  "Sender": "Umbraco.Deploy.Infrastructure.Work.WorkItems.DiskReadWorkItem"
}
{
  "Name": "Education Progress",
  "Alias": "educationProgress",
  "DefaultTemplate": null,
  "AllowedTemplates": [],
  "HistoryCleanup": {
    "preventCleanup": false,
    "keepAllVersionsNewerThanDays": null,
    "keepLatestVersionPerDayForDays": null
  },
  "Icon": "icon-timer color-black",
  "Thumbnail": "folder.png",
  "Description": null,
  "IsContainer": false,
  "Permissions": {
    "AllowVaryingByCulture": false,
    "AllowVaryingBySegment": false,
    "AllowedAtRoot": false,
    "IsElementType": true,
    "AllowedChildContentTypes": []
  },
  "Parent": "umb://document-type-container/849d514d651348d7a90881fbec5d96bb",
  "CompositionContentTypes": [],
  "PropertyGroups": [
    {
      "Key": "4a48dc3b-6948-4cb4-bbd5-353776411f67",
      "Name": "Content",
      "SortOrder": 0,
      "Type": 1,
      "Alias": "content",
      "PropertyTypes": [
        {
          "Key": "291fbc0d-2926-4a28-abe6-85f7204d5dd9",
          "Alias": "duration",
          "DataType": "umb://data-type/3927508f8ada45e78744402a45f2cd81",
          "Description": null,
          "Mandatory": false,
          "MandatoryMessage": null,
          "Name": "Duration",
          "SortOrder": 1,
          "Validation": null,
          "ValidationMessage": null,
          "VariesByCulture": false,
          "VariesBySegment": false,
          "LabelOnTop": false,
          "MemberCanEdit": false,
          "ViewOnProfile": false,
          "IsSensitive": false
        },
        {
          "Key": "7e6f0043-b84b-40f0-a76e-7e4ae30e7d1f",
          "Alias": "category",
          "DataType": "umb://data-type/f07536db7a174b30815bc6d41a132f01",
          "Description": null,
          "Mandatory": false,
          "MandatoryMessage": null,
          "Name": "Category",
          "SortOrder": 3,
          "Validation": null,
          "ValidationMessage": null,
          "VariesByCulture": false,
          "VariesBySegment": false,
          "LabelOnTop": false,
          "MemberCanEdit": false,
          "ViewOnProfile": false,
          "IsSensitive": false
        },
        {
          "Key": "befa9c77-056d-4b69-b650-e365a4e8ed04",
          "Alias": "description",
          "DataType": "umb://data-type/7430cdebc5b148f484eba1b39fcaed5f",
          "Description": null,
          "Mandatory": false,
          "MandatoryMessage": null,
          "Name": "Description",
          "SortOrder": 2,
          "Validation": null,
          "ValidationMessage": null,
          "VariesByCulture": false,
          "VariesBySegment": false,
          "LabelOnTop": false,
          "MemberCanEdit": false,
          "ViewOnProfile": false,
          "IsSensitive": false
        },
        {
          "Key": "db2c569d-5b80-44c1-a6e8-23a5e6ca2122",
          "Alias": "title",
          "DataType": "umb://data-type/0cc0eba1996042c9bf9b60e150b429ae",
          "Description": null,
          "Mandatory": false,
          "MandatoryMessage": null,
          "Name": "Title",
          "SortOrder": 0,
          "Validation": null,
          "ValidationMessage": null,
          "VariesByCulture": false,
          "VariesBySegment": false,
          "LabelOnTop": false,
          "MemberCanEdit": false,
          "ViewOnProfile": false,
          "IsSensitive": false
        }
      ]
    }
  ],
  "PropertyTypes": [],
  "Udi": "umb://document-type/99f2b4c4e6464446a0b04bf61e0333ae",
  "Dependencies": [
    {
      "Udi": "umb://data-type/0cc0eba1996042c9bf9b60e150b429ae",
      "Ordering": true,
      "Mode": 0
    },
    {
      "Udi": "umb://data-type/3927508f8ada45e78744402a45f2cd81",
      "Ordering": true,
      "Mode": 0
    },
    {
      "Udi": "umb://data-type/7430cdebc5b148f484eba1b39fcaed5f",
      "Ordering": true,
      "Mode": 0
    },
    {
      "Udi": "umb://data-type/f07536db7a174b30815bc6d41a132f01",
      "Ordering": true,
      "Mode": 0
    },
    {
      "Udi": "umb://document-type-container/849d514d651348d7a90881fbec5d96bb",
      "Ordering": true,
      "Mode": 0
    }
  ],
  "__type": "Umbraco.Deploy.Infrastructure,Umbraco.Deploy.Infrastructure.Artifacts.ContentType.DocumentTypeArtifact",
  "__version": "12.0.4"
}
{
  "Name": "Education Progress",
  "Alias": "blockEducationProgress",
  "DefaultTemplate": null,
  "AllowedTemplates": [],
  "HistoryCleanup": {
    "preventCleanup": false,
    "keepAllVersionsNewerThanDays": null,
    "keepLatestVersionPerDayForDays": null
  },
  "Icon": "icon-directions color-black",
  "Thumbnail": "folder.png",
  "Description": null,
  "IsContainer": false,
  "Permissions": {
    "AllowVaryingByCulture": false,
    "AllowVaryingBySegment": false,
    "AllowedAtRoot": false,
    "IsElementType": true,
    "AllowedChildContentTypes": []
  },
  "Parent": "umb://document-type-container/4b1708ba73924421a4faeb4ed60edbe4",
  "CompositionContentTypes": [],
  "PropertyGroups": [
    {
      "Key": "393c5b09-134a-4fae-b0f7-b056aa7263f0",
      "Name": "Content",
      "SortOrder": 0,
      "Type": 1,
      "Alias": "content",
      "PropertyTypes": [
        {
          "Key": "b755dfa4-9a82-41b7-adf9-36c5cffed61b",
          "Alias": "item",
          "DataType": "umb://data-type/64a807f4a92d4e8cbd9af35427edc18f",
          "Description": null,
          "Mandatory": false,
          "MandatoryMessage": null,
          "Name": "Item",
          "SortOrder": 0,
          "Validation": null,
          "ValidationMessage": null,
          "VariesByCulture": false,
          "VariesBySegment": false,
          "LabelOnTop": false,
          "MemberCanEdit": false,
          "ViewOnProfile": false,
          "IsSensitive": false
        }
      ]
    }
  ],
  "PropertyTypes": [],
  "Udi": "umb://document-type/471d6288d0f54a688d71dde5a829959c",
  "Dependencies": [
    {
      "Udi": "umb://data-type/64a807f4a92d4e8cbd9af35427edc18f",
      "Ordering": true,
      "Mode": 0
    },
    {
      "Udi": "umb://document-type-container/4b1708ba73924421a4faeb4ed60edbe4",
      "Ordering": true,
      "Mode": 0
    }
  ],
  "__type": "Umbraco.Deploy.Infrastructure,Umbraco.Deploy.Infrastructure.Artifacts.ContentType.DocumentTypeArtifact",
  "__version": "12.0.4"
}

Umbraco v12.3.1 Deploy v12.0.4

AndyButland commented 9 months ago

Yes, I can see why that would come about. What's happening is:

I had a element type named "Block Education Progress" which I renamed to "Education Progress"

So now in your local environment you have a single document type with alias educationProgress and a GUID key. The same document type exists upstream with the alias blockEducationProcess and the same GUID key.

and created a new element type with name "Block Education Progress".

And now another document type with a different GUID key and the alias blockEducationProcess

On deployment, the first document type can be updated. But as it's all done in a transaction, the second has a problem. It's finding an existing document type with the same alias but a different GUID key, and throws an error on that (as you can't have two document types with the same alias).

I think you can resolve if you deploy this in two parts - first the rename of the existing document type, and then the addition of the new one. That should serve as a workaround to allow you to deploy what you need.

Will consider though if we can ignore this check in the state you have - as the case here is that there won't be a problem once the full deployment is completed, as the clashing item will have been renamed to have a new alias.

bjarnef commented 9 months ago

It seems Deploy was a bit confused, when the remote environment also have the original entity with alias blockEducationProgress.

It seems it was better to rename to something temporary first like blockEducationPro .. and then update afterwards when the orignal block blockEducationProgress was renamed to educationProgress.

bjarnef commented 9 months ago

@AndyButland yes, I think I have come across this issue before, but I have solved it now.

If renaming alias to something which already exists, it seems it is best to rename to something temporary first, so the original as new entities don't clash with each other.