How can I pass the variable between builds in VSTS? - azure-devops

For example I have two builds A and B. When A build successfully, the build for B will be trigged and receives the output variable from A.
How can I implement this?

For now, there is no way to persist variables between two builds.
And there has an user voice Make it possible to change the value of a variable in a variable group which suggest similar feature, you can vote and follow up.
And the workaround trigger build B after build A successful (variables can not be passed) is adding a related task (such as Queue Build(s) Task) to queue build B at the end of build definition A.

Related

How to trigger a DevOps release pipeline based on a build pipeline's path filter

I have an Azure Function App that includes 3 functions:
FunctionApp
FunctionA
FunctionB
FunctionC
I have a DevOps pipeline configured to build the function app whenever any of the contents of the FunctionApp change.
I'd like now to set up a release pipeline that invokes whichever functions were updated. For example, if, in my pull request, only FunctionA was modified, I'd like to invoke only FunctionA.
How can I do this with DevOps pipelines?
I don't want to say "impossible", but what you're asking for is difficult-verging-on-impossible.
Without building a full dependency graph of the application code and tying it back to changed source files, you can't tell which function changed. Here's an example:
Let's say Function A and Function B depend on Library C. You update code in Library C. This means that from a functional perspective, both Function A and Function B have changed. How you determine this at build time?
It starts to get even trickier when you start to consider not only build, but deployment -- because you'd really be invoking the function after deployment, not build. Here's a scenario: Function A and Function B both change, but something goes wrong and the deployment is only partially successful and only Function A has been invoked. Now you run the deployment again. How does it know to invoke only Function B, since A has already been run?
You haven't said anything about what the actual purpose of the functions are, but I suspect that a better solution to this problem is to ensure that your functions are idempotent and can safely be run multiple times. If you do that, the entire premise of the question is moot, you can just deploy and invoke all of the functions every time.

Using agent parameters from main to different agent?

For a project I'm trying to select the right output if a parameter of the created agent is true. The agent is created in the main but goes into a different agent for the selection of the output. If I use a select in the main and use the statement for the parameter as condition it works fine. Whenever it enters the agent and I use the same statement it gives an error (Description: product1 cannot be resolved or is not a field. Location: testCase5/Transport/selectOutput - SelectOutput).
I tried using different conditions like main.agent.product1 . Can't seem to solve the issue. I know that it has to do something with declaration probably but I'm clueless at the moment.
//for the condition that works if I put the selectOutput in the main
agent.product1
//for the condition in the agent I tried the same but didn't work. also tried
main.agent.product1 // Gives the same error but for (Description: agentcannot be resolved or is not a field.)
(Main)agent.product1
//And a few more
In AnyLogic each block of a project flow (regardless if from the process modeling library, the pedestrian library or another) has the type of Agent that is flowing through it defined in its properties. You can find this setting as Agent type in the block's properties under Advanced.
If you fail to set this correctly (meaning this setting equals the type of Agents you let flow through it), it will still flow through, BUT: you cannot access the specific properties of the Agent type.
That said, usually you do not even have to think about, because AnyLogic has an automatism there: The first block of your process flow, typically a Source-block or a Enter-block is the only block where you have to make the correct setting, all attached blocks get it then automatically!
However this does not work when:
You have separate flows (eg. you leave one flow through an Exit-block and enter another by an Enter). You'll manually have to put the correct setting also for the first block of the second process flow.
Your process flow is continued inside of another Agent/Custom Block, as in your example. AnyLogic doesnt realize the process flow inside your custom block is logically connected to the outside process flow in main. You have to specifiy manually again the Agent type flowing through in the first block of your process inside your Custom Block.

Talend: how to fork the output of a parent job and call either of child job based on some condition

