Download Artifact Fails ignoring http_proxy - proxy

We are seeing Azure Release Pipelines unable to download artifacts on a certain server - it times out after about 2min and we suspect it's a proxy issue i.e. the agent is NOT using the proxy it is configured to use.
When we disable/bypass the artifact download and let the agent run a curl command we see that it also times out when accessing HTTPS URLs but HTTP URLs are fine. So we can reproduce the problem with curl https://curl.haxx.se for example. Running this command directly on the server (as root or any user) works fine so it's an agent issue.
When we tell the agent to export https_proxy=<our proxy> (note httpS) and then CURL, the call to HTTPS succeeds. This implies that CURL knows about our HTTP_PROXY but not about HTTPS_PROXY and curl seems to be ignoring HTTP_PROXY for HTTPS domains. We suspect the agent passes/sets HTTP_PROXY but not HTTP_PROXY!
The problem is we can't run an export command before the artifact download as this is always the first step in the deployment group BEFORE any scripts can be executed.
Aside from the fact that we have export http_proxy and export https_proxy correctly defined in /etc/environment it would seem that the azure pipeline is unaware of the proxy when it tries to download artifact. Our .proxy file contains the proxy as http://proxy.ourlandomain:3333 and it is shown in the agent log as:
Agent is running behind proxy server: 'http://proxy.ourlandomain.com:3333'
...and then later...
[AGENT_PROXYURL] --> [http://proxy.ourlandomain.com:***#ourdomain.com]
It looks somehow garbled. Is it hiding 3333 as a secret with *** and where is this #ourdomain.com coming from???
Finally, the agent is running as root and when we curl HTTPS URLs as root it works fine.
WHY is the agent not using the proxy OR WHY is the artifact download failing?
2020-07-06T13:15:26.6383041Z ##[debug]Evaluating condition for step: 'Download artifact - Test1Artifact - Test1Linux'
2020-07-06T13:15:26.6423849Z ##[debug]Evaluating: succeeded()
2020-07-06T13:15:26.6429537Z ##[debug]Evaluating succeeded:
2020-07-06T13:15:26.6469145Z ##[debug]=> True
2020-07-06T13:15:26.6477846Z ##[debug]Result: True
2020-07-06T13:15:26.6517309Z ##[section]Starting: Download artifact - Test1Artifact - Test1Linux
2020-07-06T13:15:26.6717563Z ==============================================================================
2020-07-06T13:15:26.6718055Z Task : Download pipeline artifact
2020-07-06T13:15:26.6718463Z Description : Download a named artifact from a pipeline to a local path
2020-07-06T13:15:26.6718700Z Version : 1.2.5
2020-07-06T13:15:26.6719046Z Author : Microsoft Corporation
2020-07-06T13:15:26.6719901Z Help : Download a named artifact from a pipeline to a local path
2020-07-06T13:15:26.6720216Z ==============================================================================
2020-07-06T13:15:26.9979976Z Download from the specified build: #81654
2020-07-06T13:15:26.9980651Z Download artifact to: /prg/azure/deploy2/_work/r1/a/Test1Artifact/Test1Linux
2020-07-06T13:15:30.3332655Z ##[debug]Dedup parallelism: 192
2020-07-06T13:17:10.3457179Z ##[error]One or more errors occurred. (A task was canceled.)
2020-07-06T13:17:10.3471565Z ##[debug]Processed: ##vso[task.logissue type=error;]One or more errors occurred. (A task was canceled.)
2020-07-06T13:17:10.3485598Z ##[debug]Processed: ##vso[task.complete result=Failed;]
2020-07-06T13:17:10.3510288Z ##[debug] at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreApplicationInsightsTelemetrySender..ctor(IAppTraceSource tracer, Uri baseAddress)
at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreClientTelemetry..ctor(IAppTraceSource tracer, Uri baseAddress)
at Agent.Plugins.PipelineArtifact.DedupManifestArtifactClientFactory.CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection, CancellationToken cancellationToken, BlobStoreClientTelemetry& telemetry)
at Agent.Plugins.PipelineArtifact.PipelineArtifactServer.DownloadAsync(AgentTaskPluginExecutionContext context, PipelineArtifactDownloadParameters downloadParameters, DownloadOptions downloadOptions, CancellationToken cancellationToken)
at Agent.Plugins.PipelineArtifact.DownloadPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
at Agent.PluginHost.Program.Main(String[] args)
2020-07-06T13:17:10.3588657Z ##[section]Finishing: Download artifact - Test1Artifact - Test1Linux
UPDATE: Setting Environment=https_proxy=http://proxy.ourlandomain.com:3333 in the systemd config for the agent solves the problem and the artifact is downloaded. It would seem that either the download artifact task is not respecting http_proxy OR the agent should be and isn't setting https_proxy.

Download Artifact Fails ignoring http_proxy
According to the document Run a self-hosted agent behind a web proxy:
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.
So, you could refer to above document and configure the agent right to check again.
Besides, as workaround, we could disable the default built in artifact download task:
Then, we could run an export command and use the task Download Build Artifacts to download the artifact.
Hope this helps.

Related

unable to get local issuer certificate in Azure VM

While the node install task is reached pipeline fails with the above error how to resolve this
In the task removed the optional check latest option then it worked

SONAR_HOST_URL not reachable in bitbucket pipeline sonarqube

