Ignore subsequent goals in Makefile - makefile

I have a Makefile that allows me to check if a service is running:
make status [service]
E.G.
make status app
make status database
I would like to add another goal that allows me to check some application statistics:
make app status
However, after running the "app" goal, make tries to run the "status" goal. How can I tell make to exit after running a goal?
I have tried adding exit to the app goal, but this just stops the execution of app - make still proceeds to status.

Related

How to make github actions step fail if the previous step has failed?

I have written a ci process to build and deploy docker images using github actions. There is a strange behavior seen i.e. when the make file fails due to any reason the steps in the github actions are still continued instead of stopping at the failed step. I am using only one job in my ci and multiple steps within it.
Example error: make[1]: [../../Makefile:22: docker-build-generic] Error 1 (ignored)
Github Actions do not actually run sequentially: they will run in parallel if there are enough resources. If one job relies on another, use the needs syntax.
Modified example from the documentation:
jobs:
job1:
job2:
needs: job1
Here job2 will wait for job1 to succeed before running. If job1 fails, job2 will not run.

How to write code which runs upon a Gitlab Job's timeout/fail?

Sometimes a job timeouts and gets killed which results in specific resources remaining locked.
Thus the next job fails instantly because it can't access some resources.
Is there a way tell GitLab to run a script upon timeout/fail? (which would unlock all "possibly locked" resources)
As described in the documentation (https://docs.gitlab.com/ee/ci/yaml/#when) , you could create a seperate job in the next stage that uses when: on_failure to clean up resources.
cleanup_build_job:
stage: cleanup_build
script:
- cleanup build when failed
when: on_failure
For this to work, of course your previous job would need to fail. You can manually define timeouts per job as for example:
build:
script: build.sh
timeout: 10 minutes
The on_failure job is executed when at least one job in an earlier stage fails, so if you have multiple jobs before, you might need to use additional variables to validate if the cleanup should be run.

Jenkins : run app and command in same time

I want to know if it exists a way or not to run an app in Jenkins job then run commands meanwhile app is running. I explain my situation, I need to audit my website in my pipeline with Asqatasun services but to do it I need to have an app is running. The problem is : if my app is running, commands below are not going to be executed until app is going shutdown.
Do you know a way to run an app and execute command in same time please ?
You can run your pipeline while your app is up and running. Jenkins pipeline has it's own workspace where your pipeline will be executed under the jenkins user. There your code will be cloned and all commands will be executed. It won't affect your on going running app.

Run delete project command only when the step above in Travis is executed successfully

I want to run the
oc delete project command only if the the step above terminates with code 0
You might want to check out the after_success after_success tag.
after_success - when the build succeeds (e.g. building documentation), the result is in TRAVIS_TEST_RESULT environment variable
The use of after_success tag allows to exec a give action only in case of success of the build.

How to automatically git pull and rebuild app on remote server when required?

When i want to update my app running on server, i should ssh to server, cd to app folder, execute git pull, then i should run npm build, next i should restart the server. How to automate this with bash script or something? Is it the case for which jenkins stands for (or some other tools)?.
But how to do this with simple bash script or something?
I dont need the rebuilding of an app every time i push to git, only when i need to update and restart everything.
Also it there a way if build take a lot of time notify me by email that build success?
For now eery time i do update for remote app, i should wait with open terminal when it builded and only then i can close the sshed terminal. Some time builds take a lot of time.
You can simply script those commands, and put that script on your server.
That way, all you need to do is to ssh to that server and call that script, which will execute those commands on demand.
Is it the case for which jenkins stands for (or some other tools)?
Not in this case, since it is purely on demand: you can execute the script through a simple ssh call, no need for Jenkins.

Resources