문제

I'm in a process of writing a Bamboo plugin, the bulk of which is complete.

The plugin works by starting a remote process off via a post request to a server and then polling the same server until it gets a message saying the process has completed or an error occurred - this part works.

I would like to add some extra logic where I can notify this server if the user cancels the job, however I'm unsure of how to go about this.

I have played about with creating another task which runs as a final task, however I don't know how to detect if any of the previous tasks failed or were cancelled.

I have tried using List<TaskResult> taskResults = taskContext.getBuildContext().getBuildResult().getTaskResults(); to get a list of the previous Task's results, however this always appears to return 0 Task Results.

I have also tried using a Post-Build Completed Action Module, however I'm unsure how I would add this to a job and the documentation on this has me slightly mystified.

If anyone could help me in the right direction I would appreciate it.

도움이 되었습니까?

해결책

From reading what you had written, I think that using an event listener is definitely the correct way to approach your problem. Below I have provided an image of my own creation that seems to describe what you have constructed and that shows where it might be best to place the event listener.

Essentially, the client of yours will issue a cancel notification to the server via its network controller mechanism. The server will then receive that cancelation notification via its network controller which is already connected to the client via some network protocol (I am assuming TCP). When that cancellation notification from the client network controller reaches the network controller of the server, the event listener in the network controller of the server will then signal the server build manager to terminate the remote build.

Diagram of your program enter image description here

I hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top