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

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

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.

How can I solve error in teamcity (Nunit)?

Recently our NUnit build configuration has occasionally stopped halfway through the tests, but the overall build outcome is successful . When I look at the build log, the last test that actually got executed shows:
Process exited with code -100 (Step: tests (NUnit))
and then the build stops. Under "Failure Conditions". Our NUnit Consol is 3.10.0 .
Below is our NUnit configuration image.
I've found this comment in the TeamCity YouTrack. Seems, dotnet projects aren't supported in NUnit build step.
Try to use .NET CLI build step with "dotnet test" command to run tests in this project. Does it work?

vsts phase conditions: How to continue with next phase?

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.

Edeliver failing to start release

When running mix edeliver version production locally it fails with the following output
EDELIVER MYAPP WITH VERSION COMMAND
-----> getting release versions from production servers
production node:
user : app_user
host : my_app
path : /home/app_user/my_app.io
response: bash: line 4: bin/my_app: No such file or directory
bash: line 47: bin/my_app: No such file or directory
VERSION DONE!
The error is obvious, as the executable lives in: ~/my_app.io/my_app/_build/prod/rel/my_app/bin
I'm also unable to run any of the start/stop/restart etc commands
The deployment was successful because when I ssh in, and run the start command it works.
I would like to know if anyone can point me in the direction of some config parameter that I'm missing, as the local commands are a lot more efficient.
Figured out the problem
I only built my app by running the following: env MIX_ENV=prod mix edeliver build release
I was probably too excited and forgot to actually deploy the release using something similar to the following mix edeliver deploy release to production --version=0.0.1
Hope someone else might benefit from this also.

Android UiAutomator test case jar file is not working

I have been trying to write some instrumental test case of android code using UiAutomator tool. This test cases can be run via android studio without any problem. But now i want to install this test cases into device as a jar file and need to run via command line. I had tried the following link for building and deploying uiautomator tests:
https://stuff.mit.edu/afs/sipb/project/android/docs/tools/testing/testing_ui.html#creating
build.xml is generated but when command "ant build" is executed it shows error:
Android/Sdk/tools/ant/uibuild.xml:198: null returned: 1
After that i have tried to create jar files using gradle build instead of ant build tool using this link
http://wiliamsouza.github.io/#/2013/10/30/android-uiautomator-gradle-build-system
I have run the "gradle build" command from the project directory and output got;
Building dex...
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
:check
:build
BUILD SUCCESSFUL
Total time: 7.709 secs
but there was no jar file found in "dist" folder. In have installed jar file found in build/libs folder,
adb push sample-0.1.jar /data/local/tmp/
then tried to run the test cases using the command
adb shell uiautomator runtest sample-0.1.jar -c com.test.uiautomator.sample.Sample
But it shows error as:
INSTRUMENTATION_RESULT: shortMsg=java.lang.RuntimeException
INSTRUMENTATION_RESULT: longMsg=Didn't find
class"com.test.uiautomator.sample.Sample"
on path: DexPathList[[zip
file"/system/framework/android.test.runner.jar",
zip file"/system/framework/uiautomator.jar",
zip file"/data/local/tmp/sample-0.1.jar"],
nativeLibraryDirectories=[/vendor/lib, /system/lib]]
INSTRUMENTATION_CODE: 0
Is anyone have any idea on this.. how can i create jar files of my uiautomator test cases and how can i run them via command line..?
Got a Solution !!!
Actually my requirement was to run instrumental test cases (UiAutomator in my case)through command line, for this purpose it is not necessary to generate a jar file of the test classes and install them to devices, instead we can create separate apk file of test case package and install them in the same way as application apk file is installed. And then run adb commands for executing the test cases. Please check the below link which has the detailed explanation.
https://developer.android.com/studio/test/command-line.html#RunTestsCommand