Forum Discussion
Guhanath
Feb 02, 2023Copper Contributor
One plugin task status as condition in another plugin task
Hello, We have two Azure Plugin extensions (created using nodejs) to be used in our pipeline and they needs to be dependent. Review task is at CI stage, Publish task is at CD stage sample code as ...
Guhanath
Feb 06, 2023Copper Contributor
Hi 2MuchC0ff33,
Sorry for the delayed response. Thanks for your responses. will go through them.
Considering that these plugins are custom developed and developers will search and add them in their pipeline, is it possible to enforce them to use it?
Also, these plugins are written in node js, and is it possible to add these conditional parameters inside the code and be available when they drag and drop it in the pipeline?
eg: condition: succeeded('ReviewAPI')
or
outputs:
reviewResult: false
to be available when they are dragged and dropped in the pipeline and be changed when the task execution completed?
Sorry for the delayed response. Thanks for your responses. will go through them.
Considering that these plugins are custom developed and developers will search and add them in their pipeline, is it possible to enforce them to use it?
Also, these plugins are written in node js, and is it possible to add these conditional parameters inside the code and be available when they drag and drop it in the pipeline?
eg: condition: succeeded('ReviewAPI')
or
outputs:
reviewResult: false
to be available when they are dragged and dropped in the pipeline and be changed when the task execution completed?
2MuchC0ff33
Feb 07, 2023Brass Contributor
You can include the conditions and outputs as part of the plugin code to enforce the use of the plugins and make the conditions and outputs available in the pipeline. When the plugin is added to the pipeline, the conditions and outputs are made available to the user and can be configured.
You can use the Azure DevOps task API to add the condition to the code for the PublishAPI task, for example:
const tl = require('@microsoft/azure-pipelines-task-lib/task');
tl.setTaskCondition('succeeded(\'ReviewAPI\')');
You can also add it to the output variable as follows:
tl.setVariable('reviewResult', false);
tl.setOutput('reviewResult', tl.getVariable('reviewResult'));
When the plugin is added, these lines of code will make the condition and outputs available in the pipeline. The user can then customise them as needed.