PeaceDealer
PeaceDealer

Reputation: 1017

ng build not creating assets and such in 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

Upvotes: 2

Views: 1601

Answers (1)

PeaceDealer
PeaceDealer

Reputation: 1017

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.

Upvotes: 2

Related Questions