Git Product home page Git Product logo

ci-env's Introduction

ci-env's People

Contributors

6543 avatar iamogbz avatar kikobeats avatar kuldeepkeshwar avatar lironer avatar mohsinulhaq avatar montmanu avatar njzjz avatar penx avatar siddharthkp avatar swapnilmishra avatar walshydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ci-env's Issues

Add Azure Pipelines

I'm happy to make a PR. Also happy to help co-maintain the module if you like!

repository hosting platform

Coming from here siddharthkp/bundlesize#158 I checked if we can get the platform where the repository is actually hosted.

Travis : From here we can conclude that Travis supports only github.com.

Circle : There's an env variable CIRCLE_REPOSITORY_URL. Check here.

Wercker : They have WERCKER_GIT_DOMAIN. Check here

Drone : I'm not sure between DRONE_REMOTE_URL and DRONE_REPO_LINK. Check here.

We can either send repo url or the name of the hosting platform.

BUG: Version 1.5.1 fails in CircleCI 2 when reading CI_PULL_REQUEST

Bug Report

Version: 1.5.1 (assumed 1.5.0 also)
Environment: Circle CI 2.0


Yesterday morning our Circle CI 2.0 job started failing with this error:

/home/circleci/project/node_modules/ci-env/index.js:29
  pull_request_number = process.env.CI_PULL_REQUEST.split('/').pop() // take number from returns url
                                                   ^

TypeError: Cannot read property 'split' of undefined
    at Object.<anonymous> (/home/circleci/project/node_modules/ci-env/index.js:29:52)

The failure occurs when trying to submit the initial status from the dependent repo bundle size (https://github.com/siddharthkp/bundlesize/blob/master/src/init-status.js). This error was only occurring on our main branch, but not on individual pull request runs. That makes me think there was some kind of involvement in the "picked randomly" PR numbers for merges, quoted below. Possibly the build number exists for the PR, then there's a fast-forward of the main branch, and that causes the duplication interaction. But I'm speculating there. The docs for these env variables: (https://circleci.com/docs/2.0/env-vars/#build-details)

CIRCLE_PULL_REQUESTS
Comma-separated list of pull requests this build is a part of.
CIRCLE_PULL_REQUEST
If this build is part of only one pull request, its URL will be populated here. If there was more than one pull request, it will contain one of the pull request URLs (picked randomly).
CI_PULL_REQUESTS
Same as CIRCLE_PULL_REQUESTS, only kept for the backward compatibility with 1.0.
CI_PULL_REQUEST
Same as CIRCLE_PULL_REQUEST, only kept for the backward compatibility with 1.0.


I noticed the error coincided with this repo's released version 1.5.0 and 1.5.1 yesterday, so I attempted to manually pin the version 1.4.0. I also confirmed that version 1.5.1 was being installed prior to pinning 1.4. This was successful, the error ceased.

Allow custom CI implementations

ci-env supports travis, circle, wercker and drone right now.

But, there are self hosted or containerised environments where these will not be used.

We can add support for those by supporting generic environment variables.

else if (process.env.CI === 'custom') {
   repo = process.env.CI_REPO,
   branch = process.env.CI_BRANCH
   ...
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.