vsts phase conditions: How to continue with next phase? - azure-devops

I have a build steps like:
- ...
- npm install
- npm start sb:server (start http-server to serve static files)
- npm run e2e
By the npm start sb:server; it starts the server and it hangs... and doesn't go the next phase which is npm run e2e.
I would like to add a condition to npm run e2e that it should just start without looking previous phase state (failed or succeeded).
I have checked the https://learn.microsoft.com/en-us/vsts/pipelines/process/conditions?view=vsts#job-status-functions
I can't figure out what kind of command I have to set in 'custom condition' field..
Any help would be appreciated!

Every task has a "continue on error" checkbox. Check that. Then, if that task fails, it is treated as a warning, not an error. Execution of subsequent tasks will happen normally.

I suspect that the npm start sb:server must keeps running so that it can be used all the time. So the command is never finished. The workaround is using cmd task to start another cmd task and run the npm start command in new cmd.

Related

VSTFS build failed at Publish step

I am using the VSTFS CI/CD pipeline to automate my .NET Core 5.0 with Angular 12 web application.
It failing the build at Publish step (see below screenshot) with error:
'npm' is not recognized as an internal or external command,
2021-12-13T20:19:46.9855025Z operable program or batch file.
2021-12-13T20:19:46.9917349Z D:\TFSBuildAgent\_work\58\s\src\WebUI\WebUI.csproj(85,5): error MSB3073: The command "npm install" exited with code 9009.
2021-12-13T20:19:47.0482106Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2021-12-13T20:19:47.0496257Z ##[error]Dotnet command failed with non-zero exit code on the following projects :
What could be the issue?
Thanks
It looks like npm is not found by the agent. Make sure Node is installed globally on the machine and npm has been added to the system wide path environment variable.
Or add the Node Tool Installer task to your workflows.
I fixed the issue by deleting the npm publish tag in WebUI project file.

Capistrano continues with next tasks after assets:precompile for webpack fails when running locally

After assets: precompile fails when compiling the webpacker pack locally, Capistrano continues with the next steps of the deployment. Resulting in the application being deployed with the Javascript files missing.
Is there something special that has to be done in the locally run tasks so Capistrano exits without running the following tasks? Or is it a problem from webpacker that is not raising an exception?
I'm precompiling the assets locally with this task:
run_locally do
execute "RAILS_ENV=production bundle exec rake 'assets:clean'"
execute "RAILS_ENV=production bundle exec rake 'assets: precompile'"
end

How to fix ' Disconnected, because no message in 10000 ms.' error while trying to run karma unit test?

I am getting 'Disconnected, because no message in 10000 ms' error while trying to run karma unit tests. This error triggered only after the installation of webdriver-manager ( to run protractor) and ran unit tests successfully before this installation.
I assumed that the error might be hitting since webdriver is up and running. So,I passed command 'webdriver-manager shoutdown' to stop it. but,it showed that no server is up and running.
My requirement is to run both protractor functional test and karma unit tests in same machine without any error.
Found the solution for this issue by myself.
Solution: Install angular cli using the command 'npm install -g #angular/cli'.
I am able to execute both karma unit tests and protractor functional tests in my system without any issue after installing angular cli.

how to fix ionic application error when we serve the application

When we run this command (ionic lab) then it show this error.
how we solve it..
ng run app:serve --host=0.0.0.0 --port=8100
[ng] The run command requires to be run in an Angular project, but a project definition could not be found.
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
check the command line if you are in the directory containing package.json and run the following commands:
npm install
ionic serve
It seems you are not inside the right folder. You have to run your ng run command in the same place your runned your ng new command (or wherever you have initialized your Angular project).

Continuous Integration: Codeship + Gulp (Jasmine)

My Continuous Integration works pretty great using Codeship except one thing: stop deploying and alert us when unit tests are failing.
Here is our current commands:
npm install
npm install bower
bower install
gulp test
gulp build
The problem is whether gulp test end with success or fail, the gulp build builds.
I succeed to console.log() my gulp test exit status but I have no idea about how to make Codeship listen to this exit status.
The build on Codeship will fail as soon as any command exits with an exit code other than zero.
Please make sure this is the case with running gulp test.
(You can also reach out to us via support#codeship.com if any other questions come up!)
Using #mlocker answer and this discussion on Github, I've found a workaround that works fine for me:
gulp.task('test', function (done) {
karma.start({}, function(exitStatus){
done(exitStatus ? "There are failing unit tests" : undefined);
});
});
The trick here is that if the exitStatus is different from 0, you'll get a formatError on "There are failing unit tests" which will exit gulp test with 1 making Codeship to stop and consider the build as failed.
maybe you can try chaining the test and build tasks?
gulp test && gulp build