1
votes

I try to install via Azure DevOps pipeline on Mac agent and i keep getting this error : - task: CmdLine@2 inputs: script: 'mkdir ios'

  - script: |
     cd ios 
     gem install bundler

     bundle update --bundler

     bundle install
     
    workingDirectory: ios
    displayName: 'Ruby bundle setup'

Error :

2020-09-06T11:54:07.5917840Z ##[section]Starting: Ruby bundle setup
2020-09-06T11:54:07.5928350Z ==============================================================================
2020-09-06T11:54:07.5928740Z Task         : Command line
2020-09-06T11:54:07.5929150Z Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-09-06T11:54:07.5929490Z Version      : 2.164.2
2020-09-06T11:54:07.5929750Z Author       : Microsoft Corporation
2020-09-06T11:54:07.5930170Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-09-06T11:54:07.5930590Z ==============================================================================
2020-09-06T11:54:07.7401990Z Generating script.
2020-09-06T11:54:07.7424640Z ========================== Starting Command Output ===========================
2020-09-06T11:54:07.7456160Z [command]/bin/bash --noprofile --norc /Users/runner/work/_temp/d9733c1e-f521-48ca-aa7c-9d3b24c88953.sh
2020-09-06T11:54:07.7526110Z /Users/runner/work/_temp/d9733c1e-f521-48ca-aa7c-9d3b24c88953.sh: line 1: cd: ios: No such file or directory
2020-09-06T11:54:12.3083310Z Successfully installed bundler-2.1.4
2020-09-06T11:54:12.3084130Z Parsing documentation for bundler-2.1.4
2020-09-06T11:54:12.3084780Z Installing ri documentation for bundler-2.1.4
2020-09-06T11:54:12.3085110Z Done installing documentation for bundler after 3 seconds
2020-09-06T11:54:12.3085430Z 1 gem installed
2020-09-06T11:54:12.6954440Z Could not locate Gemfile
2020-09-06T11:54:13.1617230Z Could not locate Gemfile
2020-09-06T11:54:13.1694000Z 
2020-09-06T11:54:13.1763400Z ##[error]Bash exited with code '10'.
2020-09-06T11:54:13.1779990Z ##[section]Finishing: Ruby bundle setup

even if i follow this tutorial : https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/ruby?view=azure-devops

i still getting :

2020-09-06T12:27:31.6476200Z ##[section]Starting: bundle install
2020-09-06T12:27:31.6490380Z ==============================================================================
2020-09-06T12:27:31.6490780Z Task         : Command line
2020-09-06T12:27:31.6491150Z Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-09-06T12:27:31.6491570Z Version      : 2.164.2
2020-09-06T12:27:31.6491830Z Author       : Microsoft Corporation
2020-09-06T12:27:31.6492250Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-09-06T12:27:31.6492690Z ==============================================================================
2020-09-06T12:27:31.8007410Z Generating script.
2020-09-06T12:27:31.8038100Z ========================== Starting Command Output ===========================
2020-09-06T12:27:31.8070710Z [command]/bin/bash --noprofile --norc /Users/runner/work/_temp/79d6c766-b735-4025-8576-a11120d84585.sh
2020-09-06T12:27:36.4057030Z Successfully installed bundler-2.1.4
2020-09-06T12:27:36.4068290Z Parsing documentation for bundler-2.1.4
2020-09-06T12:27:36.4073040Z Installing ri documentation for bundler-2.1.4
2020-09-06T12:27:36.4116410Z Done installing documentation for bundler after 3 seconds
2020-09-06T12:27:36.4130600Z 1 gem installed
2020-09-06T12:27:36.7989650Z Could not locate Gemfile
2020-09-06T12:27:36.8083080Z 
2020-09-06T12:27:36.8160820Z ##[error]Bash exited with code '10'.
2020-09-06T12:27:36.8177100Z ##[section]Finishing: bundle install
1

1 Answers

1
votes

Azure devops pipeline on mac agent : Could not locate Gemfile when bundle install

According to the error message:

Could not locate Gemfile

It seems we do not have Gemfile in the workspace directory.

To resolve this issue, we need run bundle init first and after that bundle install.

As test, I add bundle init in your CmdLine task like following, and it works fine:

- script: |
   mkdir ios
   
   cd ios
   
   gem install bundler
   
   bundle init
   
   bundle update --bundler
   
   bundle install
   
  displayName: 'Ruby bundle setup'

The result:

enter image description here