2

I have a pipeline that is executing scripts and some of them are 3third party scripts. in this case is Fastlane script.
Now in some rare cases, the Fastlane script is expecting the user to input value to stdin my question is how can I detect when a script is stoped and waiting to input. in this case, I like to throw an error and fail the task.
this is the pipeline task :

 - script:  |
     fastlane release --verbose projectName:${{parameters.projectName}} 
     echo 'Done invoking Fastfile'
    #failOnStderr: false 
    workingDirectory: '$(System.ArtifactsDirectory)/ios_artifacts'
    displayName: 'run fastlane'

And it stack in this idle state :

2020-10-12T06:46:27.5309820Z INFO [2020-10-12 06:46:27.52]: [32m------------------[0m
2020-10-12T06:46:27.5310570Z INFO [2020-10-12 06:46:27.53]: [32m--- Step: sigh ---[0m
2020-10-12T06:46:27.5311280Z INFO [2020-10-12 06:46:27.53]: [32m------------------[0m
2020-10-12T06:46:27.5362760Z 
2020-10-12T06:46:27.5386680Z +-------------------------------------+------------------------------+
2020-10-12T06:46:27.5387580Z |                      [32mSummary for sigh 2.162.0[0m                      |
2020-10-12T06:46:27.5388330Z +-------------------------------------+------------------------------+
2020-10-12T06:46:27.5389160Z | username                            | xxxx@xxxx.com       |
2020-10-12T06:46:27.5389530Z | app_identifier                      | com.xxxx.xxxx |
2020-10-12T06:46:27.5389950Z | team_id                             | xxxx                   |
2020-10-12T06:46:27.5390320Z | adhoc                               | false                        |
2020-10-12T06:46:27.5390730Z | developer_id                        | false                        |
2020-10-12T06:46:27.5391490Z | development                         | false                        |
2020-10-12T06:46:27.5391860Z | skip_install                        | false                        |
2020-10-12T06:46:27.5392280Z | force                               | false                        |
2020-10-12T06:46:27.5392650Z | ignore_profiles_with_different_name | false                        |
2020-10-12T06:46:27.5393070Z | skip_fetch_profiles                 | false                        |
2020-10-12T06:46:27.5393450Z | skip_certificate_verification       | false                        |
2020-10-12T06:46:27.5393860Z | platform                            | ios                          |
2020-10-12T06:46:27.5394230Z | readonly                            | false                        |
2020-10-12T06:46:27.5394630Z | fail_on_name_taken                  | false                        |
2020-10-12T06:46:27.5395400Z +-------------------------------------+------------------------------+
2020-10-12T06:46:27.5395640Z 
2020-10-12T06:46:27.5396350Z INFO [2020-10-12 06:46:27.53]: Starting login with user 'xxxx@xxxx.com'
2020-10-12T06:46:27.5559840Z Reading keychain entry, because either user or password were empty
2020-10-12T06:46:27.5560420Z Loading session from environment variable
2020-10-12T06:46:27.7305500Z Session loaded from environment variable is not valid. Continuing with normal login.
2020-10-12T06:46:28.7278420Z Two-factor Authentication (6 digits code) is enabled for account 'xxxx@xxxx.com'
2020-10-12T06:46:28.7279570Z More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915
2020-10-12T06:46:28.7279880Z 
2020-10-12T06:46:28.7280520Z If you're running this in a non-interactive session (e.g. server or CI)
2020-10-12T06:46:28.7281300Z check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification

How can i monitor this state ? and fail the pipeline ?

user63898
  • 29,839
  • 85
  • 272
  • 514
  • How long it is waiting for the input until task fails? – Krzysztof Madej Oct 12 '20 at 09:32
  • the timeout of the task is 30 min , i don't want it to be timeout based – user63898 Oct 12 '20 at 09:33
  • I just wanted to know it. And typical whole execution plan, how long does it take? And as far as I understood you need sth to check state of existing pipeline and fail it when it asks for credentials. – Krzysztof Madej Oct 12 '20 at 09:43
  • i have the runs API that checks status every 1 min , and it is not failing as it in process status when it is waiting for user input i don't what to wait 30 min to fail the pipeline .. – user63898 Oct 12 '20 at 10:13
  • You can try to close stdin with `exec 0<&-` before calling fastlane. See https://stackoverflow.com/questions/11204070/fail-if-a-script-expects-input-or-entering-passwords – Wolfgang Kuehn Oct 12 '20 at 20:01

1 Answers1

1

How can i monitor this state ? and fail the pipeline ?

As far as I know, this could not be possible. Currently, the azure devops pipeline does not provide such a built-in feature that can detect the script waiting for input and fail the pipeline. It should be an easy way to set the timeout you want for the task timeoutInMinutes: number # how long to wait before timing out the task to make it fail based on timeout, but it seems you don't want this.

You could add your request for this feature on our UserVoice site, which is our main forum for product suggestions. After suggest raised, you can vote and add your comments for this feedback. The product team would provide the updates if they view it.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
  • Thanks Hugh can you look at this question : https://stackoverflow.com/questions/64320579/azure-self-hosted-agent-a-session-for-this-agent-already-exists-when-running – user63898 Oct 13 '20 at 08:30