ng build not creating assets and such in Jenkins - jenkins

We're having issues with our automated deployment system.
On our own computers, running ng build generates the dist folder. Within the folder, it has the assets as expected.
I have replicated this, on the build server, manually pulling the git repository, and running the "build file" (the build server runs on Windows Server. The build and deploy process is managed via a PowerShell script for convenience).
When our Jenkins server runs the build script, the assets folder is missing from the /dist/ folder, as well as some other files configured in angular.json.
It is also not properly compiling the stylesheets, which I've believe is due to the same root cause.
The issue persists when running the PowerShell script directly from the Jenkins workspace when the shell is run as a system administrator.
The CLI does not produce any errors.
I'm attaching a verbose log, in case this could be helpful.
https://gist.github.com/cf-jola/6cc6cff138da5105f3b10adffb72895f#file-output-txt
Running the script as the system administrator I've ruled out it being a permissions issue. Jenkins is also managing to create other files, such as the
.js files, and the index.html fine.
My workaround right now is to, via the deploy powershell script, to manually copy the assets folder, how-ever I'd love to get rid of this workaround as we're starting to get multiple files in our angular.json > assets section.
For references:
angular.json https://gist.github.com/cf-jola/6cc6cff138da5105f3b10adffb72895f#file-angular-json
deploy script: https://gist.github.com/cf-jola/6cc6cff138da5105f3b10adffb72895f#file-deploy-ps1

Its a bug, in either Node or Angular CLI.
Because we have brackets, ( & ), in the build path, they get encapsulated in square brackets.
This causes the path: C:\Program Files (x86)\Jenkins\... to become this C:\Program Files [(]x86[)]\Jenkins\... and thereby become invalid.
We discovered the issue by using Process Monitor and looking over the events generated during the build process.

Related

Azure DevOps Server 2020 - Publish Artifact ignoring File Copy Options

