deterministicAppIDs handles setting agent app ids to something deterministic. In plan files, ids are not present. In state files, they are. It is simpler for comparisons if we just set it to something deterministic.
(resources []*proto.Resource)
| 1866 | // In plan files, ids are not present. In state files, they are. |
| 1867 | // It is simpler for comparisons if we just set it to something deterministic. |
| 1868 | func deterministicAppIDs(resources []*proto.Resource) { |
| 1869 | for _, resource := range resources { |
| 1870 | for _, agent := range resource.Agents { |
| 1871 | for _, app := range agent.Apps { |
| 1872 | data := sha256.Sum256([]byte(app.Slug + app.DisplayName)) |
| 1873 | id, _ := uuid.FromBytes(data[:16]) |
| 1874 | app.Id = id.String() |
| 1875 | } |
| 1876 | for _, dc := range agent.Devcontainers { |
| 1877 | for _, app := range dc.Apps { |
| 1878 | data := sha256.Sum256([]byte(app.Slug + app.DisplayName)) |
| 1879 | id, _ := uuid.FromBytes(data[:16]) |
| 1880 | app.Id = id.String() |
| 1881 | } |
| 1882 | } |
| 1883 | } |
| 1884 | } |
| 1885 | } |
no test coverage detected