Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-36707

Set environment variable CI=true on all builds

      Very simple: set & expose environment variable `CI=true` on all builds as TravisCI or Drone or CircleCI or other CI tools do.

          [JENKINS-36707] Set environment variable CI=true on all builds

          Joerg Baeuerle added a comment - - edited

          Create-React-App also checks for the `CI` environment variable. The official documentation mentions 

          By default npm test runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called CI. [...] Popular CI servers already set the environment variable CI by default.

          see https://create-react-app.dev/docs/running-tests#continuous-integration.

          I would consider Jenkins being a "popular CI server" and create-react-app an extremely popular tool in web fronted development. So maybe this should be a default in Jenkins?!

          Joerg Baeuerle added a comment - - edited Create-React-App also checks for the `CI` environment variable. The official documentation mentions  By default npm test runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called CI . [...] Popular CI servers already set the environment variable CI by default. see https://create-react-app.dev/docs/running-tests#continuous-integration . I would consider Jenkins being a "popular CI server" and create-react-app an extremely popular tool in web fronted development. So maybe this should be a default in Jenkins?!

          Daniel Beck added a comment - - edited

          Maybe.

          Does the same apply to CONTINUOUS_INTEGRATION, why or why not?

          FWIW https://github.com/watson/ci-info/blob/f43f6a1cefff47fb361c88cf4b943fdbcaafe540/index.js#L53-L56 looks like a reasonable reference on which tools define which env vars.

          Daniel Beck added a comment - - edited Maybe. Does the same apply to CONTINUOUS_INTEGRATION , why or why not? FWIW https://github.com/watson/ci-info/blob/f43f6a1cefff47fb361c88cf4b943fdbcaafe540/index.js#L53-L56 looks like a reasonable reference on which tools define which env vars.

          Does the same apply to CONTINUOUS_INTEGRATION, why or why not?

          What exactly do you mean? Does what apply to CONTINUOUS_INTEGRATION?

          Joerg Baeuerle added a comment - Does the same apply to CONTINUOUS_INTEGRATION , why or why not? What exactly do you mean? Does what apply to CONTINUOUS_INTEGRATION ?

          Daniel Beck added a comment -

          Whether it should be added. This issue is only asking for CI to be added. The library I found supports CONTINUOUS_INTEGRATION to determine whether it runs in CI as well, which is apparently set by some tools.

          Daniel Beck added a comment - Whether it should be added. This issue is only asking for CI to be added. The library I found supports CONTINUOUS_INTEGRATION to determine whether it runs in CI as well, which is apparently set by some tools.

          Ah, I see. However, it looks like those servers (Travis, Cirrus) who set CONTINUOUS_INTEGRATION do also set CI. So mabye CI would be sufficient.

          Joerg Baeuerle added a comment - Ah, I see. However, it looks like those servers (Travis, Cirrus) who set CONTINUOUS_INTEGRATION do also set CI . So mabye CI would be sufficient.

          Leo Gallucci added a comment -

          I opened this issue 4 years ago, so much discussion for such a tiny change.

          Closing it now as I don't use Jenkins anymore.

          Leo Gallucci added a comment - I opened this issue 4 years ago, so much discussion for such a tiny change. Closing it now as I don't use Jenkins anymore.

          Daniel Beck added a comment -

          No need to close a reasonable request just because you don't need it anymore, votes and watchers indicate others are interested.

          Daniel Beck added a comment - No need to close a reasonable request just because you don't need it anymore, votes and watchers indicate others are interested.

          Leo Gallucci added a comment -

          can you remove me? I keep getting notifications even though I'm not a watcher

          Leo Gallucci added a comment - can you remove me? I keep getting notifications even though I'm not a watcher

          elgalu thanks for the community effort!

          danielbeck thanks for reopening.

          Joerg Baeuerle added a comment - elgalu thanks for the community effort! danielbeck thanks for reopening.

          manus added a comment -

          manus added a comment - Done in https://github.com/jenkinsci/jenkins/pull/5370 .

            manus manus
            danielbeck2 Not Daniel Not Beck
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: