I am getting the following error for most of the clearcase activities, like labeling, checkout etc.
cleartool: Error: Error from VOB database: "\11.3.0".
cleartool: Error: Trouble finding the global definition for local type "???".
cleartool: Error: Trouble applying label to
Some times it is going on, but most often failing with this error. Above is the error while applying a label. Please suggest
Following the technote "Fixing broken hyperlinks with Administrative VOBs", check if you don't have a missing hyperlink between your vob and your admin vob (which, if you are using UCM, should be a PVob).
An AdminVOB is a normal VOB that will be principally used to store globally defined metadata types (branch, label, attribute, elements and hyperlinks). See here for more.
Example of resolution (here in the case of a global type being a branch):
cleartool unlock vob:\ClientVOB
cleartool describe -long vob:\ClientVOB
Hyperlinks:
AdminVOB#53#\ClientVOB -> <object not available>
cleartool describe -local -long brtype:MyBranch#\ClientVOB
GlobalDefinition#54#\ClientVOB -> <object not available>
cleartool checkvob -hlink vob:\ClientVOB
cleartool describe -local -long brtype:MyBranch#\ClientVOB
cleartool checkvob -hlink brtype:MyBranch#\ClientVOB
cleartool mkhlink AdminVOB vob:\ClientVOB vob:\AdminVOB3
cleartool mkbrtype -global -acquire MyBranch#\AdminVOB3
Doing all of this can be very lengthy in a case where numerous metadata types are broken, especially when it has to be done in all VOBs.
This could be scripted to automate the process.
Another cause: technote "Deleted user accounts and ClearCase performance":
A user account that no longer exists, but is still listed in the -nusers option for cleartool lock of a branch can cause a checkout, checkin and merge to fail like:
So if you have a lock on a branch, that can also be an issue.
Related
I want to list all available plugins names and their short names using command line option, so that I could automate required plugin installation through jenkins command line.
Kindly advise. Thanks
So far I tried to find answer on same however I got answer only for how to list installed plugins, not for all available plugins.
I've found this link http://updates.jenkins-ci.org/download/plugins/ which lists all plugins but with their short names only
You were so close! The LAYOUT is detailed here. The information is nearby for you to parse, hopefully I got it right.
http://updates.jenkins-ci.org/download/plugins/ is indeed the location of the plugins, with the actual plugin versions sitting inside each folder.
https://updates.jenkins.io/ is the root level. You will find the list of all plugins and details at plugin-versions.json.
update-center.js, update-center.json, and update-center.json.html contain actual update center metadata in JSON, JSONP, and HTML format respectively. You can parse the json to pull everything you are looking for. There are also lists for the documentation url and the release history, as well as the updates.
This is where it's nuanced; there's stable (ie:LTS) or latest (ie:weekly) and major releases of each. Each one has its own sublist, depending on minimum version and compatibility.
Plugin Selection
Since none of this tells you what the plugins actually do, the best thing is to choose your plugins at https://plugins.jenkins.io/. Clicking on any plugin (eg: mailer) reveals a header block with details:
Mailer 1.23
Minimum Jenkins requirement: 1.642.3
ID: mailer
The ID is the short name you are looking for. Go through and find the plugins you want to use and that's your list. Don't worry about the dependencies.
About Plugin Management
Even on a standalone instance, I use a modified script of Docker install_plugins.sh to generate the full list of plugins to install .
Update 2021: As part of GSOC 2019 and refined in GSOC 2020, a new and quite functional Plugin Installation Manager CLI Tool has been introduced to replace all non-GUI plugin mgmt tools, including inatall_plugins.sh. Achieves similar results.
You can examine the outputs or use the groovy script that follows to simplify your "must have" list. Also, as dependency updates happen all the time, I also generate a list of actual installed updates if I need to reapply identically to a different instance rather than from my curated list. My curated list is ~45 plugins, with over 115 getting installed.
eg: workflow-api includes [workflow-scm-step] which includes [git, subversion], so no need to specify git. But you want to know which version you got. Occasionally you may need to explicitly add a dependency to get the latest to avoid a defect, per JENKINS-54018, plugins which were split from Jenkins.
println "Jenkins Instance : " + Jenkins.getInstance().getComputer('').getHostName() + " - " + Jenkins.getInstance().getRootUrl()
println "Installed Plugins: "
println "=================="
Jenkins.instance.pluginManager.plugins.sort(false) { a, b -> a.getShortName().toLowerCase() <=> b.getShortName().toLowerCase()}.each { plugin ->
println "${plugin.getShortName()}:${plugin.getVersion()} | ${plugin.getDisplayName()} "
}
println""
println "Plugins Dependency tree (...: dependencies; +++: dependants) :"
println "======================="
Jenkins.instance.pluginManager.plugins.sort(false) { a, b -> a.getShortName().toLowerCase() <=> b.getShortName().toLowerCase()}.each { plugin ->
println "${plugin.getShortName()}:${plugin.getVersion()} | ${plugin.getDisplayName()} "
println "+++ ${plugin.getDependants()}"
println "... ${plugin.getDependencies()}"
println ''
}
return
I have setup Jenkins to run pylint on all python source files and all the log files are generated (apparently correctly) into a sub-directory as follows:
Source\pylint_logs\pylint1.log, pylint2.log, ..., pylint75.log
I have included a --msg-template definition based on the instructions on my Jenkins Configure page: Post-build Actions->Record compiler warnings and static analysis results->Static Analysis Tools. The template is shown as:
msg-template={path}:{line}: [{msg_id}, {obj}] {msg} ({symbol})
An example of one of the log files being generated by Jenkins/pylint is as follows:
************* Module FigureView
myapp\Views\FigureView.py:1: [C0103, ] Module name "FigureView" doesn't conform to snake_case naming style (invalid-name)
myapp\Views\FigureView.py:30: [C0103, FigureView.__init__] Attribute name "ax" doesn't conform to snake_case naming style (invalid-name)
------------------------------------------------------------------
Your code has been rated at 8.57/10 (previous run: 8.57/10, +0.00)
For the PyLint Report File Pattern, I have: Source/pylint_logs/pylint*.log
It appears that PyLint Warnings is parsing the files because the console output looks like this:
[PyLint] Searching for all files in 'D:\Jenkins\workspace\PROJECT' that match the pattern 'Source/pylint_logs/pylint*.log'
[PyLint] -> found 75 files
[PyLint] Successfully parsed file D:\Jenkins\workspace\PROJECT\Source\pylint_logs\pylint1.log
[PyLint] -> found 0 issues (skipped 0 duplicates)
[PyLint] Successfully parsed file D:\Jenkins\workspace\PROJECT\Source\pylint_logs\pylint10.log
[PyLint] -> found 0 issues (skipped 0 duplicates)
This repeats for all 75 files, even though there are plenty of issues in the log files.
What is odd, is that when I was first prototyping the use of Jenkins on this project, I set it up to just run pylint on a single file. I ran across another StackOverflow post that showed a msg-template that allowed me to get it working (unable to get pylint output to populate the violations graph). I even got the graph to show up for the PyLint Warnings Trend. I used the following definition per the post:
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
Note that this format is slightly different from the one recommended by my Jenkins page (shown earlier). Even though this worked for a single file, neither template now seems to work for multiple files, or else there is something other than the template causing the problem. My graph has flat-lined, and I always get 0 issues reported.
I have had trouble finding useful documentation on the Jenkins PyLint Warnings tool. Does anyone have any ideas or pointers to documentation I can research further? Thanks much!
Ensure pass output-format parameter in pylint command. Example:
pylint --exit-zero --output-format=parseable module1 module2 > pylint.report
you have to set the Pylint's option --message-template in .pylintrc as
msg-template={path}: {line}: [{msg_id} ({symbol}), {obj}] {msg}
output-format=text
I have Jenkins (v2.163) installed and I'm using the plugins email-ext as well as the token macro plugin.
The documentation page of the token macro plugin (https://wiki.jenkins.io/display/JENKINS/Token+Macro+Plugin) tells me that a couple of plugins (that I'm using) like PMD, Warnings, Checkstyle, etc. produce tokens which are also listed on the project configuration page when I click on "Content Token Reference".
Some of the tokens I like to use are CHECKSTYLE_COUNT or PMD_COUNT.
My mail-content for the email-notification looks like this:
Branch: ${GIT_BRANCH}
$DEFAULT_CONTENT
Checkstyle issues: ${CHECKSTYLE_COUNT} (${CHECKSTYLE_NEW} new, ${CHECKSTYLE_FIXED} fixed)
Duplicate code issues: ${DRY_COUNT} (${DRY_NEW} new, ${DRY_FIXED} fixed)
Mess Detector issues: ${PMD_COUNT} (${PMD_NEW} new, ${PMD_FIXED} fixed)
Failed tests:
${FAILED_TESTS}
But all token that are supposed to be filled be the corresponding plugins stay empty (while others are filled), so the resulting mail looks like this:
Branch: origin/stage
PROJECT - Build # 1 - Successful:
Check console output at http(...) to view the results.
Checkstyle issues: ( new, fixed)
Duplicate code issues: ( new, fixed)
Mess Detector issues: ( new, fixed)
Failed tests:
No tests ran.
Am I missing a specific configuration for the tokens to be set?
I'm trying to write a build step within TFS that relies on knowing where the Build agent has nuget.exe stored (the standard nuget-install step mucks around with the order of arguments in a way that breaks build execution, so I want to run the exe myself using one of the batch/shell/ps steps).
It would seem that setting up a capability on the Build Agent with that path would make sense, but I cannot seem to reference the value in any of my build steps, and I cannot find anything helpful on MSDN.
I'm expecting it to be something like $(Env.MyUserCapability), but it never resolves to the value.
Is it possible to retrieve a capability value within a build step? And if so, how do you do it? And if not, what is a viable alternative?
The user-defined capabilities are metadata only. But you can set a global environment variable (e.g. NUGET) and set that to a path to a nuget.exe, when you restart the agent, the machine-wide environment is then discovered as capability and you can then use it.
If you are writing a custom task, you can also add a nuget.exe to the task that will be downloaded to the executing agent.
UPDATE: I made a public extension out of this.
UPDATE: this works in Azure DevOps 2019.
In TFS 2018u1, the following works:
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Common"
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
Add-Type -Assembly "Microsoft.TeamFoundation.DistributedTask.WebApi"
$VSS = Get-VssConnection -TaskContext $distributedTaskContext
$AgentCli = $VSS.GetClient([Microsoft.TeamFoundation.DistributedTask.WebApi.TaskAgentHttpClient])
$AgentConfig = Get-Content "$Env:AGENT_HOMEDIRECTORY\.agent" -Raw | ConvertFrom-Json
$Agent = $AgentCli.GetAgentAsync($AgentConfig.PoolId, $Env:AGENT_ID, $TRUE, $FALSE, $NULL, $NULL, [System.Threading.CancellationToken]::None).GetAwaiter().GetResult()
if($Agent.UserCapabilities.MyCapability)
{
Write-Host "Got the capability!";
}
The long string of default arguments ending with CancellationToken::None is for compatibility with Powershell 4. PS4 doesn't support default values for value-typed method parameters, PS5 does.
This snippet does something very questionable - it relies on the location and the structure of the agent configuration file. This is fragile. The problem is that the GetAgentAsync method requires both pool ID and the agent ID, and the former is not exposed in the environment variables. A slightly less hackish approach would check all pools and find the right one by the agent ID:
$Pools = $AgentCli.GetAgentPoolsAsync($NULL, $NULL, $NULL, $NULL, $NULL, [System.Threading.CancellationToken]::None).GetAwaiter().GetResult()
$Demands = New-Object 'System.Collections.Generic.List[string]'
foreach($Pool in $Pools)
{
$Agent = $AgentCli.GetAgentsAsync($Pool.ID, $Env:AGENT_NAME, $TRUE, $FALSE, $NULL, $Demands, $NULL, [System.Threading.CancellationToken]::None).Result
if($Agent -and $Agent.Id -eq $Env:AGENT_ID)
{
Break
}
}
This relies on another undocumented implementation detail, specifically that agent IDs are globally unique. This seems to hold as late as TFS 2018, but who knows.
When you employ the $distributedTaskContext, the task is connecting back to TFS with an artificial user identity, "Project Collection Build Service" (not with the agent service account). There's one user like that in each collection, they're distinct. In order to allow tasks running in releases in a collection to query the agent for user capabilities, you need to grant the Reader role to the relevant pool(s) (or all pools) to the user account called "Project Collection Build Service (TheCollectionName)" from that collection.
It also looks like some actions also grant an implicit Reader role on a pool to the task identity.
Alternatively, you can construct a VssConnection from scratch with Windows credentials, and grant the agent account(s) Reader role on the pool(s).
From within Visual Studio I try to commit to a tfs repository. I can use the Server Browser and update my sources. But when I click onto "pending changes" I receive the following error:
System.ComponentModel.Composition.CompositionException: The
composition produced a single composition error. The root cause is
provided below. Review the CompositionException.Errors property for
more detailed information.
1) Cannot create an instance of type
'Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException'
because a constructor could not be selected for construction. Ensure
that the type either has a default constructor, or a single
constructor marked with the
'System.ComponentModel.Composition.ImportingConstructorAttribute'.
Resulting in: Cannot activate part
'Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException'.
Element:
Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException
--> Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException
Resulting in: Cannot get export
'Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException
(ContractName="Microsoft.TeamFoundation.Controls.ITeamExplorerSection")'
from part
'Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException'.
Element:
Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException
(ContractName="Microsoft.TeamFoundation.Controls.ITeamExplorerSection")
--> Microsoft.TeamFoundation.VersionControl.Controls.LabelSaveException
at
System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine
engine, ComposablePart part, ExportDefinition definition) at
System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(CatalogPart
part, ExportDefinition export, Boolean isSharedPart) at
System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.Primitives.Export.get_Value()
at
System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export
export) at
System.ComponentModel.Composition.ReflectionModel.ExportFactoryCreator.LifetimeContext.GetExportLifetimeContextFromExport[T](Export
export) at
System.ComponentModel.Composition.ReflectionModel.ExportFactoryCreator.<>c__DisplayClass72.<CreateStronglyTypedExportFactoryOfTM>b__6()
at System.ComponentModel.Composition.ExportFactory1.CreateExport()
at
Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework.TeamExplorerSectionHost.Create()
I CAN still check in my changes, but the "comment" area is missing. How to solve this?
(UPDATE): I receive the same error when I try to display the "Changeset Details"
But no Error when displaying the History