I am learning Talend. I have a scenario where I have to apply if else if condition to the output from the parent job and based on the outcome, call either of the child jobs. I have thought of few options such as using global variables or context variables. Is it possible to configure the child jobs to listen to the global/context variable change and run if the condition match? I tried looking to configure this, but failed to understand where can I do these configurations.
I even tried taking the output from the parent job component's into a tjavarow where I can write java code with if else if conditions. I was thinking to explicitly call the sub jobs from the if else branching, but I am not able to make any headway. Can someone please direct me through the right approach? Any new approach is also welcomed.
NOTE: We are using free version of Talend.
If I understand correctly, this can be achieved using "Run If" triggers, like this:
Inside tJava, you can write some logic to calculate your variables.
On the If trigger, you write a condition that determines whether or not the component after it is run.
In my example, I'm not actually making use of what's inside tJava, I'm just getting the number of lines output by tLogRow, so it can be left out and the "Run If" triggers connected directly to tLogRow.

Which method is generally used to communicate between programs in Structured Text

I am maintaining a project for a PLC written in ST. To implement a new feature I need to let cyclic program A know when an event happened in cyclic program B.
How is this generally done in ST? Do I simply use global variables or is there a different method? If I use global variables, how are these then protected from concurrent modification?
I use the X20 PLCs from B&R Automation.
Asynchronous communication is tricky.
So imagine a global A_DONE initialized to false, with B inspecting it occasionally. A runs, and sets A_DONE. B can react to this event... but what does it do if it needs to handle another event?
If you believe that the event that tells A to signal A_DONE occurs only long after B sees A_DONE, B can simply reset A_DONE to false (assuming this always happens before the next A_DONE event) and the cycle can repeat.
If A_DONE can occur "again" while B is handling the results of seeing A_DONE, B cannot just reset A_DONE: you might get a timing splinter in which B reads A_DONE, A sets A_DONE again and B then clears A_DONE; now you've lost an event. If that event is controlling your reactor emergency rods, this could be pretty bad because poof, B missed it.
In this case you will likely need a handshake from A to B and back. We add a signal from B back to A, call it A_DONE_SEEN, to let B tell A that it has processed the event. Then A sets A_DONE, waits for A_DONE_SEEN; A clears A_DONE, waits for A_DONE_SEEN to go false, and continues its business. If A_DONE needs to be set while A_DONE is already set, or A_DONE_SEEN is set, we know we missed an event and some disaster recovery procedure can be run. B watches for A_DONE, handles the A_DONE action, sets A_DONE_SEEN, watches for A_DONE going false, and sets A_DONE_SEEN_FALSE.
I don't know about your specific PLCs, but in many systems there are atomic operations that increment counts, etc. You could use this instead of the handshake.
Yes, you need to declare a variable that has a shared scope to both cyclic programs.
You can do this by using the existing global.var file or you can create a new variable file, and limit what programs can read or write to it by placing it within a "package" (folder in your project).
To create a new var declaration file...
-right click within the logical view
-add object
-select "file" category, and choose new file
-name, and change to "save as *.var" in the drop down
By default, the new variable declaration visibility will be limited to the package it is contained within. To verify this, right click the file and go to properties. Select the details tab.
There is no way to protect from concurrent modification, but you can use the cross reference tool to see where a selected variable is being written and read within your project. First build a cross reference, and then use the tab at the bottom.
Good luck!

JBPM 5.4 process variables

I am new to Jbpm 5.4. I want to set a process variable after completing one Human task. I know we can add process variables at start up using a map. Can any one tell me how set process variable in the middle of the process please???
Result mapping & data associations. Like any other type of task.
See
https://docs.jboss.org/jbpm/v5.4/userguide/ch.human-tasks.html#d0e4970
Result mapping: Allows copying the value of result parameters of the
human task to a process variable. Upon completion of the human task,
the values will be copied. A human task has a result variable "Result"
that contains the data returned by the human actor. The variable
"ActorId" contains the id of the actor that actually executed the
task.
also
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/resources/BPMN2-DataOutputAssociations.bpmn2
for an example