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!
Access to log during plan execution
-
Is there a way from within the a execution to get the info logged so far?
What I am trying to do is loop thru installing multiple instances(customers) of a service and I want to email out a failure email should one fail while continuing to do the rest of them.
In that email I'd like be able to include the log up to that point or even have Powershell script that parses out the chunk for that failed customers instance.I guess another way, is there a way to redirect the output to a variable as well as to the screen and log. Then I could just access the variable at the point I need to.
I know the API can get the log after the fact but I'm needing to do this while the overall plan is still executing.
Product: BuildMaster
Version: 5.6.8
-
We are planning to add a function like
@ScopedLogs
that returns a list of current execution logs at some point, ultimately for the use-case that you describe. I'm not sure if that will make it into v5.7 though.In the meantime, you might be able to get away with using the log entries endpoint, you can hit the following URL with PowerShell or
Get-Http
operation:http://{buildmaster-server}/executions/logs?executionId=${ExecutionId}&level=0
Where
level
is the minimum log level; 0 = Debug, 10 = Info, 20 = Warning, 30 = Error
-
Thanks. That execution level API access should do the trick for now.
-
For some reason this isn't working for me when it is executed from BuildMaster.
I can manually put the URL into a browser and it works fine but within BuildMaster it fails with a 400 request. It says the Execution Id is bad but the URL shown in the log has the correct one and I can even use that same URL, copy and paste, in a browser and it works.I also tried using PowerShell and with that I keep getting a access denied. The user BuildMaster runs as is full admin on the server and I'm having it run on the BuildMaster server.
I also tried adding credentials via PowerShell but I'm not sure what type BuildMaster would be expecting.Any ideas?
-
I found the problem with the one using Get-Http, just a typo on my part. Oddly when I copied and pasted the browser fixed it.
Anyway, still have the issue with PowerShell - what User and Execution policy for Powershell does BuildMaster use when invoking scripts?
-
Looks like the Get-Http won't work as the save response to variable truncates the response so in the case of multiple errors, so you only ask for level=30 in the request, when you view - email for example - the variable content you only see the first error in the log regardless of when you grab the log. The rest of it is truncated.
I'm guessing that a String variable type has a limit of 256 characters, is there a way to store more into another variable type?Using PowerShell here would be very helpful but I just need to know how BuildMaster is expecting the credentials in this circumstance. I've tried using the Basic method with the Convert-Base64 method but I just keep getting access denied despite the fact I'm using the exact same credentials I use with the BM Get-HTTP method.
-
I found the issue, just didn't think about looking at the IIS settings but that clued me in.
I needed to use Windows authentication via Powershell.For those that might hit this in the future this is the piece of code that did the trick:
$pwd = ConvertTo-SecureString $userPwd -AsPlainText -Force $creds = New-Object System.Management.Automation.PSCredential($userName,$pwd) $Response = Invoke-WebRequest -URI $URL -Credential $creds