-
Notifications
You must be signed in to change notification settings - Fork 9
Remove custom check for CI in favor of using Fastlane's one #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,7 @@ def initialize(params = {}) | |
end | ||
|
||
def source_contents | ||
# TODO: This works only on CircleCI. I chose this variable because it's the one checked by Fastlane::is_ci. | ||
# Fastlane::is_ci doesn't work here, so reimplementing the code has been necessary. | ||
# (This should be updated if we change CI or if fastlane is updated.) | ||
return File.read(secrets_repository_file_path) unless self.encrypt || ENV.key?('CIRCLECI') | ||
return File.read(secrets_repository_file_path) unless self.encrypt || FastlaneCore::Helper.is_ci? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See To test this change, I run the tests as usual first, the re-run them for this file with
I got the following failure:
That's exactly the failure I would expect to get: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That also means that the test is failing on CI though 😓😛 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤦♂️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤦♂️ is not enough of a reaction... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return nil unless File.file?(encrypted_file_path) | ||
|
||
encrypted = File.read(encrypted_file_path) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,19 +69,17 @@ | |
|
||
describe '#source_contents' do | ||
it 'gets the contents from the secrets repo' do | ||
set_circle_env(false) do | ||
allow(File).to receive(:read).with(subject.secrets_repository_file_path).and_return('source contents') | ||
expect(subject.source_contents).to eq('source contents') | ||
end | ||
allow(FastlaneCore::Helper).to receive(:is_ci?).and_return(false) | ||
allow(File).to receive(:read).with(subject.secrets_repository_file_path).and_return('source contents') | ||
expect(subject.source_contents).to eq('source contents') | ||
end | ||
end | ||
|
||
describe '#source_contents on ci' do | ||
it 'gets the contents from the secrets repo' do | ||
set_circle_env(true) do | ||
allow(File).to receive(:read).with(subject.secrets_repository_file_path).and_return('source contents') | ||
expect(subject.source_contents).to eq(nil) | ||
end | ||
allow(FastlaneCore::Helper).to receive(:is_ci?).and_return(true) | ||
allow(File).to receive(:read).with(subject.secrets_repository_file_path).and_return('source contents') | ||
expect(subject.source_contents).to eq(nil) | ||
Comment on lines
-81
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having to work on this made me wonder whether it is appropriate for I was tempted to leave a
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I've never liked the way that this was all hosted in FileReference, this would definitively benefit some restructuration and refactoring… but that's something to keep for later™ |
||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why the comment initially said that "
Fastlane::is_ci?
doesn't work here "?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure the reason is that
is_ci
is a Fastlane action and can't be called directly.If we put it in here, we get a no method error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. As opposed to calling the helper directly as you did here 👍👌