Configure TFS deploy test agent URI - tfs

In a TFS release definition I've got a Deploy TestAgent task that has installed a test agent remotely on a test machine but then can't get a connection back to the local TFS server.
I think that's because of the initialize job environment variables like:
[SYSTEM_TASKDEFINITIONSURI] --> [http://mypc:8080/tfs/DefaultCollection/]
[SYSTEM_TEAMFOUNDATIONCOLLECTIONURI] --> [http://mypc:8080/tfs/DefaultCollection/]
[SYSTEM_TEAMFOUNDATIONSERVERURI] --> [http://mypc:8080/tfs/DefaultCollection/]
when mypc actually needs to be an IP address of the machine hosting TFS server. How can I set these variables so the test agent can connect to the TFS server?!
The test agent deployment then has a configuration for the TfsCollection as (http://mypc:8080/tfs/DefaultCollection/) and so the remote test agent gets the error:
Unable to connect to Team Foundation Server, Check if TFS is reachable from the test agent.
System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "2" argument(s): "One or more errors occurred." ---> System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The remote name could not be resolved: 'mypc'

So, the problem is Test Agent machine cannot reach TFS server. It should be an network issue.
Just check the route or firewall settings to make sure the connectivity between TFS Server and Test agent machine is OK. Then try it again.
UPDATE:
Based on rupweb's comments below, the solution is to add an entry in the etc/hosts file to map mypc and the TFS server IP:
Just add the following entry 1.2.3.4 mypc to etc/hosts at C:\Windows\System32\Drivers\etc\hosts and then the remote Test Agent can reach the TFS server via it's IP rather than DNS.

Related

Bitbucket Server Webhook does not trigger Jenkins Pipeline

I have a Jenkins Pipeline that is connected to a Bitbucket Server Repo.
The pipeline is configured with the Bitbucket Jenkins Plugin (version: 223.vd12f2bca5430) and is inside a Docker Container (PORT 8000).
To connect to the Bitbucket Server I have to use a VPN.
I have followed multiple tutorials and articles and failed. This seems a recurrent problem since I have seen multiple questions about this.
When I build the pipeline manually it works fine. It clones the repository and starts the building process but I cannot make the webhook trigger the building process.
Below you can see the configuration.
Jenkins System Settings - Successfull Connection
Pipeline Configuration (Build Triggers)
Pipeline Configuration (Pipeline - Successfull Connection)
When I run the pipeline manually for the first time, the webhook is created in the repository with the following URL: http://localhost:8080/bitbucket-server-webhook/trigger
But when I test the Webhook, it fails everytime a returns the following message:
Unable to connect to the URL specified within the timeout, please check the host and port are correct and that the URL is accessible from the server running this request.
Webhook Config inside Bitbucket Server (Test Fail)
Is this a problem with my Bitbucket Server?
Thank you for your time.

Jenkins Host key verification failed to deploy

i have project jenkins to deploy to my remote server, my local machine and my remote server was connected with ssh but when i try to build job on jenkins, i am getting error like this
image
Login on your jenkins and then try to connect manually on the command line with ssh from jenkins to the remote server. Then approve the host key of the remote system. Run again your job. Then I think everything should be fine.

How to configure TFS build agent with web proxy

We noticed that one of our task started failing with the following error after using a new proxy:
Error: connect ETIMEDOUT 102.33.19.18:443
If we remove the proxy, everything back to the track. However, we already configured proxy for our build agent.
Are there something special we missed?
When your self-hosted agent requires a web proxy, you can inform the agent about the proxy during configuration. This allows your agent to connect to Azure Pipelines or TFS through the proxy. This in turn allows the agent to get sources and download artifacts. Finally, it passes the proxy details through to tasks which also need proxy settings in order to reach the web.
To enable the agent to run behind a web proxy, pass --proxyurl, --proxyusername and --proxypassword during agent configuration.
For example:
./config.cmd --proxyurl http://127.0.0.1:8888 --proxyusername "myuser" --proxypassword "mypass"
Note: It applies to agent version 2.122 and newer. Do not forget to restart your agent and give it a try again.

How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install

I have Jenkins installed on an Ubuntu 18.04.3 LTS desktop PC on my localhost.
I also have an AzureDevOps repo on which I can successfully run a build, through a Jenkins pipeline job, connecitivity achieved via my AzureDevOps personal access token (PAT).
I am now trying to set up a Jenkins service connection or endpoint in AzureDevOps, to enable me trigger an Azure DevOps pipeline release whenever a Jenkins build completes successfully.
To achieve this in AzureDevOps, I am trying to set up access to Jenkins via a Jenkins service endpoint. The endpoint configuration requires among others, a Jenkins "Server URL" (screenshot below). Not surprisingly, AzureDevOps is unable to connect to my Jenkins instance as it's running on my local machine and therefore not publicly accessible.
Any suggestions on how I can overcome this hurdle would be most appreciated.
How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install
As we know, in order to receive the service hook notifications, you'll need to expose a port to the public internet.
To expose a port to the public internet, you can try to use the tool ngrok:
ngrok exposes local servers behind NATs and firewalls to the public
internet over secure tunnels.
Please check the document Configure a service hook for PR events for some more details.
Hope this helps.

Agent Pool Windows Service

I have already created the TFS Build Agent pool windows service that is running periodically and tries to connect to TFS,
It seems it tries to run with its own credentials and the windows service is installed on a Server that is not in the same domain as TFS (but I can access the TFS from this sever), so It fails with the below error
Error in the service log file:
Microsoft.VisualStudio.Services.Common.VssUnauthorizedException:
VS30063: You are not authorized to access https://tfsURL.
How to impersonate or making the agent Pool Windows service connected as "NT AUTHORITY\Network" or with another credentials from server in a domain to the TFS which in another domain
You can either re-configure the build agent to enter a name of the user account to use for the service like the screenshot below:
Or open the Services, right click the agent service, and then select Log On tab to change the account that runs the agent:

Resources