Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Distinguish CI command runs from the rest #3233

Closed
andremedeiros opened this issue Nov 5, 2014 · 16 comments
Closed

Distinguish CI command runs from the rest #3233

andremedeiros opened this issue Nov 5, 2014 · 16 comments
Assignees

Comments

@andremedeiros
Copy link
Member

Right now, the commands are being reported and counted without differentiation as to their source.

@indirect suggests we should split them up by source when they run on CI systems.

A brief research wielded these environment variables we can use to pinpoint what CI system is running:

  • Travis CI: TRAVIS (or, even better, HAS_JOSH_K_SEAL_OF_APPROVAL); /cc @joshk
  • CircleCI: CIRCLECI (or any of the other env variables it sets when starting a container);
  • Semaphore: SEMAPHORE;
  • Jenkins: JENKINS_URL;
  • Buildbox: BUILDBOX;
  • Codeship: CI_NAME set to codeship;
  • Go: GO_SERVER_URL;
  • SnapCI: SNAP_CI;

Let me know if I've missed anything before I do the work for this.

@andremedeiros andremedeiros self-assigned this Nov 5, 2014
@andremedeiros
Copy link
Member Author

Thanks for the research, @TimMoore!

Wouldn't we want to distinguish which is which tho?

@TimMoore
Copy link
Contributor

TimMoore commented Nov 5, 2014

Maybe so... and those links show which variables each system uses... I was just thinking that CI could be used as a fallback.

There are a bunch of other CI/CD systems out there now that I've missed, too... seems to be a very active area.

@joshk
Copy link
Contributor

joshk commented Nov 5, 2014

Is something wrong with Travis support?

On Thu, Nov 6, 2014 at 12:11 AM, Tim Moore [email protected]
wrote:

Maybe so... and those links show which variables each system uses... I was just thinking that CI could be used as a fallback.

There are a bunch of other CI/CD systems out there now that I've missed, too... seems to be a very active area.

Reply to this email directly or view it on GitHub:
#3233 (comment)

@andremedeiros
Copy link
Member Author

@joshk nothing at all, we're just planning on tagging command runs with specific CIs so that we can monitor those better.

@joshk
Copy link
Contributor

joshk commented Nov 6, 2014

@andremedeiros are you running the Bundler test suite on several CI systems?

@ixti
Copy link
Contributor

ixti commented Nov 6, 2014

@joshk that's for API usage monitoring :D

@joshk
Copy link
Contributor

joshk commented Nov 6, 2014

AAAHHHHHHHH

Well, we currently set a ruby agent for this. https://github.com/travis-ci/travis-cookbooks/blob/master/ci_environment/rvm/templates/default/bundler_config.yml.erb

But in any case, using TRAVIS or JOSH_K_SEAL_OF_APPROVAL is a good way to go.

@indirect
Copy link
Member

indirect commented Nov 6, 2014

Oh riiiiiight I completely forgot about that. I don't know if Bundler can even handle nested keys in its config, though. Checking the ENV is probably more reliable across services.

@joshk
Copy link
Contributor

joshk commented Nov 6, 2014

@indirect can you confirm/deny if our bundler config, which you advised us to add, is correct or not?


Sent from Mailbox

On Thu, Nov 6, 2014 at 4:56 PM, André Arko [email protected]
wrote:

Oh riiiiiight I completely forgot about that. I don't know if Bundler can even handle nested keys in its config, though. Checking the ENV is probably more reliable across services.

Reply to this email directly or view it on GitHub:
#3233 (comment)

@indirect
Copy link
Member

indirect commented Nov 6, 2014

@joshk to be honest, I can't even tell where that config ends up. Is it in ~/.bundle?

@joshk
Copy link
Contributor

joshk commented Nov 6, 2014

yes it is :)

@indirect
Copy link
Member

indirect commented Nov 6, 2014

@joshk change your file to look like this:

# ~/.bundle/config
BUNDLE_USER_AGENT: "travis-ci.<%= @suffix %>/1.0.0"

I added support for reading that in 8078db6.

fotanus pushed a commit to fotanus/bundler that referenced this issue May 14, 2015
This patch add CI information on the user_agent in order for us to track
if a given command was run by a CI, as discussed in rubygems#3233.
@simi
Copy link
Member

simi commented May 14, 2015

What about to distinguish command runs from non-interactive shells (CI, deploy, ...) also? But I'm not sure if that's easy to do universal check.

@fotanus
Copy link
Contributor

fotanus commented May 14, 2015

If this turns out to be interesting, I can look for a way on how to do. Maybe open a new issue for that one?

@segiddins
Copy link
Member

closed by #3646.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants