MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
57 stars 14 forks source link

Yaml task not found #20

Closed JeffreyGarrett closed 5 years ago

JeffreyGarrett commented 5 years ago

When trying to operate as a yaml file task is not recognized by azure build.

Error: Job Job1: Step references task 'BuildQualityChecks' at version '5' which does not exist.

Please let me know if I'm doing something incorrect or if this is not quite supported. I got the yaml from the design editor so figured it should work.

ReneSchumacher commented 5 years ago

Hi Jeffrey,

our task also works in yaml builds (I just retested again). However, your yaml looks a bit strange. The task name should have a namespace syntax and the inputs look as if some things are missing and some are wrong. When I generate the yaml for the task using your configuration (or what I assume would be your configuration), I end up with this:

- task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@5
  displayName: 'Check build quality'
  inputs:
    checkWarnings: true
    forceFewerWarnings: true
    showStatistics: true
    checkCoverage: true
    coverageFailOption: fixed
    coverageThreshold: 25

You could try to copy this to your yaml file. Let me know if it helps or if you need anything else.

Happy building, René

JeffreyGarrett commented 5 years ago

Thanks for the response but I tried that and got this. image

ReneSchumacher commented 5 years ago

Are you using Team Foundation Server or Azure DevOps Services? Are you sure that the extension is correctly installed?

JeffreyGarrett commented 5 years ago

The extension is installed and I'm using azure devops Services.

image

also link to yaml file i'm using. https://github.com/JeffreyGarrett/DFDevOpsTest/blob/master/azure-pipelines.yml

ReneSchumacher commented 5 years ago

Hm, that's strange. It works on Azure DevOps on our side. Have you tried removing and reinstalling the extension?

Also, could you try reading the extension information usind the REST api described at https://docs.microsoft.com/en-us/rest/api/vsts/extensionmanagement/installed%20extensions/get?view=vsts-rest-4.1? Use mspremier as the publisher and BuildQualityChecks as the extension name.

JeffreyGarrett commented 5 years ago

I went to remove the extension and now got a different error just trying to reinstall. The task definition with id '16a2ad20-f191-11e5-bed4-ab22bcd17937', name 'BuildQualityChecks' and version '5.2.1' already exists.

I'll also try the rest API

ReneSchumacher commented 5 years ago

Hey,

that is even stranger. Removing the extension should always fully remove the task as well. The only way to create this issue - at the only I can think of - is to manually install just the build task using the tfx cli tool. However, you'd have to extract the task from the vsix file to do so.

It would really help to see the ouput of the REST call after you removed the extension from your Azure DevOps organization. Btw. you can just call the web api URL in a browser and then copy the resulting JSON to an editor of your choice that understands JSON and can format the output (e.g. Visual Studio Code).

JeffreyGarrett commented 5 years ago

Is this the response your looking for?

{"$id":"1","innerException":null,"message":"TF1590003: No app with id mspremier.BuildQualityChecks is installed in this organization.","typeName":"Microsoft.VisualStudio.Services.ExtensionManagement.WebApi.InstalledExtensionNotFoundException, Microsoft.VisualStudio.Services.ExtensionManagement.WebApi","typeKey":"InstalledExtensionNotFoundException","errorCode":0,"eventId":3000}

ReneSchumacher commented 5 years ago

Yes, that's what I was looking for. However, it doen't help me understand your issue. The API clearly states that the extension is not installed; on the other hand, you got an error trying to install the extension again. If you still receive this error, could you try the following:

  1. Install Node.JS (if not already installed) from nodejs.org
  2. Install the tfx cli tool (run npm install -g tfx-cli)
  3. Create a personal access token for your account (see https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=vsts)
  4. Write all build tasks in your organization to a text file by running tfx build tasks list --service-url <your Azure DevOps URL> > tasks.txt
  5. Look through the list of build tasks to see if the BuildQualityChecks task (ID 16a2ad20-f191-11e5-bed4-ab22bcd17937) is still listed.
  6. If the list contains the task, delete it by running tfx build tasks delete --task-id 16a2ad20-f191-11e5-bed4-ab22bcd17937 --service-url <your Azure DevOps URL>
  7. Reinstall the extension through the marketplace.

I really do hope that this works. If you don't see the task in the list of existing build tasks, please send me your Azure DevOps organization name via email to PSGerExtSupport@microsoft.com and I will ask the Azure DevOps product team to look into this.

René

JeffreyGarrett commented 5 years ago

Thank you! So good news is that I was able to delete the task and enable it for the organization. The interesting piece though is when I added it via the GUI online it says it added it, but tfx doesn't show it in the file and I still get the original error that it doesn't exist.

tasks.txt

I'm wondering is it possible to add it via tfx as that seems to be working where the azure devops marketplace add ons don't seem to work properly.

JeffreyGarrett commented 5 years ago

actually I was able to run tfx and when trying to install it shows it's installed although the list function doesn't show it. image

JeffreyGarrett commented 5 years ago

Oh it looks like I fixed it. I was able to disable it and then re-enable it and it started working and showed in TFX. So it sounds like the installation has an issue around it being enable.

So although that doesn't solve the problem it is a good work around and we are good.

Secondly can you help with where would I go to see all the variables for your extension for the yaml file? How do I know how to configure it, I didn't see something in your repo. Did I miss something?

ReneSchumacher commented 5 years ago

Hey,

first, that is indeed good news even though it makes me feel a bit uneasy as there should never be such a hassle with the installation of a build extension. There are at least two uninstalls I can see from our telemetry that have a reason similar to "I couldn't find the task after I installed it". We will definitely have to look into this. Could you tell me in which region your Azure DevOps organization is in? I will create a new org in that region and test the installation myself.

Regarding the YAML question, we really did a poor job with documentation there. I usually configure the task using the UI and then copy the YAML from the UI editor. I'll put an item into our backlog to extend our docs with the necessary information. For now you can follow this "trick" to get to the variables (works with every downloadable task): download the extension vsix file from the marketplace, open it with a zip tool of your choice (e.g., 7zip) and extract the task.json file. In the file you will see a list of inputs with name and label properties. The label is what you would see in the UI and the name is what you have to use in the YAML file to configure the task.

Hope that helps! René

JeffreyGarrett commented 5 years ago

Ya the region is Central US. Normally we deploy to east us as it seems like more features and better stability, but it is what it is.

for the yaml, those are very helpful workarounds and good enough for me! Thanks for your help and attention. I appreciate getting this solved without waiting weeks!

ReneSchumacher commented 5 years ago

Hi Jeffrey,

I'm closing the issue now as I believe it was fixed for you. I'm also working with the build and marketplace teams as there seems to be a general problem with extensions right now that affects some but not all users/organizations. We're working on it.

If you need anything else, please let me know or open another issue here.

Happy building! René