Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    ProGet: Different behavior for build creation

    Scheduled Pinned Locked Moved Support
    9 Posts 2 Posters 28 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      caterina
      last edited by

      Hi,

      there are two possibilities to create a build in a project in ProGet 2024.
      I can select between "Create Build" and "Import SBOM".
      c304e72b-5fc3-49db-9daf-74c7b3ef24e3-image.png

      I was interested in what would happen if I create a build with the same version twice.
      Both of those options create a new build but with a different behavior.

      If I select "Create Build" to create e.g. build 1.0.0 and I do this a second time I get an error:
      4d077e6d-15db-4b7d-9073-078019430d3c-image.png

      If I select "Import SBOM" to create build 2.0.0 and I do this a second time, the first build gets deleted and overwritten I think. Because if build 2.0.0 is in another stage and I try to import the SBOM to my default stage, the build is available in the default stage and no longer in the other stage.

      Shouldn't these two options behave the same?

      If we use pgutil to import a SBOM we would prefer that previous builds would not be overwritten. It should no happen that a build with the same version gets created twice, but sometimes mistakes happen. In this case the previous build should not be deleted without a warning.

      Can you please have a look into this szenario? Maybe we can also discuss what would be the best behavior for pgutil in this case.

      Thanks
      Caterina

      1 Reply Last reply Reply Quote 0
      • C Offline
        caterina
        last edited by

        Edit:

        If I first use "Create Build" to create build 3.0.0 and afterwards "Import SBOM" to create build 3.0.0 I have two builds with version 3.0.0 in my project.
        The same happens if I do it vice versa.

        1 Reply Last reply Reply Quote 0
        • atrippA Offline
          atripp inedo-engineer
          last edited by

          Hi @caterina ,

          Sorry on the slow reply, I swear I replied to this.... but clearly not.

          As you can see from the 500/crash error (which we should obviously not do), there is a data constraint that prevents two builds within the same project and release from having the same number. Specifically, the constraint is <Project_Id, Release_Number, Build_Number>; so it's not possible to have build 3.0.0 twice -- but maybe it's in a different project or release.

          As far as "Import SBOM" vs "Create Build", the Import SBOM will create a Project (based on the Component name) and a Build (based on the Version) if it does not exist. Then, it adds the packages within the SBOM Document to the build's list of packages, and then adds the SBOM document itself to the build's SBOM documents.

          When importing an SBOM, nothing is deleted; it's always added. As you've seen, Create Build will definitely error out if the build already exists.

          Hope that helps clarify,

          Alana

          1 Reply Last reply Reply Quote 0
          • C Offline
            caterina
            last edited by caterina

            Hi @atripp,

            to be honest, I am still confused. Let me explain my approach in more detail:

            So I created a test project which does not contain any builds yet:
            630820af-5644-4c14-80d5-138e252fc7b7-image.png
            I want to add build 1.0.0 to this project. To do so, I upload an SBOM file containing the information about version 1.0.0. I also promote this version to the stage "Release":
            2d973bc6-90b4-4606-985e-edf695f2e74c-image.png
            Now the worst case scenario happens. After months someone uploads a different sbom with version 1.0.0 to this project. I can confirm that the information from the "new" sbom gets added. But the build is also moved back to the stage "Build":
            e7a25898-06c3-4cba-b5d5-d7edbeef579a-image.png
            I would expect that the build remains in its stage. But maybe you have a valid reason to do it like this?

            So now I used "Create Build" from the dropdown to manually create version 1.0.0 again, which leads to two versions 1.0.0:
            581939e7-a20c-4f9d-a5e3-b7d35ee9d6fc-image.png
            If I now upload a SBOM for version 1.0.0 only the first version 1.0.0 gets modified. The second, manually created version 1.0.0 remains unchanged.

            Further, I created a version 2.0.0 manually using "Create Build". Then I uploaded a SBOM for version 2.0.0, which again results in two builds with version 2.0.0:
            20ee196b-5ae5-4673-abff-e3096b2c084a-image.png
            As far as I understood your explanation, uploading a SBOM should have added the information to the already existing build 2.0.0 instead of creating a new build?

            You also said that the constraint for duplicates is <Project_Id, Release_Number, Build_Number>.
            So for versions 1.0.0 the Project_Id as well as the Build_Number are the same. The Release_Number is empty for both builds (or not set):
            ff2c5814-96e8-4dde-b64f-37050822600b-image.png
            Maybe that's a problem leading to having a build twice? But this seems to be the default when using pgutil to create and upload a SBOM. I am not really sure how this Release_Number property should be used and how it is set using pgutil.

            But if this behavior is on purpose maybe you can again explain to me why?

            Thanks
            Caterina

            atrippA 1 Reply Last reply Reply Quote 0
            • atrippA Offline
              atripp inedo-engineer @caterina
              last edited by

              Hi @caterina ,

              Thanks for the additional detail.

              So I investigated this a little further, and now I see there's a bug in the method that imports the SBOM file - basically it's just overwriting the Stage Name with "Build". That's not intentional.

              It looks like the BuildStatus_Code is also reset to Active. I'm not sure if that should be the case; maybe an inactive build should not allow a new sbom added... what do you think 🤔

              As for the duplicates, we know it's not possible to enter a row in the table with a constraint, so it means there's either whitespace in the buildnumber (two different builds) or there's an incorrect join (build displayed twice).

              Just take a look at the projectBuildId querystring parameter for the "2.0.0" builds -- that will clue us in to which case it is.

              If it's whitespace, we'll have to figure out where it could be added -- and just trim before adding to database

              Thanks,
              Alana

              1 Reply Last reply Reply Quote 0
              • C Offline
                caterina
                last edited by

                Hi @atripp,

                I think uploading a SBOM should not modify other metadata of a build (e.g. Build Stage, BuildStatus). I also can't see a usecase where it would be necessary to updoad a SBOM for an inactive build. Even if you do not prevent it, it should not change the BuildStatus I guess 🤔 .

                For the duplicates: those are indeed two different builds. I can also see it in the database:
                99441cfd-b36c-4940-9649-71a31dc51bb6-image.png
                The difference here is Release_Number. If a build gets created via SBOM the Release_Number is NULL. If I use "Create Build" the Release_Number is empty. Both Build_Number are the same. None of it containes a whitespace.

                Best,
                Caterina

                atrippA 1 Reply Last reply Reply Quote 0
                • atrippA Offline
                  atripp inedo-engineer @caterina
                  last edited by

                  Hi @caterina ,

                  Thanks for investigating this! I just made the following changes via PG-2818:

                  • do not update Stage, Status upon import of SBOM
                  • set Release Null when editing build (not empty string)
                  • validate build number is unique

                  This will go in the next maintenance release, shipping next Friday

                  Thanks,
                  Alana

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    caterina
                    last edited by

                    Hi @atripp,

                    I was able to test the new version of ProGet and there still seems to be a weird behavior.

                    Again I am using my test-project 'BuildStageTest'. I deleted all existing builds to give it a "fresh start".
                    Creating a build via SBOM upload seems to be working fine. This way I created build 1.0.0:
                    603dd26c-a53d-41b3-880b-282f4656bc50-image.png
                    fcd0ad29-f118-4be9-a35a-03c061e2c9fd-image.png
                    As you can see, there are no other builds in my project.

                    If I try to create the same version via "Create Build" you display an error (which is great):
                    6f1fa1b4-39d3-4c59-8258-82d9659cc6c3-image.png

                    But if I try to manually create build 2.0.0 I get the same error even if the build is not existing:
                    41ccfa37-3fdc-48be-983b-9265f4ef840c-image.png

                    I thought that there might be an issue because build 2.0.0 already existed in previous tests. But I deleted all builds as you can see from the ui and the database screenshots above.
                    So I also created a completely new project and tried to manually create builds. But for some versions i do get the error message (I was not able to manually create 1.0.0, 2.0.0, 4.0.0, but some other versions were working just fine):
                    e6a8bd63-703e-48e0-af71-de336520e5aa-image.png
                    Are you able to reproduce this behavior?

                    Thanks,
                    Caterina

                    1 Reply Last reply Reply Quote 0
                    • atrippA Offline
                      atripp inedo-engineer
                      last edited by

                      Hi @caterina ,

                      This will be fixed in the next maintenance release via PG-2829. I just checked in the change.

                      I made a mistake when making the original change, and used the ProjectBuildId instead of the ProjectId when validating the if other builds exists. So it works if the Ids match perfectly (like when I tested it).

                      Note this only impacts the UI, and we don't really expect users to create builds via the UI.

                      Thanks,
                      Alana

                      1 Reply Last reply Reply Quote 0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • 1 / 1
                      • First post
                        Last post
                      Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation