Azure DevOps Extensions - How configure to my extension displays Control Options > Run This Task - azure-devops

I am starting with extensions for Azure DevOps, and I have a little problem with default configuration.
I need that my project has "Run this task" option, in Control Options, like all others extensions. I was looking Microsoft official and in other extensions repositories, but I can't found how I can do this.
This configuration is very important to me, to do a rollback when previous task has failed.
Can somebody help me?
Expected behaviour
Actual behaviour
My Project
Repository: https://github.com/ThiagoBarradas/rancher-vss-ext
Extension: https://marketplace.visualstudio.com/items?itemName=ThiagoBarradas.rancher
SOLVED
To solve this troubles, after many time trying, I just needed to remove runOs from my task.json.

Try to add this to task.json:
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],

Related

vscode extension: how to prevent development-related fields automatically added to package.json

A few times in vscode extension development vscode has automatically added information to the extension's package.json that obviously seems related to development and debugging that extension.
Note: that the Marketplace Released version of the extension is also installed in the same workspaces used for debugging in the extensionHost. Could that be the issue?
The following fields were automatically added to the extension's package.json:
"identifier": {
"value": "ArturoDent.find-and-transform",
"_lower": "arturodent.find-and-transform"
},
"isBuiltin": false,
"isUserBuiltin": false,
"isUnderDevelopment": true,
"extensionLocation": {
"$mid": 1,
"fsPath": "c:\\Users\\Mark\\find-and-transform",
"_sep": 1,
"external": "file:///c%3A/Users/Mark/find-and-transform",
"path": "/c:/Users/Mark/find-and-transform",
"scheme": "file"
},
"targetPlatform": "undefined",
I missed looking for these changes and published the extension to the Marketplace and it understandably causes problems for users. The extension never loads for example, probably looking in that location from my development machine.
I do a lot of extension development and have only seen this info automatically added a few times.
Is there a way to prevent that info from being added? Or change my workflow so it doesn't happen again?
A closely related issue was reported at vscode extension test run modifies package.json after 1.67.0, where extra metdata was being written to package.json without warning and causing all kinds of problems.
The current SO question above here had nothing to do with running tests (as in the github issue) but only with debugging and was quite sporadic and difficult to make recur - but the same metadata was being written to package.json.
I have filed a new issue on this: Extraneous data written to package.json while debugging an extension that writes to package.json

How can I make VSCode auto complete work for Terraform on Mac?

I can't make auto complete work for .tf (and related) files with VSCode on my MacBook Pro.
Steps I took were:
Installed the HashiCorp Terraform plugin
Installed Terraform Language Server brew install terraform-ls
Got the path:
: which terraform-ls
/usr/local/bin/terraform-ls
And finally configured VSCode:
"terraform.languageServer": {
"external": true,
"pathToBinary": "/usr/local/bin/terraform-ls",
"args": [
"serve"
],
"maxNumberOfProblems": 100,
"trace.server": "off"
}
I just get the auto completion for aws items which are already in this file:
What am I missing here?
I wish those things were plug and play :(
This is a bug which has been acknowledged by the developers and is being fixed here:
https://github.com/hashicorp/vscode-terraform/issues/900#issuecomment-1011088885
If you still have this issue, Please try the solution which worked for me-
I had got the same problem in VS code when I installed the Terraform (Anton Kulikov) extension and the version was v0.2.2. I tried many things to make my autocomplete work ,but later when I found out the solution that if you degrade your version to v0.2.1 it works.
Hope this solution also works for you- Cheers
I worked out a workaround for this bug myself after experiencing it too. You might notice that aws_ and name are highlighted. If you hit Escape on your keyboard, it'll cancel the selection and then autosuggestions will begin working again. Not sure of the cause, but figured out this "fix" by accident.

Rule for obsolete CSS properties?

I'm looking for a Stylelint (and/or ESLint) plugin/rule that has a rule for avoiding the usage of obsolete CSS properties like grid-row-gap.
I'd like to believe someone already made this, but I couldn't find anything like it via Google, GitHub, or npm.
A plugin that also does the same for [warning] when using experimental properties/selectors would also be welcomed (e.g. :focus-visible).
Recently I started to develop a collection of rules in this plugin.
npm install #isnotdefined/stylelint-plugin
Refer the plugins and rules inside your .stylelintrc file:
{
"plugins":
[
"#isnotdefined/stylelint-plugin"
],
"rules":
{
"#isnotdefined/no-obsolete": true
}
}
At this point I need assistence to find more obsolete properties and values. Just in case someone knows a public list - let me know.

Example creating a VSTS build extension using c#

I'd like to put together some VSTS build / release management extensions in C#, although I can find some generic examples using PowerShell it would be handy to have some examples in C#.
Could anyone point me at a C# VSTS extension example please?
Regarding build task extension, you can specify the C# application, such as console application:
"execution": {
//"PowerShell3": {
// "target": "Hello.ps1",
// "argumentFormat": ""
//}
"Process": {
"target": "..\\ConsoleApplication1.exe",
"argumentFormat": "$(ConnectedServiceName) $(currentDirectory) $(ApiPortalName)"
}
}
However the Task SDK are Typescript and PowerShell, so you can’t use the SDK in your application directly, also the newest schema has removed the extra schema info (check remove extra schema info #308), so NodeJS and PowerShell are the recommended way.
Look at the source of GitVersion. The authors have wrote a TFS/VSTS task associated with it. The core of the tool is pure C#.
Here's the code of their TFS Task
https://github.com/GitTools/GitVersion/tree/master/src/GitVersionTfsTask
Here is the task you'd use inside your builds
https://marketplace.visualstudio.com/items?itemName=gittools.gitversion#overview

.NET Core App - How to get build number at runtime

I've got a .NET Core MVC app which is built using TFS online, and published to Azure using the Release management stuff in TFS online. All very nice.
What I'd like to do is have my app display the build number somewhere. Doesn't matter where...but for example in a WebAPI endpoint like /api/buildversion.
Can anyone help with how I can get the TFS build number at runtime? When the app is packaged/published is there any file which contains the build number that I can access from the application?
The simple way is that you can store the build number in a file (e.g. appsettings.json), then get this data in app code.
Appsettings.json sample code:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApplication1-ab933d83-8f4b-4024-9f3c-1aef5339a8f3;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
"CodeVersion": {
"Num": "#{MyBuildNumber}#"
}
}
Install Replace Tokens extension
Edit your build definition
Click Variables tab and add a variable. (Name: MyBuildNumber, Value:$(Build.BuildNumber))
Add Replace Tokens build step before build step
There is an easier way than adding more plugins and libraries. If you are using the web/app deploy method, expand the File Transforms & Variables
Assuming you want to update say a build number value in your appsettings.json
Then just update the variables setting in your release definition of VSTS
Super easy. This is more or less the same steps in Octopus IIRC.
You need to save the Build Number in your application at compile time.
You can access the build number with $Build.BuildNumber or $Env:BUILD_BUILDNUMBER depending on your environment. I usually write it as a variable into my ApplicationInfo.* with both the version and build number.