SAP / jenkins-library

Jenkins shared library for Continuous Delivery pipelines.
https://www.project-piper.io
Apache License 2.0
781 stars 594 forks source link

In build environment variable NODE_ENV should be set to production #2194

Closed philippthiele closed 2 years ago

philippthiele commented 4 years ago

Hi,

the problem in short:

GitHub Repository url with workaround

https://github.wdf.sap.corp/CALMBuild/uam-userservice/blob/06a12ec14d7f6fbb9fbe04d757e6315522efb20b/.pipeline/config.yml#L29-L31

pipeline build stage

https://github.tools.sap/CALM/calm-dwc-jenkins-library/blob/797dfc9e198144132febb1fb9350177deebd4a01/vars/srvPipeline.groovy#L38

Describe the bug

As stated by CAP, it is common to set NODE_ENV environment variable to production in CI builds: https://cap.cloud.sap/docs/advanced/config#activation

How can the bug be reproduced?

Use different profiles in CAP for generation and build won't produce production artifacts

Expected behaviour

NODE_ENV is set to production

If you need more information, please let me know.

Thank you very much and best regards, Philipp

CCFenner commented 4 years ago

You can easily set this yourself in the Jenkins global settings. Would that be sufficient?

@fwilhe any hints from your side? Can this be set via configuration on the npm build step?

philippthiele commented 4 years ago

@CCFenner setting this manually works, but my point is, that if CAP is right and _Usually, in continuous integration (CI) builds and Cloud Foundry deployments, NODEENV is set to production automatically, then it should be set here automatically as well.

fwilhe commented 4 years ago

if CAP is right and _Usually, in continuous integration (CI) builds and Cloud Foundry deployments, NODEENV is set to production automatically, then it should be set here automatically as well.

I'm not sure about this convention. I think some research would be required to dig into this, to know if it should be enabled by default.

github-actions[bot] commented 2 years ago

Thank you for your contribution! This issue is stale because it has been open 60 days with no activity. In order to keep it open, please remove stale label or add a comment within the next 10 days. If you need a Piper team member to remove the stale label make sure to add @SAP/jenkins-library-team to your comment.

philippthiele commented 2 years ago

Hi, have you had time to look into it?

github-actions[bot] commented 2 years ago

Thank you for your contribution! This issue is stale because it has been open 60 days with no activity. In order to keep it open, please remove stale label or add a comment within the next 10 days. If you need a Piper team member to remove the stale label make sure to add @SAP/jenkins-library-team to your comment.

github-actions[bot] commented 2 years ago

Issue got stale and no further activity happened. It has automatically been closed. Please re-open in case you still consider it relevant.