Skip to content

Add support for Heroku CI environment variables#55

Merged
ArturT merged 5 commits intomasterfrom
heroku-ci
Nov 11, 2017
Merged

Add support for Heroku CI environment variables#55
ArturT merged 5 commits intomasterfrom
heroku-ci

Conversation

@ArturT
Copy link
Copy Markdown
Member

@ArturT ArturT commented Nov 8, 2017

To test branch:

# Gemfile
gem 'knapsack_pro', github: 'KnapsackPro/knapsack_pro-ruby', branch: 'heroku-ci'

Heroku docs:
https://devcenter.heroku.com/articles/heroku-ci#quick-start
https://devcenter.heroku.com/articles/heroku-ci-parallel-test-runs

@ArturT ArturT changed the title Add support for Heroku environment variables Add support for Heroku CI environment variables Nov 8, 2017
end

def project_dir
'/app' if node_build_id
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the project directory is always in /app directory on Heroku CI.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is as far as I know, and .git is not present.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikescar Ok. Actually, we don't need to care about project_dir when Heroku provides branch and git commit via ENV vars. I use project_dir only when I need to detect branch/git hash because they are not available via ENV for CI provider. In case of Heroku they expose branch/git hash so we should be good. The knapsack_pro won't use project_dir.

Comment thread lib/knapsack_pro/config/ci/heroku.rb Outdated
module CI
class Heroku < Base
def node_total
# not provided
Copy link
Copy Markdown
Member Author

@ArturT ArturT Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to be able to read from Heroku ENV info how many parallel CI nodes we have. For instance we have 5 parallel jobs on Heroku then the value for node_total should be 5.

If Heroku won't expose ENV then we can manually set KNAPSACK_PRO_CI_NODE_TOTAL

Comment thread lib/knapsack_pro/config/ci/heroku.rb Outdated
end

def node_index
# not provided
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should be able to read from Heroku ENV the index of current parallel node. It should start from 0. So in case when we have 5 node total then the node_index is within range 0 - 4.

If Heroku won't expose this node index then we can manually set KNAPSACK_PRO_CI_NODE_INDEX

@ArturT ArturT merged commit c6698b8 into master Nov 11, 2017
@ArturT ArturT deleted the heroku-ci branch November 11, 2017 16:05
@gudmundur
Copy link
Copy Markdown

Looks good to me. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants