feat(shorebird_cli)!: hard-error on shorebird login:ci (#3775)
This commit is contained in:
@@ -4,25 +4,25 @@ import 'package:shorebird_cli/src/shorebird_command.dart';
|
||||
|
||||
/// {@template login_ci_command}
|
||||
/// `shorebird login:ci`
|
||||
/// Deprecated — directs users to API keys instead.
|
||||
/// Removed — directs users to API keys instead.
|
||||
/// {@endtemplate}
|
||||
class LoginCiCommand extends ShorebirdCommand {
|
||||
@override
|
||||
String get description => 'Login as a CI user (deprecated).';
|
||||
String get description => 'Removed — use API keys instead.';
|
||||
|
||||
@override
|
||||
String get name => 'login:ci';
|
||||
|
||||
@override
|
||||
Future<int> run() async {
|
||||
logger.info(
|
||||
logger.err(
|
||||
'''
|
||||
${lightYellow.wrap('⚠ shorebird login:ci is deprecated.')}
|
||||
shorebird login:ci has been replaced by API keys.
|
||||
|
||||
To authenticate in CI, create an API key at ${link(uri: Uri.parse('https://console.shorebird.dev'))} and set it as your ${lightCyan.wrap('SHOREBIRD_TOKEN')} environment variable.
|
||||
Create an API key at ${link(uri: Uri.parse('https://console.shorebird.dev'))} and set it as your ${lightCyan.wrap('SHOREBIRD_TOKEN')} environment variable.
|
||||
|
||||
Existing tokens from login:ci will continue to work for now, but will stop working in a future release.''',
|
||||
Learn more: ${link(uri: Uri.parse('https://docs.shorebird.dev/account/api-keys/'))}''',
|
||||
);
|
||||
return ExitCode.success.code;
|
||||
return ExitCode.usage.code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,22 +36,23 @@ void main() {
|
||||
});
|
||||
|
||||
test('has correct description', () {
|
||||
expect(command.description, contains('deprecated'));
|
||||
expect(command.description, contains('Removed'));
|
||||
});
|
||||
|
||||
test('shows deprecation message and exits with code 0', () async {
|
||||
test('errors with usage exit code and points to API keys', () async {
|
||||
final result = await runWithOverrides(command.run);
|
||||
|
||||
expect(result, equals(ExitCode.success.code));
|
||||
expect(result, equals(ExitCode.usage.code));
|
||||
|
||||
final captured = verify(
|
||||
() => logger.info(captureAny()),
|
||||
() => logger.err(captureAny()),
|
||||
).captured;
|
||||
|
||||
final message = captured.single as String;
|
||||
expect(message, contains('shorebird login:ci is deprecated'));
|
||||
expect(message, contains('shorebird login:ci has been replaced'));
|
||||
expect(message, contains('console.shorebird.dev'));
|
||||
expect(message, contains('SHOREBIRD_TOKEN'));
|
||||
expect(message, contains('docs.shorebird.dev/account/api-keys'));
|
||||
});
|
||||
|
||||
test('does not trigger any auth flow', () async {
|
||||
|
||||
Reference in New Issue
Block a user