"inputs":[
{
"name":"PathtoPublish",
"type":"string",
"label":"Path to publish",
"defaultValue":"$(Build.ArtifactStagingDirectory)",
"required":true,
"helpMarkDown":"The folder or file path to publish.",
"visibleRule":"CommandType = Upload"
},
in this custom task i created, Path to publish will always be $(Build.ArtifactStagingDirectory), so what I'm trying to do is to hide this so it doesn't show up in the task. I'm not sure if there is an attribute to HIDE IT, i tried adding HideInput: true
"inputs":[
{
"name":"PathtoPublish",
"type":"string",
"label":"Path to publish",
"defaultValue":"$(Build.ArtifactStagingDirectory)",
"required":true,
"helpMarkDown":"The folder or file path to publish.",
"visibleRule":"CommandType = Upload",
"HideInput": true
},
According to the task.json schema, there isn't such an attribute to hide the input string $(Build.ArtifactStagingDirectory).
We can only use the visibleRule property to control the full visibility of the input label.
In your scenario, you have set "visibleRule":"CommandType = Upload", that means the input Path to publish will be displayed only when the Upload command type is selected.
Another related thread for your reference : Azure DevOps extension custom UI. Hope that helps.
Related
Consider a situation where people work together on the same code base; c++ with cmake. Code base depends on a library, that must be installed separately.
Each user may have the library in a different location. A user may invoke cmake like this:
cmake -DCMAKE_PREFIX_PATH=/path/for/that/user .
However, this is not very easy in all circumstances (e.g. windows and visual studio), and requires retyping. So instead, we have
list(APPEND CMAKE_PREFIX_PATH "/path/for/user")
In the CMakeLists.txt. This works, but requires people to constantly change that path after pulling a branch, which is annoying and easily forgotten. Is it possible to configure in a way that pulling new branches does not override this path, once set on a specific machine?
You can have each of your users create their own CMakeUserPresets.json file, and set it in the cacheVariables field of a configurePresets entry.
// CmakeUserPresets.json
{
"version": , // pick one
"cmakeMinimumRequired": {
"major": , // pick one
"minor": , // pick one
"patch": // pick one
},
"configurePresets": [
{
"name": "starball",
"displayName": "Starball's config",
"description": "Starball's private configuration preset",
"generator": "...",
"binaryDir": "...",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "..."
},
"environment": {}
}
],
// ...
}
Make sure to put CMakeUserPresets.json in your .gitignore file (or whatever else you have to do for your specific VCS so that the user preset file isn't tracked in the VCS).
How do you specify that an activity should not be parameterised in an exported ARM template, or ensure the parameter default value is whatever is already specified?
I have an ADF pipeline which contains a WebActivity. This WebActivity URL is set by an expression which concatenates some text with some pipeline parameters:
#concat(pipeline().parameters.URL,'path/',pipeline().parameters.ANOTHER_PARAMETER,'/morePath/', pipeline().parameters.YET_ANOTHER_PARAMETER,'/lastBitOfPath')
When I export the ADF template through the UI, there are some parameters added which look like: PIPELINE_NAME_properties_0_typeProperties, are type String, but are blank. These appear to correspond to the WebActivity URL fields in various activities.
If I then import that ARM template and parameter file into a new Data Factory, the WebActivity URL is blank. This means I need to override the parameter as normal, fine, but why....? I don't need a new parameter to specify a value that is already set by parameters... how do I ensure that this activity is imported with the same expression? It seems mad that to use a WebActivity means you have to parameterise the expression. I want the ARM Template > Export ARM Template to export what I've got, not add redundant parameters that I do not need.
I have also tried editing the pipeline JSON to add a default and defaultValue attribute for the URL activity, but they are removed and have no effect.
It seems the reason for this is that the parameterization template has been modified to include:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
...
"activities": [{
"typeProperties": {
"url": "-::string"
}
}
]
}
},
Which removes the default for all URL properties of all activities.
https://learn.microsoft.com/en-gb/azure/data-factory/continuous-integration-deployment#use-custom-parameters-with-the-resource-manager-template
This applies to all activites so it seems the only alternative is to specify
"url": "=::string"
Which will parameterise the URL (so any existing parameterization will continue to function) but keep the original value by default. Care must then be taken to override any other activity url properties that I do not wish to move.
I am trying to create an extension using node api which publishes a path variable on completion.
I did set outputVariables in task.json and tried to use both
tl.setVariable('outVar1', 'outVal1'))
tl.setTaskVariable('outVar1', 'outVal1'))
task.json (only outvariable section):
"OutputVariables": [
{
"name": "outVar1",
"description": "This publish a output variable."
}
],
I tried printing it in the subsequent steps in the same job using all the recomended constructs
$(taskName.outVar1)
$taskName.outVar1
$outVar1
$(outVar1)
But the variable is not visible. I also printed all the environment variables and the variable is not present there.
Is someone able to create an extension which outputs a variable successfully?
You don't need to declare an output variable fro this purpose.
Just set the variable:
tl.setVariable("varNamr","varValue", false);
The fasle indicate that is not a secret variable.
In the enxt steps you can use the variable wirh $(varName).
Is there any way to upload multiple files to http://plnkr.co, instead of copy-pasting the code all the time? Would be great if a plunker could be connected to a github repository, or if a set of files could be dragged in.
There is no built-in way to upload multiple files to Plunker.
Users have built tools to facilitate this. Please see: https://www.npmjs.org/package/plunk which is a command-line utility that will let you create plunks from the contents of a directory.
You can also bootstrap plunks by making POST requests to http://plnkr.co/edit/ where the payload has the following format:
{
"description": "Plunk description", // Optional
"tags": ["tag1", "tag2", ..., "tagN"], // Optional
"files": {
"filename1.ext": "contents of filename1.ext",
"filename2.ext": "and so on.."
}
}
Code for this handler: https://github.com/filearts/plunker_www/blob/0c608ae80ef30d59bfdfeaf3c2a28563f7b730e4/app.coffee#L105-L121
I am creating a custom activity for my build in TFS 2010, and I need to pass the activity the source control folder for the current build definition.
I need this as it is defined on the Workspace screen in the build definition screen, such as a string like "$/Project/Folder".
I can't find the appropriate property to pass as an argument to my activity. I've found BuildDetail.TeamProject just returned "Project", but haven't had much success with anything else.
Any help appreciated.
You can create a property like
public InArgument<Workspace> CurrentWorkspace { get; set;}
In the overriden execute method you can access the workspace like
var workspace = context.GetValue<Workspace>(this.CurrentWorkspace);
foreach (var folder in workspace.Folders)
{
//
}
To use the Workspace type you need an using to
using Microsoft.TeamFoundation.VersionControl.Client;
For detailed information look at Ewald Hofmans blog