Jenkins build fails with "Treating warnings as errors because of process.env.CI = true"
Asked Answered
T

2

18

After updating the Jenkins, all builds started to fail with the following errors.

[ERROR] {some text}: {some text} is outdated. Please run next command `npm update`
[INFO] Treating warnings as errors because process.env.CI = true.
[INFO] Most CI servers set it automatically.

How can I fix this for all builds?

Tressa answered 25/6, 2021 at 15:23 Comment(1)
Practically, I have never seem to have found a solution to this problem. Though somehow my npm run build is running properly and build is success. This is very annoying variable.Consonance
T
43

This is a result of this change:

https://issues.jenkins.io/browse/JENKINS-36707

It has introduced the standard CI env var that is always set to true in order to allow pipelines and tools to know they're executing in a continuous integration context.

This has emerged as a best practice used by most other popular CI solutions, and a number of tools look for this variable in order to make CI-appropriate optimizations.

You can set CI env variable to false through Manage Jenkins > Configure System > Global properties section. enter image description here

Add a new env variable CI with the value false. enter image description here

Tressa answered 25/6, 2021 at 15:23 Comment(0)
S
3

If your build uses a Jenkinsfile, you may prefer to add

    environment {
        CI = false          // do not treat warnings as errors
    }

to it, allowing the build to work independent from the Jenkins configuration.

Slifka answered 27/7, 2023 at 14:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.