#95 rpm-build-group: use sha256 sum as the ID
Merged 4 years ago by mvadkert. Opened 4 years ago by mvadkert.
fedora-ci/ mvadkert/messages rfe-sidetag-hash  into  master

@@ -9,7 +9,7 @@ 

      },

      "artifact": {

          "type": "brew-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -9,7 +9,7 @@ 

      },

      "artifact": {

          "type": "brew-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "brew-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "brew-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "brew-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "brew-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -9,7 +9,7 @@ 

      },

      "artifact": {

          "type": "koji-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -9,7 +9,7 @@ 

      },

      "artifact": {

          "type": "koji-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "koji-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "koji-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "koji-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

@@ -17,7 +17,7 @@ 

      },

      "artifact": {

          "type": "koji-build-group",

-         "id": "selinux-update-345",

+         "id": "sha256:0f41e56a1c32519e189ddbcb01d2551e861bd74e603d01769ef5f70d4b30a2dd",

          "repository": "https://some.url/repo",

          "builds":

              [{

file modified
+20 -3
@@ -6,11 +6,28 @@ 

  

  properties:

      id:

-         description:

-             The package group is identified by assigned side-tag.

+         description: |

+             The ID is a SHA256 hash. The hash is counted as a concatenation

+             of alphabetically sorted strings of IDs (converted to string)

+             of all builds in the group.

+ 

+             For example if the builds in the sidetag have IDs 1343344

+             and 1323323, the sorted concatenation of them is

+             "1323323" + "1343344", i.e. "13233231343344". The SHA256 digest

+             from this string is prefixed with "sha256:" string.

+ 

+             Example using Python:

+ 

+                import hashlib

+ 

+                identifiers = ["1343344", "323323"]

+                concatenation = ''.join(sorted(identifiers))

+                digest = hashlib.sha256(concatenation.encode('utf-8').hexdigest())

+ 

          examples:

-             - selinux-update-345

+             - sha256:fc5883ecb0bd9086b73aa27878682e44bf14f561eefc28b2727089ea4d3223a7

          type: string

+         pattern: "sha256:[A-Fa-f0-9]{64}"

      type:

          description:

              Artifact type.

As discussed on the UMB stakeholder meeting, we need to change
the ID to something "unique".

Described how the hash is counted and fixed all examples.

Signed-off-by: Miroslav Vadkerti mvadkert@redhat.com

Metadata Update from @mvadkert:
- Pull-request tagged with: review-needed

4 years ago

"a sum of alphabetically sorted strings"?

Maybe should be "concatenation" of strings?

In python:

import hashlib

identifiers = ["1343344", "323323"]
concatenation = ''.join(sorted(identifiers))
digest = hashlib.sha256(concatenation.encode('utf-8').hexdigest()

Using empty separator in the concatenation could theoretically lead to conflicts. E.g. this would conflict with builds "134334"+"4323323".

Using empty separator in the concatenation could theoretically lead to conflicts. E.g. this would conflict with builds "134334"+"4323323".

Oh, actually, if the ID are sorted, this particular case would be OK, but there is conflict with e.g. "123"+"456" and "12"+"3456". But these are synthetic IDs, not sure if it can happen in real world.

Seems like this should not happen, builds should be very close to each other ...

rebased onto ef4ba206e3784a32f69ef7726ed286b03379dff4

4 years ago

@msrb @lholecek @ralph sorry for the delay, updated to "concatenation of sorted strings" ....

rebased onto 2c47f2e9e226217480b461d295cca2e470b68b44

4 years ago

There is a syntax error in this Python example - missing closing parenthesis

rebased onto e7ec628

4 years ago

There is a syntax error in this Python example - missing closing parenthesis

thanks, fixed!

Any other issues here? I think we may be good to go.

Metadata Update from @mvadkert:
- Pull-request untagged with: review-needed
- Pull-request tagged with: review-done

4 years ago

Pull-Request has been merged by mvadkert

4 years ago

yep, merged, thank you all!