Kotlin BuildType 'XYZ': id 'XYZ' is already used in BuildType(uuid='', id='XYZ', name='Deploy to envr') error - kotlin

I was trying to refactor my Kotlin file that contains the configuration for a TeamCity pipeline. However, I keep getting the following error:
BuildType 'KotlinExperiments_DeployToEnvironment': id 'KotlinExperiments_DeployToEnvironment' is already used in BuildType(uuid='', id='KotlinExperiments_DeployToEnvironment', name='Deploy to test')
I tried to dynamically assign an ID, but that doesn't seem to work. Here are the links to the relevant files:
.teamcity/settings.kts
.teamcity/KotlinExperiments.kt
.teamcity/_buildTypes/DeployToEnvironment.kt
What am I missing?

It appears that there was an extra } in this line which is an invalid character for an ID. TeamCity didn't really provide an accurate error. After deleting the whole and recreating it again, TeamCity provided a much better error which led me to this finding.

Related

Structural Search for log.debug(String.format.... not working as expected

I'm doing a search for the following
$Instance$.debug(String.format($Parameter$))
and found lots of instances from before we have a sensible logging framework in our project, however some calls are not being found and I don't understand what the difference is with those vs the ones that did get found. This didn't get found:
log.debug(
String.format(
"Failed to discard amendment (%s)", amendmentToDiscard.getID()),
amendment_.getFields());
Try the following template $Instance$.$MethodCall$($Parameter$):

Issues pulling change log using python

I am trying to query and pull changelog details using python.
The below code returns the list of issues in the project.
issued = jira.search_issues('project= proj_a', maxResults=5)
for issue in issued:
print(issue)
I am trying to pass values obtained in the issue above
issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
I get the below error on trying the above:
JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Could anyone advise as to where am I going wrong or what permissions do I need.
Please note, if I pass a specific issue_id in the above code it works just fine but I am trying to pass a list of issue_id
You can already receive all the changelog data in the search_issues() method so you don't have to get the changelog by iterating over each issue and making another API call for each issue. Check out the code below for examples on how to work with the changelog.
issues = jira.search_issues('project= proj_a', maxResults=5, expand='changelog')
for issue in issues:
print(f"Changes from issue: {issue.key} {issue.fields.summary}")
print(f"Number of Changelog entries found: {issue.changelog.total}") # number of changelog entries (careful, each entry can have multiple field changes)
for history in issue.changelog.histories:
print(f"Author: {history.author}") # person who did the change
print(f"Timestamp: {history.created}") # when did the change happen?
print("\nListing all items that changed:")
for item in history.items:
print(f"Field name: {item.field}") # field to which the change happened
print(f"Changed to: {item.toString}") # new value, item.to might be better in some cases depending on your needs.
print(f"Changed from: {item.fromString}") # old value, item.from might be better in some cases depending on your needs.
print()
print()
Just to explain what you did wrong before when iterating over each issue: you have to use the issue.key, not the issue-resource itself. When you simply pass the issue, it won't be handled correctly as a parameter in jira.issue(). Instead, pass issue.key:
for issue in issues:
print(issue.key)
myIssue = jira.issue(issue.key, expand='changelog')

MsTest, DataSourceAttribute - how to get it working with a runtime generated file?

for some test I need to run a data driven test with a configuration that is generated (via reflection) in the ClassInitialize method (by using reflection). I tried out everything, but I just can not get the data source properly set up.
The test takes a list of classes in a csv file (one line per class) and then will test that the mappings to the database work out well (i.e. try to get one item from the database for every entity, which will throw an exception when the table structure does not match).
The testmethod is:
[DataSource(
"Microsoft.VisualStudio.TestTools.DataSource.CSV",
"|DataDirectory|\\EntityMappingsTests.Types.csv",
"EntityMappingsTests.Types#csv",
DataAccessMethod.Sequential)
]
[TestMethod()]
public void TestMappings () {
Obviously the file is EntityMappingsTests.Types.csv. It should be in the DataDirectory.
Now, in the Initialize method (marked with ClassInitialize) I put that together and then try to write it.
WHERE should I write it to? WHERE IS THE DataDirectory?
I tried:
File.WriteAllText(context.TestDeploymentDir + "\\EntityMappingsTests.Types.csv", types.ToString());
File.WriteAllText("EntityMappingsTests.Types.csv", types.ToString());
Both result in "the unit test adapter failed to connect to the data source or read the data". More exact:
Error details: The Microsoft Jet database engine could not find the
object 'EntityMappingsTests.Types.csv'. Make sure the object exists
and that you spell its name and the path name correctly.
So where should I put that file?
I also tried just writing it to the current directory and taking out the DataDirectory part - same result. Sadly, there is limited debugging support here.
Please use the ProcessMonitor tool from technet.microsoft.com/en-us/sysinternals/bb896645. Put a filter on MSTest.exe or the associate qtagent32.exe and find out what locations it is trying to load from and at what point in time in the test loading process. Then please provide an update on those details here .
After you add the CSV file to your VS project, you need to open the properties for it. Set the Property "Copy To Output Directory" to "Copy Always". The DataDirectory defaults to the location of the compiled executable, which runs from the output directory so it will find it there.

extra-paths not added to python path with zc.recipe.testrunner

I am trying to run tests by adding a version of tornado downloaded from github.com in the sys.path.
[tests]
recipe = zc.recipe.testrunner
extra-paths = ${buildout:directory}/parts/tornado/
defaults = ['--auto-color', '--auto-progress', '-v']
But when I run bin/tests I get the following error :
ImportError: No module named tornado
Am I not understanding how to use extra-paths ?
Martin
Have you tried looking into generated bin/tests script if it contains your path? It will tell definitely if your buildout.cfg is correct or not. Maybe problem is elsewhere. Because it seem that your code is ok.
If you happen to regularly include various branches from git/mercurial or elsewhere to buildout, you might be interested in mr.developer. mr.developer can download and add package to develop =. You wont need to set extra-path in every section.

MSBuild and IgnoreStandardErrorWarningFormat

I'm trying to write a MSBuild project that will generate html documentation using doxygen. I couldn't find anything about that on the net except for one example, which seems incomplete; it doesn't parse doxygen warnings.
I found that MSBuild's Exec task has parameters like IgnoreStandardErrorWarningFormat and CustomWarningRegularExpression. What is the "Standard Error/Warning Format" and what kind of REs are allowed in these properties?
Edit: ah, "Inside the Microsoft Build Engine" wrongly describes it as property in .NET 3.5, where it is actually from 4. No use for me...
The standard msbuild error/warning format is described here.
In a nutshell, the format is:
MSBuild recognizes error messages and warnings that have been specially formatted by many command line tools that typically write to the console. For instance, take a look at the following error messages - they are all properly formatted to be MSBuild and Visual Studio friendly.
Main.cs(17,20): warning CS0168: The variable 'foo' is declared but never used
C:\dir1\foo.resx(2) : error BC30188: Declaration expected.
cl : Command line warning D4024 : unrecognized source file type 'foo.cs', object file assumed
error CS0006: Metadata file 'System.dll' could not be found.
These messages confirm to special format that is shown below, and comprise 5 parts - the order of these parts are important and should not change:
Origin (Required)
Origin can be blank. If present, the origin is usually a tool name, like 'cl' in one of the examples. But it could also be a file name, like 'Main.cs' shown in another example. If it is a file name, then it must be an absolute or a relative file name, followed by an optional parenthesized line/column information in one of the following forms:
(line) or (line-line) or (line-col) or (line,col-col) or (line,col,line,col)
Subcategory (Optional)
Subcategory is used to classify the category itself further, and should not be localized.
Category (Required)
Category must be either 'error' or 'warning'. Case does not matter. Like origin, category must not be localized.
Code (Required)
Code identifies an application specific error code / warning code. Code must not be localized and it must not contain spaces.
Text (Optional)
User friendly text that explains the error, and must be localized if you cater to multiple locales.
The format is fully documented in the MSBuild source code here.
I can't find docs on it right now, but I think the standard error format is something like
.*(\d+(,\d+(,\d+,\d+)?)?)?: error .*:.*
.*(\d+(,\d+(,\d+,\d+)?)?)?: warning .*:.*
examples:
c:\somefile.txt(10,20,10,30): error CMD1234: blarg
c:\somefile.txt(10,20): error CMD1234: yadda yadda
c:\somefile.txt: warning ARG5678: blah blah