We have a project where we deploy the application via GitLab. For the project we generate CSS, JS and other frontend files via “npm install” and then “npm run prod”. After run prod, we put all the generated files into an artifact, so we can deploy the files at the last stage.
The problem was that the job (npm run prod) succeded, but there were no artrifacts uploaded at all. Please, see attached image above.*
- GitLab 15.2.2-ee
- Runner: 15.2.1
- GitLab Shell14.9.0
- GitLab Workhorsev15.2.2
- GitLab APIv4
- GitLab Pages1.61.1
- GitLab KAS15.2.0
The Gitlab CI/CD stage in question:
npm_run_prod: extends: .npm_run script: - npm install - npm run prod only: - master
.npm_run: stage: build image: node:12.18.3 artifacts: paths: - public/documents - public/audio - public/images - public/fonts - public/img - public/webfonts - public/js - public/css - public/static/css/jquery.cookiebar.css - public/static/js/jquery.cookiebar.js - public/static/js/cookie.policy.js - public/mix-manifest.json
Interestingly re-running the pipeline, the task succeeded without an issue.
We would like to implement a rule to STOP the whole pipeline if there are no artifacts available to upload. The reason is, our application got deployed to production environment but without any frontend. Can you tell me how can I achieve that please?
Thanks for taking the time to be thorough in your answers, it really helps!