I m unable to create a task group for Powershell tasks in VSTS . It works for rest of the tasks except PS.
Please advice !
Thanks,
I m able to achieve it. Please ignore.
I had to make sure that Inline script has no errors and my release def is saved. !
Related
I'm currently having trouble applying logon script(powershell) on windows servers.
The logon script has the line to set user environment variables but the variables don't look like being applying immediately from the result of set command on command prompts.
I've been looking at the behavior through process monitor while logging on to the new session.
And finally I have found the newly created variables need to be associated with RegenerateUserEnvironment function on shell32.dll.
I'm able to look at the correct result of set command after RegenerateUserEnvironment is called.
So I was wondering whether we had a way to trigger RegenerateUserEnvironment function and it needs to be executed on powershell.
Can you shed some light on this?
Best Regards,
Haewon
Please, observe:
That's it. That is all a task that is a Task Group has. Compare that to just a task:
So what is the deal with the Task Groups? They look like a half-baked feature to me.
How to add custom condition to Azure DevOps task which is actually a Task Group?
Sorry for any inconvenience.
Indeed, this issue is already tracked on Github and Developer Community:
https://github.com/microsoft/azure-pipelines-tasks/issues/5112
https://developercommunity.visualstudio.com/idea/362353/implement-conditions-for-task-groups.html
And I checked the internal channel, found that it has been converted as part of an engineer's request. But, since the backlog for the next 2 months is full. MS team will try to pick up task group conditions feature after that. Currently this request is in a low priority.
As workaround, we could add the custom condition to each tasks in the task group, which is the workaround we are currently using. But you said it is not even a workaround. If you have any other issue with this workaround? You can share it in your question, so that we can check if we could find other better workaround.
Hope this helps.
It is indeed possible to make this work with classic (non-YAML) pipelines. The trick is to use a PowerShell task as the first task in your task group, and within that task, set the value of a task variable. That task variable can then be used in the custom condition for other tasks in the group. e.g.
In the task group, create a PowerShell task as the first task with the following inline script:
if ($ExecutionContext.InvokeCommand.ExpandString($(customCondition))) {
Write-Host "evaluatedCustomCondition=true"
Write-Host "##vso[task.setvariable variable=evaluatedCustomCondition]true"
} else {
Write-Host "evaluatedCustomCondition=false"
Write-Host "##vso[task.setvariable variable=evaluatedCustomCondition]false"
}
Then, in the custom condition for each subsequent task in the task group:
and(succeeded(), eq(variables['evaluatedCustomCondition'], 'true'))
Then simply set the customCondition parameter value accordingly from the calling task, e.g.
'$(executeStep)' -eq 'true'
Please note that the customCondition value you're passing here should be in PowerShell syntax, and not the bespoke custom condition syntax (since it's going to be evaluated in PowerShell).
I have an Activiti workflow that creates multiple (parallel) user tasks for an authorisation task (assigns each one to a group based on one element of a list).
<userTask id="authReview" name="Authorisation Review" activiti:candidateGroups="${assignee}" activiti:formKey="rowf:authReviewTask">
<documentation>
${assignee} Data Access request for approval.
</documentation>
<!-- One instance of this user task for each group that needs to authorise the request -->
<multiInstanceLoopCharacteristics isSequential="false"
activiti:collection="${rowf_reviewers}" activiti:elementVariable="assignee" >
</multiInstanceLoopCharacteristics>
</userTask>
As the ${assignee} variable is used to allocate the task to the correct group (after being read from the ${rowf_reviewers} list, is there any way to use ${assignee} to add to the task description?
The task description is currently set by the tag which seems to work fine but nothing is read from ${assignee}. I think this may be to do with a timing issue with the population of ${assignee} as "may" be populated before the gets evaluated.
Any assistance on how to get ${assignee} into the description would be appreciated.
I think what you are asking is if you can update the task description to include the assignee.
You can do this easily in a task listener on the "create" event.
Using the task Delegate (DelegateTask), simply call the setDescription method.
Let me know if I have misundersrood your need.
Greg
I have prepared simple jUnit test which works:
github jUnit test
I hope it helps.
Regards
Martin
I have spent a couple of hours search for a solution to disable my Azure Service Bus Topics using Powershell.
The background for this is we want to force a manual failover to our other region.
Obviously I could click in the Portal:
but I want to have a script to do this.
Here is my current attempt:
Any help would be great.
Assuming you're sure your $topic contains the full description, modify the status parameter in the array and then splat it back using the UpdateTopic method. I'm afraid I can't test this at present.
$topic.Status = "Disabled"
$topicdesc = $NamespaceManager.UpdateTopic($topic)
I don't think you'll need to set the entity type for the Status, nor do you require semi-colons after each line of code in your loop.
References
PowerShell Service Bus creation sample script (which this appears to be based off): https://blogs.msdn.microsoft.com/paolos/2014/12/02/how-to-create-service-bus-queues-topics-and-subscriptions-using-a-powershell-script/
UpdateTopic method: https://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.namespacemanager.updatetopic.aspx
Additional note: please don't screenshot the code - paste it in. I'd rather copy-and-paste than type things out.
I want to remove some folders on the remote once deploy has completed. I am currently using
task :set_permissions do
parallel do |session|
session.when "in?(:xb_test)", "cat #{deploy_to}test.htaccess >> #{current_path}/.htaccess"
end
Two questions really, is this the best way to do this and how can I run this kind of statement on multiple functions without having to write repeat code?
session.when "in?(:xb_test)" ...
session.when "in?(:xb_dev)" ...
session.when "in?(:xb_live)" ...
Any help would be appreciated as I'm pretty new to Capistrano
About your first question, "is this the best way to do this ?" :
I don't think this is the best approach.
"test" "dev" and "live" uhm... it looks like you are deploying to different stages, then I would better use https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
About your second question, "how can I run this kind of statement on multiple functions without having to write repeat code ?":
capistrano deploy.rb is just a ruby file, you can use a method
def htaccess_stuff
"cat #{deploy_to}test.htaccess >> #{current_path}/.htaccess"
end
and then
task :set_permissions do
parallel do |session|
session.when "in?(:xb_test)", htaccess_stuff
end