Build failed after TeamCity agent shutdown - teamcity

We have TeamCity with several agents and some agents run on employee's/programmers computer. If the employee shutdown computer in the evening, the running build is mark as failed and email notification is sent. Is is possible in the case of shutdown, to mark the build as cancelled and choose different agent and run the build again on different agent?

I guess if the computer is shutdown while TeamCity build is running, it [build] will be marked as failed anyway. So the question is how to rerun build after failure on new machine.
You can create agent pools and assign several build agents to the pool. After that you should edit 'Agent requirements' setting in build configuration, so your build can be run on any alive machine.
You can use 'Retry build trigger' in trigger sections to rerun your build after failure. It will rerun all failed builds, but it is OK for your problem

Build retry trigger (https://confluence.jetbrains.com/display/TCD8/Configuring+Build+Triggers) + TC REST API (https://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-BuildRequests) to delete failed builds.

Related

Run multiple jobs in parallel in Atlassian Bamboo

I would like to run multiple jobs in parallel on the same automation server. For this I need as many agents installed as the number of parallel jobs.
When I try to install an additional remote agent the installer picks the location of the first agent that is already installed on the automation server. As a result the installation fails.
What I did was: I turned off the first agent and then I run the installer for the new remote agent.
How should I go about installing an addition remote agent?
Regards,
Archie
location of the first agent
I presume you're referring to the agent's home dir. Try overriding it per agent with a distinct location using:
-Dbamboo.home=/opt/bambooX
More info: https://confluence.atlassian.com/bamboo/additional-remote-agent-options-436044733.html

Detect network error and retry running task in Azure

Running bash script in Azure pipeline. I am trying to rerun the npm publish step x-times if there is any network error is detected.
Is there any way to detect a network error specifically and rerun the whole task again?
I've found this document (https://learn.microsoft.com/en-us/azure/devops/release-notes/2021/sprint-195-update#automatic-retries-for-a-task) but I believe this reruns the process regardless of the error type.

Run macOS Test Cases on the Jenkins Pipeline

Hi I have an macOS Application which needs to be configured for CI/CD purpose on the Jenkins.
I need to run the test cases before making the application available for the distribution or before creating a package file.
I am using the below mentioned command
xcodebuild -workspace xxx.xcworkspace -sdk macosx11.3 -scheme xxx -destination "platform=OS X,arch=x86_64" clean test
when I execute this command in the Jenkins it throws me an error
ERROR: The test runner encountered an error (Failed to establish communication with the test runner. If you believe this error represents a bug, please attach the result bundle at /Users/ec2-user/Library/Developer/Xcode/DerivedData/xxx-gkolnyonjdnyixfknefsjvbsyzia/Logs/Test/Run-xxx-2021.05.24_11-58-07-+0000.xcresult. (Underlying Error: Couldn’t communicate with a helper application. Try your operation again. If that fails, quit and relaunch the application and try again. The connection to service on pid 0 named com.apple.testmanagerd.control was invalidated.))
I need to make use of macOS itself to run as a simulator. As Jenkins runs as a Daemon on the ec-2 instance.
NOTE: NOT USING XCODE PLUGIN TO EXECUTE MY COMMANDS
Please help!!!
My MacOS system was a slave and I was running my scripts through the Linux server.
macOS was connected using the SSH earlier then this authentication method was required to be changed to access the UI of the Mac
Test cases running now
Based on observation, macOS Big Sur, Monterey, and probably subsequent versions no longer allow tests to be run through a SSH session. By changing the way Jenkins controller connects to the slave, you can prevent the command from being run through SSH.
The first way, Jenkins built-in, to do this and easiest is to use the JNLP method for agent communication. This will involve running a Jenkins agent on the slave machine that communicates with the Jenkins controller. In the end, the agent on the machine is running the test command rather than through a SSH session.
The second way is to build your own agent. It could be as simple as a file change trigger leading to a script executing. This is only necessary if for some reason the Jenkins slave is not able to connect to the Jenkins controller due to some networking constraints.

Teamcity thinks agent is running a build, but it is not

Using teamcity 5.1 (build 13360)
Usually everything works as expected
Occasionally it gets into a state where the server runs a build and it thinks the agent is running it, but the agent doesn't actually run the build
I see no sign of the build being run by the agent in its logs
So the build just runs forever on the server
I have restarted agents and the server
So it appears it recovers after a few hours
I just left a build running and it completed after a while
Don't know if restarting server / agents helped or not

TeamCity build agent continually "Unable to start upgrade: Connection reset"

My TeamCity agent is contniually trying to download upgrades from the TeamCity server. It always downloads the files, then fails to start the installation, with the error:
WARN - jetbrains.buildServer.AGENT - Unable to start upgrade: Connection reset
My server is running at http://localhost:9912
How do I stop this endless cycle?
Latest version of TeamCity downloaded from JetBrains
I'm guessing you're running the agent as an AD account rather than under the machine account.
Run the agent service under an account with administrative permissions for the upgrade. I don't remember the specifics of what it's trying to write but it won't if it's a standard user.

Resources