Skip to content

Commit

Permalink
fix(shorebird_cli): detect Azure pipeline CI environment (#1811)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanoltman authored Mar 22, 2024
1 parent 0d67bfb commit 13de860
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/shorebird_cli/lib/src/shorebird_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,9 @@ class ShorebirdEnv {

// https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
||
platform.environment.containsKey('GITHUB_ACTIONS');
platform.environment.containsKey('GITHUB_ACTIONS')

// https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
||
platform.environment.containsKey('TF_BUILD');
}
5 changes: 5 additions & 0 deletions packages/shorebird_cli/test/src/shorebird_env_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ base_url: https://example.com''');
expect(runWithOverrides(() => shorebirdEnv.isRunningOnCI), isTrue);
});

test('returns true if TF_BUILD is set', () {
when(() => platform.environment).thenReturn({'TF_BUILD': 'True'});
expect(runWithOverrides(() => shorebirdEnv.isRunningOnCI), isTrue);
});

test('returns false if no relevant environment variables are set', () {
when(() => platform.environment).thenReturn({});
expect(runWithOverrides(() => shorebirdEnv.isRunningOnCI), isFalse);
Expand Down

0 comments on commit 13de860

Please sign in to comment.