microsoft / vsts-cloudfoundry

Azure DevOps Extension for Cloud Foundry
MIT License
20 stars 23 forks source link

cf login will prompt for password if the provided authentication is incorrect #31

Open adriaanthomas opened 4 years ago

adriaanthomas commented 4 years ago

How to reproduce

Use the task Cloud Foundry in a pipeline, and set it to use a service connection that has an incorrect password. When running the pipeline, the following output is generated:

==============================================================================
Task         : Cloud Foundry
Description  : Push your applications to Cloud Foundry
Version      : 1.147.0
Author       : Microsoft
Help         : 
==============================================================================
93342fdf-b570-48ea-9143-798dc8cee68f exists true
[command]/usr/bin/cf login -a https://api.pcf.company.com/ -u *** -p *** -o company -s my-space
API endpoint: https://api.pcf.company.com/
Authenticating...
Credentials were rejected, please try again.

Password> stty: 'standard input': Inappropriate ioctl for device

Expected behaviour

The task stops running immediately after the login has been rejected, and fails with a clear error message.

Actual behaviour

cf login prompts for a password on standard input, and the task waits forever, blocking the pipeline and the agent it uses.

Remarks

According to this comment, cf login should not be used, but cf api and cf auth instead;

Please use cf api and cf auth for non-interactive mode scripts. cf login orchestrates those two (and cf target) for a more (beginning) user friendly experience with prompting.