Search code examples
macoscronbundlefastlane

Execute Fastlane Command missing Gem when operating cron job


When I go to Mac Terminal and execute my sh file with the following command set included, it runs smoothly. When I. allow my crop tab to execute evert hour between 9 am to 18 pm, it says the following exceptions

Fetching origin
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
Already on 'feature/sprint_1'
M   src/Podfile.lock
M   src/MyProject/Info.plist
Your branch is up to date with 'origin/feature/sprint_7'.
bundler: command not found: fastlane
Install missing gem executables with `bundle install`

At my project folder structure, Gemfile and Gemfile.lock exists. Do I need to ..

  1. modify Gemfile before executing my command set?
  2. execute my command with superuser sudo access?
  3. Given bundles and fastlane properly installed, How could I acknowledge my file path to execute is correct?

4.The below is my .sh file with following command set: Should I need to modify my command set also?

cd ~/myProject/src && git stash clear && git fetch --all && git pull && git checkout $1 && bundle exec fastlane ios build build_type:adhoc build_env:dev

Where $1 is my proposed branch e.g. master, release , feature/sprint_1


Solution

  • According to the last 3 rows of your logs which are:

    Your branch is up to date with 'origin/feature/sprint_7'.
    bundler: command not found: fastlane
    Install missing gem executables with `bundle install`
    

    and your script has cd, and 4 git commands at the beginning. I will assume $1 is master. It is basically like this:

    cd ~/myProject/src 
    git stash clear
    git fetch --all
    git pull 
    git checkout master # or $1
    bundle exec fastlane ios build build_type:adhoc build_env:dev
    

    Bundler says command not found: fastlane and then it shows the solution which is that you need to run bundle install.

    Probably when you add bundle install before bundle exec you will resolve your problem:

    cd ~/myProject/src 
    git stash clear
    git fetch --all
    git pull 
    git checkout master # or $1
    bundle install
    bundle exec fastlane ios build build_type:adhoc build_env:dev