We have a build pipeline that's been working for a year or two. This builds and creates a few artifacts - ASP.Net web application, windows services, etc. The issue here is with the ASP.Net web application.
We've added some REACT components to the build. There are now an enormous \React\node_modules\ folder with tens of thousands of files. I want to exclude the \React\node_modules folder from the "Publish Artifact" step. I've edited this step, by adding this under the File copy options setting:
/XD react/node_modules
I have a "Publish Artifact" task that has "/XD react/node_modules" set as the File Copy options. However, when I run the build pipeline, it still copies everything in the react/node_modules folder.
When I view the raw logs, I do not see that being passed as an argument in the Robocopy command. I only see this in the logfile for the Publish Artifact step:
2022-04-13T00:24:47.8605686Z ##[command]robocopy.exe /E /COPY:DA /NP /R:3 /MT:8 "C:\agent_agentwork\1\s\Website" "c:\builds\HF\HF_3.8.1.75\Website" "*"
Any idea why it's not working here?
This is a bug in the Publish artifact task. A github issue has been logged for this in 2019 (https://github.com/microsoft/azure-pipelines-tasks/issues/11451). Sadly, it is not fixed yet.
Awaiting a fix, you could work around it by putting a build step that explicitly calls robocopy to copy the build output to a temporary location (with the /XD switch). And then put the 'Publish artifact' step that copies from that temporary location.

JBehave(+Serenity) index.html not generated in Jenkins

When I run my tests in my local machine, report file is always created/overwritten in: C:\Temp\myLocalFolder\target\site\serenity\index.html
But when I run my tests using Jenkins(localhost:8080), report file is Not being generated in: C:\Users\me\.jenkins\workspace\myJenkinsFolder\target\site\serenity
In Jenkins, I've already added the Thucydides plugin, added it in Post-Build Actions, and set Report Path to target/site/serenity. I tried copying the index.html from my local folder to the jenkins folder, and after running I can view the same report. However I want it to be overwritten by the latest run on Jenkins. Any ideas?
Apprarently I just had to set Report Path in Jenkins to the same directory as my local folder (C:\Temp\myLocalFolder\target\site\serenity\index.html). I'm not sure if that's the correct approach. It won't work if I run from my online github repository. I will try that one next.

Jenkins - how to copy test logs back to artifacts directory for build

New to Jenkins so apologise in advance as I'm sure this answer is out there somewhere. Just not sure exactly how to search for what I'm after. I'm struggling a bit with the copyback process in Jenkins.
When I build, I'm running some unit tests that create some log files which I want to be stored as part of the Jenkins build. I'm running on Windows 10 and everything is running on my laptop (I'm purely trying to learn Jenkins so this is fine for me).
So my test results will always appear in C:\TestLogs\*.log. I want the results copied to my build directory which is URL: http://localhost:8080/job/loadrunner_test/1/ absolute: C:\Program Files (x86)\Jenkins\jobs\loadrunner_test\builds\1
I'm a bit confused with which plugin I should use in my post build step? Copy Artifact plugin looks as if it's meant to pass data between builds. For each build, I just want to copy C:\TestLogs*.* to the current build directory so I can see them when I click on the link for #1 in the Build History.
Many thanks!
Tim
WindowsDir
Jenkins Build
You can copy it with additional step.
Select Execute Windows batch command for that step and add this line:
xcopy C:\TestLogs C:\Program Files (x86)\Jenkins\jobs\jenkins_test\builds\%BUILD_NUMBER% /s /e
You can also check configuration for your test if you can set path location.

TFS Release CopyFiles task gives code EPERM

I'm running latest version of TFS 2015 release manager. I have a simple release that includes a "CopyFiles" task. I need to have the "Clean Target Folder" option of the task enabled.
I have three target environments configured. Both are newly created identical Windows servers. The CopyFiles task works fine against the first two servers but for the next environment in the pipeline, when copying to the second server I get the following error:
2016-11-11T21:41:07.4324714Z found 2 files
2016-11-11T21:41:07.4324714Z ##[debug]file:D:/Build/_work/df9f2c4cf/(master) Orchard BTDF/drop/20161111.5.zip will be copied.
2016-11-11T21:41:07.4324714Z ##[debug]file:D:/Build/_work/df9f2c4cf/(master) Orchard BTDF/drop/Unzip.ps1 will be copied.
2016-11-11T21:41:07.4324714Z Cleaning target folder: \\Steatbt02\BizTalkDeployments2\Orchard
2016-11-11T21:41:07.4324714Z ##[debug]rm -rf \\Steatbt02\BizTalkDeployments2\Orchard
2016-11-11T21:41:07.4480915Z rm: could not remove directory (code EPERM): \\Steatbt02\BizTalkDeployments2\Orchard
2016-11-11T21:41:07.4480915Z ##[debug]task result: Failed
There's no sign of errors in the event log.
I created the share "\Steatbt02\BizTalkDeployments2" and granted "full-access" permissions to the account running the build agent. I even tried logging onto the build server and run as for the command prompt using the credentials of the build agent. From this command window I was able to remove the target folder
"\Steatbt02\BizTalkDeployments2\Orchard" - so I can't think why the build agent would have trouble doing the same!
Any ideas what could be wrong, or what extra steps I could take to track down the root cause of the problem?
The problem was the agent queue selected for the problem environment.

Build delphi project in jenkins

Im trying to setup jenkins in my company and Ive got some problems.
Im using this commands to build the project:
SET MSBuild="C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe"
SET BUILDS=C:\Program Files (x86)\Jenkins\jobs\xxx\builds\
SET OUTPUT_PATH="%BUILDS%%BUILD_NUMBER%"
SET RSVARS="C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\rsvars.bat"
CALL %RSVARS%
SET PATH=%PATH%;D:\komponenty\DXE3\ADSI
%MSBuild% xxx.dproj /t:Build /p:Config=Debug;Platform=Win32;DCC_ExeOutput=%OUTPUT_PATH% /maxcpucount:4
It works fine when i type this in cmd but. I gave administrive privileges to jenkins service. When I try to build project with jenkins i receive error like this:
F1026: File not found: 'ADSI.dcu
this is a component for Delphi and i have this component on second partition. Jenkins has access for many components on this partition but not for this one.
The difference between the two will be your current directory.
Jenkins will start you off in a specific working folder for the job (possibly C:\Users\<User-ID>\.jenkins\jobs\<Job-Name>\workspace).
Add the following to your Jenkins commands to see where you're doing the build from:
echo Current Folder: %cd%
A simple "solution" would be to just add a command in Jenkins to change directory to the same folder you're in when you test from the command-line.
However, I suggest you rather do the following:
Ensure Jenkins gets the latest source from your source repository into its working folder. (There are various plugins depending on what particular tool you use.)
Ensure you cd (change directory) to the correct folder within the workspace folder.

Resources