1
votes

We have a custom Azure DevOps extension to in order to inject SonarQube pipeline tasks into every definition using the Pipeline Decorator feature. These tasks are a mixutre of both pre and post tasks.

In YAML defined pipelines, the tasks run perfectly, however in Classic pipeline definitions, only the post tasks run, although the classic and YAML pipelines are defined identically (steps, agents, demands, variables etc.).

As this is a relatively new feature of Azure DevOps, there is a lack of documentation, especially regarding classic pipelines.

Is there something that we could possibly be missing for this to happen?

1

1 Answers

3
votes

Is there something that we could possibly be missing for this to happen?

This seems the issue on our side. And, it only exists to the sonarcloud/sonarqube prepare task if we apply it into Decorator.

As you know, users use yaml template for the steps to inserted at the specified location. And in fact, on our backend, this template file is processed through yaml template engine.

As our design, after you enable the Pipeline decorators at organization level. In Initialize job, Pipeline will call one backend class to get the JobContext, which will add decorator providers to JobContext. Then JobContext use these providers to fetch contributions to add pre/post tasks in job while preparing the job to run.

BUT, the sonar prepare task can not actively be detected by engine, then inject it into JobContext. For why I point to this specific task, because this kind of abnormality only exists in the prepare task of sonarcloud and sonarqube until now.

Our team will do some investigation and fix with sonar team together.


Until now, there has 2 work around you could consider to apply.

Work around 1:

As I mentioned previously, this prepare task can not actively be detected and injected into JobContext. So, the first work around we actively add this task info into JobContext via adding prepare task into agent job.

But this will cause one disadvantage is, it will load 2 prepare tasks. One is executed in pre-job, and next it will run second.

enter image description here

Work around 2:

Try to use YAML to build your pipeline until we implement this abnormality thing. So that it will not cause error because of lacking prepare task


Will update the status here to let you know once we have any progress.