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!

    Via HTTP Post, unable to promote ProGet package

    Scheduled Pinned Locked Moved Support
    buildmasterproget
    20 Posts 2 Posters 69 Views
    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.
    • ? This user is from outside of this forum
      Guest
      last edited by

      I would look at the response body error message; if it has HTML in it, then the problem is integrated security. But if you can install NuGet packages (or otherwise access the server from BuildMaster), then that's not the problem. When WIA is enabled, IIS will block all requests without authentication before it even gets to ProGet.

      That said, the API does not pay attention to the user; only the API key is used. That API key must be configured to allow for this sort of access under Admin > API KEys.

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        Alana,
        I can publish to ProGet from Buildmaster all the time so it's only doing this API for promoting that isn't working.
        The response body is HTML.

        The API key I had setup for just Promotion API access but I just changed to allow unrestricted access, still didn't work.

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          Is there any information of note in Admin > Security & Authentication > API Keys & Access Logs > Access Logs tab in the ProGet instance? The request and response bodies of any API request should be logged there.

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            Nothing is being logged there unless i just go to the web browser and try the /api/promotions/promote url directly. Then an error gets logged about needing the API key.
            When I run it from the Buildmaster post function, nothing is logged. It's like something is preventing it from connecting to that server yet there is nothing setup to do so.

            No firewalls on either system. Buildmaster can push/pull from ProGet feeds just fine. It's just this method that isn't working for some reason.

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              some more info, I tried just using a Post with all the params in the URL as per your doc page for urlencoded, that didn't work either.

              So I went ahead and did it directly in the web browser and now get a better error. It's saying now that the API does not permit access to Package Promotion API yet this is the URL I used:

              http://progetserver/api/promotions/promote?key=realapikey&packageName=Sci.Framework.Service.Sm.Core&version=41.0.0&fromFeed=Development&toFeed=Released&user=username&comments=This+package+promoted+to+Release+by+BuildMaster

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                Meant to add to the above, in the access log it looks like the API key is the problem. It has a Plus sign in the middle so it's seen as a space in it.
                I tried replacing the plus sign in the api key with %2b but then I get a Method Not Supported error.

                1 Reply Last reply Reply Quote 0
                • ? This user is from outside of this forum
                  Guest
                  last edited by

                  Yes, any query string arguments need to be URL encoded. The method not supported error is expected because that endpoint only allows HTTP POST. You'll have to use something like Fiddler or Postman to do a POST. As a tip, when I do test POSTs in Fiddler, I always capture a GET request to the URL then drag the captured request to the Composer tab, where it can be converted to a POST... a lot easier than creating the request from scratch :)

                  I also notice Alana's example has ContentType: application/json, when it should be application/x-www-form-urlencoded if you're sending key-value pairs with FormData.

                  If you wanted to send JSON, you'd have to send that as TextData and build the JSON object as a string e.g.

                  TextData: >> {
                    fromFeed: "fromFeedName",
                    toFeed: "toFeedName",
                    ... etc
                  }>>
                  
                  1 Reply Last reply Reply Quote 0
                  • ? This user is from outside of this forum
                    Guest
                    last edited by

                    Tod,
                    I was trying the URL directly based on the ProGet promotion API doc that showed that so if that isn't supported you may want to update the doc. Also a bit more detailed example there might be helpful. Of course the ultimate solution would be to just add a Promote Build function to the ProGet extension in BuildMaster! I've already submitted a feature request for that one.

                    Anyway, I tried what you said and still hit the same error. I'll try it in Fiddler when I can but I could only try it from BuildMaster at the moment. Here's what I put in:

                            Post-Http http://progetserver/api/promotions/promote
                            (
                                ContentType: application/json,
                                TextData: >> { 
                                    key: "apikeyvalue",
                                    packageName: "Sci.Framework.Service.Sm.Core",
                                    version: "41.0.0",
                                    fromFeed: "Development",
                                    toFeed: "Released",
                                    user: "adminuseraccount",
                                    comments: "This package promoted to Release by BuildMaster"
                                }>>,
                                LogRequestData: true,
                                LogResponseBody: true
                            );
                    

                    Thanks.

                    1 Reply Last reply Reply Quote 0
                    • ? This user is from outside of this forum
                      Guest
                      last edited by

                      We will add that operation at some point. The problem is that the API doesn't send 401s (all forbidden API keys result in a 403). The 401s are coming from IIS or the integrated web server before the request goes through PG - so my only guess is that the BuildMaster service account must not have access to the ProGet server. Note the HTTP operations currently run from the BuildMaster server only, so executing in a for server block will still be sent from the BuildMaster service (this will likely change in a future InedoCore extension as it's a bit counter-intuitive).

                      Another thing I noticed is that the JSON representation doesn't support the key argument. You can either supply "API_Key": "yourApiKey" in the JSON, or add a new operation argument RequestHeaders: %(X-ApiKey: "yourApiKey") that doesn't need to be escaped.

                      Unfortunately with Windows Integrated Auth, it cannot be disabled for some URLs... it's all or nothing (though we're working on a resolution to this currently, especially for npm which doesn't support WIA at all).

                      1 Reply Last reply Reply Quote 0
                      • ? This user is from outside of this forum
                        Guest
                        last edited by

                        Tod,
                        the buildmaster server has full access to our ProGet server, the user each service runs as is the same domain account and it is full system admin on both as well.

                        I did try moving the API key to the Request Headers as you suggested but still get the exact same error.

                        Both servers are using the IIS setup done by BuildMaster and ProGet installers, are there any new settings that need to be made for it that may not have occurred in an upgrade?

                        Thanks.

                        1 Reply Last reply Reply Quote 0
                        • ? This user is from outside of this forum
                          Guest
                          last edited by

                          The 401s are occurring before the request reaches the API (it's blocked by the web server), so it doesn't really matter what conent you are sending.

                          Unfortunately, sometimes just setting the service account to a domain account isn't enough to get integrated authentication working; I suggest to logon to the server with that service account, and then try to access the web UI. You should not be prompted for a password from the browser.

                          Windows Integrated Auth can be very complex to get working between service accounts; are these running on the same machine? Getting a machine to "talk to itself" is a challenge, and you may need to use setspn or another domain admin tool to do so.

                          1 Reply Last reply Reply Quote 0
                          • ? This user is from outside of this forum
                            Guest
                            last edited by

                            Well to add to all this, I can use the Jenkins plugin using the exact same account without issue. It's using the Native API I believe, at least that's which API Key it has but it does work.
                            For some reason this seems to only be an issue from BuildMaster.

                            I'm not familiar with this SetSPN but after reading it I'm not to sure what we're trying to do with it. The account being used is what both Windows services are running as on their respective machines. I have logged into both with that account as well.

                            You mentioned using the UI on the Proget server, which UI did you mean? Progets or BuildMaster? I did try both and did not have any issue so not sure what it was you wanted me to try.

                            The other thing is I can, from the BuildMaster server, enter the URL - http://progetserver/api/json/Connectors_GetConnectors?API_Key=nativeAPIKey
                            and that works. But from BuildMaster it does not.

                            1 Reply Last reply Reply Quote 0
                            • ? This user is from outside of this forum
                              Guest
                              last edited by

                              I can't say why Jenkins works, the problem is the client (BuildMaster service), server (ProGet website), or both. Since the application happens below the application layer, Diagnosing it is not trivial unfortunately. When WIA is enabled, all our server software "sees" is an integrated request.

                              I would also try to restart the BuildMaster machine as well, maybe that will do something the domain and service principal names.

                              If all else fails, you'll will need to monitor network traffic; you can do this by:

                              1. installing Fiddler on BuildMaster machine
                              2. running it
                              3. editing proxy settings on buildmaster to use a proxy with windows settings
                              4. stop/restart the service
                              

                              you should see requests being pushed through fiddler, then on to their destination. This will give you more insight into where the request is not being handled...

                              1 Reply Last reply Reply Quote 0
                              • ? This user is from outside of this forum
                                Guest
                                last edited by

                                Before I do that, does it matter what the App Pool runs as for each service? it will be next week before i have a chance to work with Fiddler.

                                1 Reply Last reply Reply Quote 0
                                • ? This user is from outside of this forum
                                  Guest
                                  last edited by

                                  I finally had a chance to run Fiddler and it's not showing any attempt to talk to the ProGet server via HTTP post.
                                  I see other requests occurring by BuildMaster, updates, Jira, but not the HTTP Post to promote.
                                  So for some reason BuildMaster isn't even making an attempt.

                                  1 Reply Last reply Reply Quote 0
                                  • ? This user is from outside of this forum
                                    Guest
                                    last edited by

                                    So after searching online I did find that if I Enable Anonymous Authentication on the ProGet server that this then works.
                                    However, big problem here is that this then Breaks Windows Authentication whenever you browse to the ProGet server.

                                    I would hope you have a way to configure these since they are both your products, what would I change in IIS to handle both situations?

                                    1 Reply Last reply Reply Quote 0
                                    • ? This user is from outside of this forum
                                      Guest
                                      last edited by

                                      Discussion should be moved to a new post or followed here:

                                      http://inedo.com/support/questions/6554

                                      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