siddharthkp / ci-env

Environment variables exposed by CI tools
MIT License
40 stars 17 forks source link

repository hosting platform #7

Open vs1682 opened 7 years ago

vs1682 commented 7 years ago

Coming from here https://github.com/siddharthkp/bundlesize/issues/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.

siddharthkp commented 7 years ago

Passing the platform makes more sense to me 🙂

vs1682 commented 7 years ago

@siddharthkp - one quick question. The generic environment variables for custom ci , how do get them? Actually I'm thinking of using CI_REMOTE_REPO_URL for the repo url. Please let me know if it's okay.

siddharthkp commented 7 years ago

I don't think it's useful to use repo url, platform would be better (example: github, gitlab, bitbucket, etc.)

So in the case of custom, it would be CI_PLATFORM

vs1682 commented 7 years ago

Sorry, I didn't put my question correctly. Actually most of CI platforms provide repo url environment variable and i'm thinking of extracting the platform using regular expression. So I asked for the CI_REMOTE_REPO_URL. I'm thinking of using this pattern const pattern = new RegExp(/https:\/\/([a-z]+)/i).

siddharthkp commented 7 years ago

Ah, understood!

I think in custom CI, we follow the rule of directly asking for the information we need. So it makes more sense to ask for ci platform rather than ask for URL and then infer it.

vs1682 commented 7 years ago

Yes, I think that will be good idea. Thanks