TeamCity REST API - update 'settings' for build configuration - teamcity

I'm trying to use the TeamCity REST API to update settings against a build configuration. Specifically, the checkoutDirectory that in the UI is in the "Version Control Settings->Additional Options->Checkout directory" textbox...
The documentation talks about updating the "parameters", but not the settings.
If I do a GET on /app/rest/buildTypes/<id>, the results include both settings and parameters...
I've tried various combinations of PUT request to try to update this, but having no luck.
Interestingly, if I do a GET on /app/rest/buildTypes/<id>/parameters, I get this...
Which includes the ID in the URL.
But if I do /app/rest/buildTypes/<id>/settings, I get this...
Which doesn't include the ID. Not sure if that's a bug - or I've completely misunderstood the scope of these settings, and they're global, not per build config - but that's certainly not what I'm seeing in the UI.
Any ideas how to use the REST API to update these settings?

Related

Setting Projects to Private by Default

I have my SQ server running in Kubernetes (via Tectonic) and all is going well. We need to tighten the security of our SQ installation, so we have LDAP up and working. We are trying to get all of the projects to be Private by default (which we can do Via the GUI for each project).
However, trying to flip the switch in the GUI to make all new projects Private works, until you refresh the page, then it reverts back to Public.
I have been searching for a way to set this up via the sonar.properties file or sonar-project.properties file (first if the preferred). The server.properties file we use is encrypted as a secret (because the LDAP settings exposes a service account password) and I would like to keep settings there.
I have combed through documentation, posts, discussions and all that, but have not been able to find out what the value=key combination is.
Has anyone seen what this is or if we can even accomplish that? Is it a setting stored in the database? I'm kind of at a loss on this one.
Thanks!
In SonarQube 7.x you can find the public/private setting when you browse to Administration - Projects - Management. This only works for new projects. For existing projects you can use the "Edit the permissions" option on the same page and switch between public and private.
You can also use the web_api to achieve the same results. You can find the documentation when you add "/web_api/api/projects" after the sonarqube URL:
Example of the POST request body: project=MyProject&visibility=private

Retrieve Test settings using Rest API from TFS

How can i retrieve Test settings using Rest API from TFS.
The below mentioned URL is the best i can get . but this is for Test result retention setting...... and what i am looking for is regular/ general Test settings.
Can some one please provide a sample URL for it.
Sample URL:- https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam/_apis/test/resultretentionsettings?api-version=2.0-preview"
If you mean the test settings file (See Specifying Test Settings for Visual Studio Tests), then you can get and open the file from web portal to check the settings.
If you mean Test configurations, you can refer to this link for the REST API : Test configurations:
e.g.: To Get a test configuration:
GET https://{instance}/DefaultCollection/{project}/_apis/test/configurations/{configurationId}?api-version={version}
Whatever, all the available test REST APIs are all here: Test Management
UPDATE:
According to your clarification (below answer), you just want to get the specific test run details. You can use below REST API to Get a test run:
GET http://{instance}/DefaultCollection/{project}/_apis/test/runs/{run ID}?api-version={version}
Then you will see all the settings/properties of the specific test run.
No what I really meant for was the "Test Settings" information. In MTM, we can specify the TestSettngs via TestSettings Manager.( See the below image.)
While creating a test run, we need to provide this "Test Settings" information.
Next, coming to REST API, we can create a test run using REST API too.
The below is the API reference url.
https://www.visualstudio.com/en-us/docs/integrate/api/test/overview
Under "Create a Test Run" section, you can see "test settings" under the content type. I wanted to know how to get that information via REST call(
Check see image 2 below)
(I am unable to embed pictures on the site as i have not earned 10 reputation points. please open the links provided below to view the images)

How can I get the open new issues, confirmed new issues, false positive new issues?

This is a screen where we configure our project, SonarQube shows new issues open, confirmed which is highlighted in yellow, I am using the SonarQube API in my application and want to dump the data to my DB. Accordingly I will create the report. But In Sonar Metrics document I do not find how could I get these value using API.
api/issues/search should get you all you need. Check out the documentation embedded in your SonarQube server (linked at the footer).
From the use-case you describe, parameters sinceLeakPeriod or createdAfter / createdInLast can help out with date filtering. Not to mention other filters like resolved and componentKeys. Exchaustive listing is in the WebAPI documentation.

See parameters that are overridden from TeamCity template

Is there a way to see TeamCity configurations that override parameter defined in template?
I don't think so. What's worked for me in the past was to search through the project files on the filesystem. If you have many build configs, this will be faster than opening each of them in the GUI.
Search for something like this:
<param name="myParamInheritedFromTemplate" value="myOverrideValue" />
in <TeamCity data directory>/config/projects/**/*.xml. If it's absent in an XML file, that build config just inherits the value. If it's present, it overrides it.
It's hacky but it's quick.
There is a feature request https://youtrack.jetbrains.com/issue/TW-21212, please vote. Current workaround are to either search the raw XML files with the settings stored under TeamCity Data Directory on the server as #sferencik suggested, or use REST API to get settings of all the build configurations and search for the parameter there. Let me know if you need help on any of these.

AppHarbor Web.config transforms not being applied

I am developing an application in ServiceStack and am trying to sort out deployment on AppHarbor, however for some reason my web.config transforms are not being applied.
I had originally a Web.AppHarbor.config file and changed the Environment Setting to "AppHarbor" - once this failed to work after several updates, I gave up and changed the Environment setting to "Release" and copied the desired transformations into the Web.Release.Config file.
App gets deployed OK but config settings do not reflect the values in the transform file (I verify this by login on with twitter and seeing the callback url for Twitter Auth still tries to redirect me to localhost, which is one of the settings I change in my transform file)
I have also tried the transform tester tool and all works as expected.
Manually publishing the web application to a local folder correctly applies the transformations according to the selected configuration
Does anyone have this working? Is there something obvious I'm missing?
Thanks
It sounds like the Web.Release.config file is not included in the build output. You need to set the Build Action attribute to Content to include it in the build output.
You can confirm whether the file is included in the output by downloading the build from the log page.
I stumbled across this post because I was seeing the same lack of action myself. Upon closer inspection (about 15 times that is) of my Web.Release.config I realized one of the nodes in my config file was not marked xdt:Transform="Replace". Unsurprisingly it did nothing when deployed.

Resources