runWithConfig method
Runs this command with prepared configuration (options). Subclasses should override this method.
Implementation
@override
Future<void> runWithConfig(
final Configuration<BuildSecretSetCommandConfig> commandConfig,
) async {
final projectId = commandConfig.value(
BuildSecretSetCommandConfig.projectId,
);
final name = commandConfig.value(BuildSecretSetCommandConfig.name);
final buildSecretType = commandConfig.value(
BuildSecretSetCommandConfig.buildSecretType,
);
final valueToSet = commandConfig.valueOrFileContent(
value: BuildSecretSetCommandConfig.value,
valueFile: BuildSecretSetCommandConfig.valueFile,
);
final apiCloudClient = runner.serviceProvider.cloudApiClient;
try {
await apiCloudClient.secrets.upsertBuildSecret(
cloudCapsuleId: projectId,
secretKey: name,
secretValue: valueToSet,
buildSecretType: buildSecretType,
);
} on InvalidValueException catch (e) {
throw FailureException(error: e.message);
} on Exception catch (e, s) {
throw FailureException.nested(e, s, 'Failed to set build secret');
}
logger.success('Successfully set build secret: $name.');
}