I am trying to integrate the sonarqube to bitbucket pipeline, and have following code there
- pipe: sonarsource/sonarqube-scan:1.0.0
variables:
SONAR_HOST_URL: ${SONAR_HOST_URL}
SONAR_TOKEN: ${SONAR_TOKEN}
- pipe: sonarsource/sonarqube-quality-gate:1.0.0
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
and I am getting error
SonarQube server [$SONAR_HOST_URL] can not be reached
I first tried setting localhost:9000, which is running at my local server, got this error, then I give website url, still getting same error,
what should I give SONAR_HOST_URL
Any help,
Thanks,
SonarQube server [$SONAR_HOST_URL] can not be reached
means SONAR_HOST_URL is not defined in the CI environment. You want to use Repository settings -> Repository variables to add both host url & token (ensure Secured check box is set for token).
P.S. The host url should be publicly accessible. It won't work for localhost:9000 because the Bitbucket CI has not\ way to connect to the instance of the sonarqube server running on your local dev box.

Deploy to Azure using publish profile : Works when publishing on VS2017 fails when using Jenkins

I downloaded the Publishing Profile from my App Service and created a profile on my WebApi.
When I execute "publishing" using VS 2017, it works fine.
When I try to execute deploy command on Jenkins if fails. The error message I have is :
Deployment task failed. (Connected to the remote computer ("XXXXXXXX") using the Web Management Service, but could not authorize.
Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator.
Connected to the remote computer ("xxxxxxxxxxx") using the Web Management Service, but could not authorize.
The remote server returned an error: (401) Unauthorized.
I have a step on Jenkins using PowerShell command line like :
msbuild My.WebApi /P:AllowUntrustedCertificate=true /P:DeployOnBuild=True /p:PublishProfile=$myPublishProfile
It builds without errors
$myPublishProfile is a valid Path
This Jenkins instance runs on a Server, not on my machine.
Jenkins has its own SMC user and server auth user.
App Service has WEBSITE_WEBDEPLOY_USE_SCM set to False
I am using the same Publishing Profile to build on Jenkins and on Visual Studio.
If both are using the same Publishing Profile, why I am getting the Auth error ?
Is there is any other config I should do to perform Deploy from Jenkins ?
When you publish using visualstudio the password is stored in an encrypted file on your disk. If you need to publish with the msbuild-command you can add credentials on the commandline or in the publishprofile
append theese properties on the commandline:
msbuild ... /p:UserName=XXX /p:PassWord=YYY
or include in the profile
<UserName>XXX</UserName>
<Password>YYY</Password>

Jenkins build project "Unable to access to repository"

I am a complete Jenkins noob so if I have missed something completely obvious I apologise in advance!
I am building an intranet web application using Visual Studio 2010 and commit changes using AnkhSVN to a repository stored on a server that is running Visual SVN Server.
Due to budget restrictions this server is also acting as our web server and also running Jenkins. It is connected to our internal network but doesn't have external internet access so I have had to manually install Jenkins plugins and dependencies.
I am trying to build a Jenkins project that would build the web application when it detects a commit but when I enter the repository URL and the user credentials in the source code management window I get the following error message:
Unable to access to repository
However when I enter the url in a browser and enter the same credentials I can access the repository without any errors.
Any ideas would be greatly appreciated.
Server Specs
Windows Server 2012 R2 Datacenter 64bit
Visual SVN Server
Port: 443
Version 3.5.6
Jenkins
Port: 8080
Credentials Plugin 2.1.9
MapDB API Plugin 1.0.9.0
Pipeline: SCM Step 2.3
Pipeline: Step API 2.5
SCM API Plugin 1.3
SSH Credentials Plugin 1.12
Structs Plugin 1.5
Subversion Plug-in 2.7.1
check if the ip of jenkins server can access the svn ip server....i have the same problem and i found that my ci server can not access the svn server .using ping command
That actually might be okay. For some reason I see similar error message (could be a bug in Jenkins frontend) when edit SCM details for a job in Jenkins, but it does work flawlessly if I actually save and run the job.
Give it a try it might actually work during the build time.

Jenkins Deploy Error Tomcat 6.x

Im trying to use jenkins to build and deploy the war file to a tomcat present in different server and im getting the following error -
Deploying /var/lib/jenkins/jobs/ura_Web/workspace/ura-1.0.war to container Tomcat 6.x Remote
ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [/var/lib/jenkins/jobs/ura_Web/workspace/ura-1.0.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:195)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:64)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:90)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:77)
at hudson.FilePath.act(FilePath.java:905)
at hudson.FilePath.act(FilePath.java:878)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:77)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:47)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:969)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
at hudson.model.Run.execute(Run.java:1618)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:491)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:247)
Caused by: java.io.FileNotFoundException: http://192.168.2.X/manager/list
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:504)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:622)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:635)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176)
... 16 more </code>
Can anyone tell me what is wrong?
I had exactly this problem just now and still have not solved it. However, I suspect it is happening because of proxy issues.
Is it possible to try setting the manager URL to http://localhost
rather than http://192.168.2.X? This worked for me, showing that the credentials were at least correct and the module functions. When I switch the manager URL back to a remote machine or the FQDN of the local server, it again failed. This indicates to me something proxy related.
The only trouble then is configuring the proxy settings for Jenkins, especially http.nonProxyHosts. If you can do that maybe you'll have more luck than me. I cannot get the Jenkins System Information proxy values to change no matter what I do!
Also manually test from a browser on both the build server and elsewhere your access to the manager URL: http://192.168.2.X/manager/list

Resources