Can't run Cypress successfully in Jenkins build on Windows - jenkins

In Jenkins build, I set up the build environment as Node.JS, and executed windows batch command "npm install --global yarn&yarn add cypress --dev &yarn cypress:run --reporter=spec"the same way I ran in my local. All the tests can run successfully, but in Jenkins all are failed with error."Oops...we found an error preparing this test file: Error: ENOENT: no such file or directory, stat 'C:\Windows\system32\config\systemprofile\AppData\Roaming\Cypress\cy\production\projects\esgr-portal2-sso-dev-cypress-b7dad7110500bea68385ec2d48f2d9df\bundles\cypress\support\e2e.js'. This occurred while Cypress was compiling and bundling your test code. This is usually caused by: A missing file or dependency. A syntax error in the file or one of its dependencies. Fix the error in your code and re-run your tests."
The console log is here:
Started by user Billy
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\project-sso-dev-cypress
using credential 78bcddd4-13b9-4582-a4fc-e86abb9ebeaa
> C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files\Git\bin\git.exe config remote.origin.url https://github.com/project-cypress.git # timeout=10
Fetching upstream changes from https://github.com/project-cypress.git
> C:\Program Files\Git\bin\git.exe --version # timeout=10
using GIT_ASKPASS to set credentials Token as password
> C:\Program Files\Git\bin\git.exe fetch --tags --force --progress -- https://github.com/project-cypress.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> C:\Program Files\Git\bin\git.exe rev-parse "refs/remotes/origin/main^{commit}" # timeout=10
> C:\Program Files\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/main^{commit}" # timeout=10
Checking out Revision 56ab032de063bbf0e04a7bbf7482b9f795be79d4 (refs/remotes/origin/main)
> C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files\Git\bin\git.exe checkout -f 56ab032de063bbf0e04a7bbf7482b9f795be79d4 # timeout=10
Commit message: "Merge branch 'main' of https://github.com/project-cypress"
> C:\Program Files\Git\bin\git.exe rev-list --no-walk 4cd7cdcec00da10e04193706d9741f2d0a9a231e # timeout=10
[esgr-portal2-sso-dev-cypress] $ cmd /c call C:\Windows\TEMP\jenkins1758996358505508646.bat
C:\Program Files (x86)\Jenkins\workspace\project-sso-dev-cypress>npm cache clean --force & npm install & npm install cypress & npm install --global yarn & yarn add cypress --dev & npm install cypress-react-selector & yarn cypress:run --reporter=spec
npm WARN using --force Recommended protections disabled.
added 168 packages, removed 3 packages, and audited 169 packages in 15s
28 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
up to date, audited 169 packages in 705ms
28 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
changed 1 package in 490ms
yarn add v1.22.19
warning package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 1 new dependency.
info Direct dependencies
└─ cypress#12.2.0
info All dependencies
└─ cypress#12.2.0
Done in 10.71s.
added 3 packages, changed 8 packages, and audited 172 packages in 4s
28 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
yarn run v1.22.19
warning package.json: No license field
$ cypress run --reporter=spec
�[90m====================================================================================================�[39m
�[0m (�[4m�[1mRun Starting�[22m�[24m)�[0m
�[90m ┌�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m��[39m
�[90m │�[39m �[90mCypress:�[39m 12.2.0 �[90m│�[39m
�[90m │�[39m �[90mBrowser:�[39m Electron 106 �[90m(headless)�[39m �[90m│�[39m
�[90m │�[39m �[90mNode Version:�[39m �[0mv19.3.0 �[90m(C:\Program Files (x86)\Jenkins\tools\jenkins.plugins.nodejs.tool�[0m �[90m│�[39m
�[90m │�[39m �[0ms.NodeJSInstallation\Node19\node.exe)�[39m�[0m �[90m│�[39m
�[90m │�[39m �[90mSpecs:�[39m �[0m30 found (1-getting-started/todo.cy.js, 2-advanced-examples/actions.cy.js, 2-a�[0m �[90m│�[39m
�[90m │�[39m �[0mdvanced-examples/aliasing.cy.js, 2-advanced-examples/assertions.cy.js, 2-advan�[0m �[90m│�[39m
�[90m │�[39m �[0mced-examples/connectors.cy.js, 2-advanced-examples/cookies.cy.js, 2-advanced-e�[0m �[90m│�[39m
�[90m │�[39m �[0mxamples/cypress_api.cy....)�[0m �[90m│�[39m
�[90m │�[39m �[90mSearched:�[39m �[0mcypress/e2e/**/*.cy.{js,jsx,ts,tsx}�[0m �[90m│�[39m
�[90m └�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m┘�[39m
�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m�[90m─�[39m
Running: �[90m1-getting-started/todo.cy.js�[39m �[90m(1 of 30)�[39m
�[31mOops...we found an error preparing this test file:�[39m
�[31m�[39m
�[31m�[90m > �[31m�[94mcypress\e2e\1-getting-started\todo.cy.js�[31m�[39m
�[31m�[39m
�[31mThe error was:�[39m
�[31m�[39m
�[31m�[33mError: ENOENT: no such file or directory, stat 'C:\Windows\system32\config\systemprofile\AppData\Roaming\Cypress\cy\production\projects\esgr-portal2-sso-dev-cypress-b7dad7110500bea68385ec2d48f2d9df\bundles\cypress\e2e\1-getting-started\todo.cy.js'�[31m�[39m
�[31m�[39m
�[31mThis occurred while Cypress was compiling and bundling your test code. This is usually caused by:�[39m
�[31m�[39m
�[31m- A missing file or dependency�[39m
�[31m- A syntax error in the file or one of its dependencies�[39m
�[31m�[39m
�[31mFix the error in your code and re-run your tests.�[39m

Related

Testcafe fails on Jenkins built

I've made everything from https://devexpress.github.io/testcafe/documentation/guides/continuous-integration/jenkins.html. But builds fails always:
node --version
v14.2.0
npm --version
6.14.4
grunt --version
grunt-cli v1.2.0
bower --version
1.8.8
npm install testcafe testcafe-reporter-xunit
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
core-js#2.6.11 postinstall /var/lib/jenkins/jobs/testcafe/workspace/node_modules/core-js
node -e "try{require('./postinstall')}catch(e){}"
npm WARN saveError ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/testcafe/workspace/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/testcafe/workspace/package.json'
node_modules/.bin/testcafe chrome tests/smokeTest.js -r xunit:res.xml -s takeOnFails=true
/tmp/jenkins4618268829523592648.sh: 20: /tmp/jenkins4618268829523592648.sh: node_modules/.bin/testcafe: not found
Build step 'Execute shell' marked build as failure
Recording test results
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
What am I doing wrong?

Errors installing vue/cliapp under docker

I want to install my #vue/cli 4.0.5 app under docker and using https://medium.com/#jwdobken/vue-with-docker-initialize-develop-and-build-51fad21ad5e6 link :
I modified the command line : modified node source from 11-alpine and renamed project name and installed the project, but running command
yarn serve
I got error that serve was not found :
me#athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/DOCKER_TEST$ mkdir vtaskproject && cd "$_" && docker run --rm -v "${PWD}:/$(basename `pwd`)" -w "/$(basename `pwd`)" -it node:11-alpine sh -c "yarn global add #vue/cli && vue create ."
Unable to find image 'node:11-alpine' locally
11-alpine: Pulling from library/node
e7c96db7181b: Already exists
0119aca44649: Pull complete
40df19605a18: Pull complete
82194b8b4a64: Pull complete
Digest: sha256:8bb56bab197299c8ff820f1a55462890caf08f57ffe3b91f5fa6945a4d505932
Status: Downloaded newer image for node:11-alpine
yarn global v1.15.2
[1/4] Resolving packages...
warning #vue/cli > #vue/cli-ui > vue-cli-plugin-apollo > apollo > git-parse > babel-polyfill > core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
warning #vue/cli > #vue/cli-ui > vue-cli-plugin-apollo > apollo > git-parse > babel-polyfill > babel-runtime > core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
[2/4] Fetching packages...
info fsevents#1.2.11: The platform "linux" is incompatible with this module.
info "fsevents#1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.21.1", while you're on "1.15.2".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
success Installed "#vue/cli#4.1.1" with binaries:
- vue
Done in 32.17s.
? Your connection to the default yarn registry seems to be slow.
Use https://registry.npm.taobao.org for faster installation? Yes
Vue CLI v4.1.1
? Generate project in current directory? Yes
Vue CLI v4.1.1
? Please pick a preset: default (babel, eslint)
? Pick the package manager to use when installing dependencies: Yarn
Vue CLI v4.1.1
��� Creating project in /vtaskproject.
��� Installing CLI plugins. This might take a while...
yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents#1.2.11: The platform "linux" is incompatible with this module.
info "fsevents#1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
success Saved lockfile.
Done in 77.43s.
���� Invoking generators...
���� Installing additional dependencies...
yarn install v1.15.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents#1.2.11: The platform "linux" is incompatible with this module.
info "fsevents#1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 24.82s.
��� Running completion hooks...
���� Generating README.md...
���� Successfully created project vtaskproject.
���� Get started with the following commands:
$ yarn serve
me#athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/DOCKER_TEST/vtaskproject$ yarn serve
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'serve'
serge#athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/DOCKER_TEST/vtaskproject$ yarn --version
0.32
I see that on successfull installation newly created project dir was selected.
Also in the provided article next was :
Dockerfile The Dockerfile is identical to the given example in the
documentation. Only the build-stage is split up into an install-stage
and a build-stage, since we don’t need to build when we are
developing!
But the thin is I do not see any Dockerfile file in the created project : https://imgur.com/a/mKrdFgi as I expected.
Had Dockerfile be there and how move next ?
$ lsb_release -d; uname -r; uname -i
Description: Ubuntu 18.04.3 LTS
4.15.0-72-generic
x86_64
$ docker --version
Docker version 19.03.5, build 633a0ea838

Build error for missing Nuget package even though "nuget restore" ran

I'm trying to set up a Jenkins server to build an ASP Core project. I have my Jenkins project configured to use the MSBuild from my installed Visual Studio 2017. I downloaded Nuget v5.3.1 and added it to my PATH.
My Jenkins project is configured with two build steps. The first step is to run nuget restore. The second step is "Build a Visual Studio project or solution using MSBuild" on my solution file (AspCore.sln)
When I try to build the project in Jenkins, I get the following error. However, it appears that all of the Nuget packages were downloaded successfully.
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
Here's the full Jenkins build log.
Started by user Ben Rubin
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment
using credential 633afff1-dea9-4aab-a44a-0a4d127afd1b
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url git#github.com:Toreth/AspCoreTest.git # timeout=10
Fetching upstream changes from git#github.com:Toreth/AspCoreTest.git
> git.exe --version # timeout=10
using GIT_SSH to set credentials
> git.exe fetch --tags --force --progress -- git#github.com:Toreth/AspCoreTest.git +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision c0e95238b58d6648c51fac0a817fa5d3e60ce615 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f c0e95238b58d6648c51fac0a817fa5d3e60ce615
Commit message: "Initial commit."
> git.exe rev-list --no-walk c0e95238b58d6648c51fac0a817fa5d3e60ce615 # timeout=10
[Windows Service Deployment] $ cmd /c call C:\Windows\TEMP\jenkins4544019004588734090.bat
C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment>nuget restore
MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin'.
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json 45ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/2.1.9/microsoft.visualstudio.web.codegeneration.design.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/2.1.9/microsoft.visualstudio.web.codegeneration.design.2.1.9.nupkg 31ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/index.json 42ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/2.1.9/microsoft.visualstudio.web.codegenerators.mvc.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegenerators.mvc/2.1.9/microsoft.visualstudio.web.codegenerators.mvc.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/index.json 44ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/2.1.9/microsoft.visualstudio.web.codegeneration.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration/2.1.9/microsoft.visualstudio.web.codegeneration.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/index.json 58ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/2.1.9/microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.entityframeworkcore/2.1.9/microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/index.json 41ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/2.1.9/microsoft.visualstudio.web.codegeneration.core.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.core/2.1.9/microsoft.visualstudio.web.codegeneration.core.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/index.json 42ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/2.1.9/microsoft.visualstudio.web.codegeneration.templating.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.templating/2.1.9/microsoft.visualstudio.web.codegeneration.templating.2.1.9.nupkg 29ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/index.json 60ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/2.1.9/microsoft.visualstudio.web.codegeneration.utils.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.utils/2.1.9/microsoft.visualstudio.web.codegeneration.utils.2.1.9.nupkg 30ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/index.json 61ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/2.1.9/microsoft.visualstudio.web.codegeneration.contracts.2.1.9.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.contracts/2.1.9/microsoft.visualstudio.web.codegeneration.contracts.2.1.9.nupkg 32ms
Installing Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Utils 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Templating 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Core 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.9.
Installing Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.9.
Committing restore...
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\AspCore.csproj.nuget.g.props.
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\AspCore.csproj.nuget.g.targets.
Writing assets file to disk. Path: C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\obj\project.assets.json
Restore completed in 3.73 sec for C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj.
NuGet Config files used:
C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
https://api.nuget.org/v3/index.json
Installed:
8 package(s) to C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj
C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment>exit 0
Path To MSBuild.exe: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe
Executing the command cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" AspCore.sln " && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment
[Windows Service Deployment] $ cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" AspCore.sln " && exit %%ERRORLEVEL%%
Active code page: 1252
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 10/27/2019 4:54:18 PM.
Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (1) is building "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (2) on node 1 (default targets).
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
Done Building Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (default targets) -- FAILED.
Done Building Project "C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (default targets) -- FAILED.
Build FAILED.
"C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore.sln" (default target) (1) ->
"C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj" (default target) (2) ->
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1064: Package Microsoft.VisualStudio.Web.CodeGeneration, version 2.1.9 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Program Files (x86)\Jenkins\workspace\Windows Service Deployment\AspCore\AspCore.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.44
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE
Please take a look at this solution, it worked for me:
'dotnet build' command not finding NuGet packages (they exist)
so you just need to call this build command defining the nuget path in the jenkinsfile:
sh 'dotnet build --packages ./.nuget/packages'

Karma not running in Jenkins CI, Cannot find module 'karma-jasmine'

I'm setting up an Angular 4 SPA with automatic testing in Jenkins CI. The SPA is part of a larger, Maven-managed project, so the build is also Maven-managed. So far I've:
Installed the NodeJS plugin on Jenkins, using install from nodejs.org with version 8.6.0
Configured "Global npm packages to install" = "karma-cli phantomjs-prebuilt jasmine-core karma-jasmine karma-phantomjs-launcher karma-junit-reporter karma-coverage"
Added the "maven-karma-plugin" in pom.xml with browsers=PhantomJS / singleRun=true / reporters=dots,junit
Enabled "Provide Node & npm bin/ folder to PATH" on the Jenkins job configuration
The build process starts up quite ok, but eventually I get:
[INFO] --- maven-karma-plugin:1.6:start (default) # webclient ---
[INFO] Executing Karma Test Suite ...
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/karma start /var/lib/jenkins/workspace/funnel_build/webclient/karma.conf.js --browsers PhantomJS --reporters dots,junit --single-run
07 10 2017 17:07:52.801:ERROR [config]: Error in config file!
{ Error: Cannot find module 'karma-jasmine'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at module.exports (/var/lib/jenkins/workspace/funnel_build/webclient/karma.conf.js:9:7)
at Object.parseConfig (/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/karma/lib/config.js:410:5)
The npm install at the very beginning of the build logs:
$ /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/npm install -g karma-cli phantomjs-prebuilt jasmine-core karma-jasmine karma-phantomjs-launcher karma-junit-reporter karma-coverage
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/karma -> /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/karma-cli/bin/karma
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/phantomjs -> /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/bin/phantomjs
> phantomjs-prebuilt#2.1.15 install /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt
> node install.js
Considering PhantomJS found at /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1507388835905/phantomjs-2.1.1-linux-x86_64 -> /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
npm WARN karma-jasmine#1.1.0 requires a peer of karma#* but none was installed.
npm WARN karma-junit-reporter#1.2.0 requires a peer of karma#>=0.9 but none was installed.
npm WARN karma-phantomjs-launcher#1.0.4 requires a peer of karma#>=0.9 but none was installed.
+ karma-phantomjs-launcher#1.0.4
+ karma-coverage#1.1.1
+ karma-jasmine#1.1.0
+ karma-cli#1.0.1
+ karma-junit-reporter#1.2.0
+ jasmine-core#2.8.0
+ phantomjs-prebuilt#2.1.15
updated 7 packages in 10.553s
(The reason the package 'karma' is currently not on the list is that I read somewhere that karma-cli should be used in place of karma. Adding the 'karma' package doesn't change anything, however.)
Any idea why that "Cannot find module 'karma-jasmine'" pops up? In (2) you'll see that the karma-jasmine package is listed, I find it on the server, but still it's not found by the NodeJS plugin.
Thanks, Simon
I managed to get it to work by running "npm install" as part of the build process, and then run everything on local npm packages.
The entire setup is described here: https://funneltravel.wordpress.com/2017/10/16/running-karma-with-maven-on-jenkins-ci/

Jenkins: Build error

I recently encountered this build error in Jenkins:
Started by upstream project "sampapp-web-qa-build" build number 1445
originally caused by:
Started by user John Santiago
Started by upstream project "sampapp-web-qa-build" build number 1445
originally caused by:
Started by user John Santiago
Building on master in workspace C:\Program Files (x86)\Jenkins\workspace\sampapp-web-qa-update-db
> C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files (x86)\Git\bin\git.exe config remote.origin.url git#git.sampapp.com:sampapp/sampapp.git # timeout=10
Fetching upstream changes from git#git.sampapp.com:sampapp/sampapp.git
> C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe -c core.askpass=true fetch --tags --progress git#git.samapp.com:sampapp/sampapp.git +refs/heads/*:refs/remotes/origin/*
> C:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/testing^{commit}" # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/testing^{commit}" # timeout=10
Checking out Revision 3a23984ab747c25102bf5a2cbda83288565cd75a (refs/remotes/origin/testing)
> C:\Program Files (x86)\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe checkout -f 3a23984ab747c25102bf5a2cbda83288565cd75a
> C:\Program Files (x86)\Git\bin\git.exe rev-list 3a23984ab747c25102bf5a2cbda83288565cd75a # timeout=10
[sampapp-web-qa-update-db] $ cmd /c call C:\Users\Jenkins\AppData\Local\Temp\hudson8340343356667040511.bat
C:\Program Files (x86)\Jenkins\workspace\sampapp-web-qa-update-db>cd sampapp-web && npm install
npm WARN package.json MyFinancialsOnline#1.0.0 No repository field.
npm WARN package.json MyFinancialsOnline#1.0.0 No README data
[sampapp-web-qa-update-db] $ cmd /c call C:\Users\Jenkins\AppData\Local\Temp\hudson7963468173587450282.bat
C:\Program Files (x86)\Jenkins\workspace\sampapp-web-qa-update-db>cd sampapp-web && grunt update_db
[4mRunning "liquibase:update_mfp" (liquibase) task[24m
INFO 8/6/17 6:47 AM: liquibase: Successfully acquired change log lock
INFO 8/6/17 6:47 AM: liquibase: Reading from [dbo].[DATABASECHANGELOG]
INFO 8/6/17 6:47 AM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: Validation Failed:
1 change sets check sum
../samp-db/scripts/2017_06/changelog.xml::20170619_TCompany_Add_CabinetPath1::a.smith is now: 7:f4bbb21c04dcd157e94b19835b6ba71d
SEVERE 8/6/17 6:47 AM: liquibase: Validation Failed:
1 change sets check sum
../samp-db/scripts/2017_06/changelog.xml::20170619_TCompany_Add_CabinetPath1::a.smith is now: 7:f4bbb21c04dcd157e94b19835b6ba71d
liquibase.exception.ValidationFailedException: Validation Failed:
1 change sets check sum
../samp-db/scripts/2017_06/changelog.xml::20170619_TCompany_Add_CabinetPath1::a.smith is now: 7:f4bbb21c04dcd157e94b19835b6ba71d
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:196)
at liquibase.Liquibase.update(Liquibase.java:196)
at liquibase.integration.commandline.Main.doMigration(Main.java:1032)
at liquibase.integration.commandline.Main.run(Main.java:177)
at liquibase.integration.commandline.Main.main(Main.java:96)
For more information, use the --logLevel flag
[33mWarning: spawn OK Use --force to continue.[39m
[31mAborted due to warnings.[39m
Build step 'Execute Windows batch command' marked build as failure
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE
I see timeout in the error messages, could this be a timeout error?
I also see a validation failed message, could this be the cause of
the build error?
Could Git be the problem or have my files been corrupted somehow due to the validation error?

Resources