Cannot execute multiple shell scripts in a row

Hello all,

I’ve run into a problem while building a new workflow.

Here’s the premises and the issue:

  • I’m building a workflow which automates the code release process
  • It’s based on a couple of steps - for creating a release branch on git, opening Pull Requests, creating JIRA tickets etc etc
  • Each step has its own, separate .sh script file

Here’s the issue:
The scripts work fine when invoked separately (both on CircleCI and when tested locally), but when I try to run the entire workflow - one script after another - here’s what happens:

  1. Script #1 runs as expected
  2. Script #2 can not be found and executed and the workflow fails

What’s interesting is that I’ve tried debugging this via SSH and it seems that as soon as that first script is executed, it gets deleted along with all the other scripts which were added with this particular commit. As if executing any script ‘resets’ the state of the folder / deletes some of the files inside of it.

Notes:

  • The order in which i run the script as well as the scripts themselves don’t matter - it’s always the same story - first one in order gets executed correctly, and then the next one fails and bunch of files disappear from the scripts folder
  • None of the scripts contains anything that could delete or edit those files / directories.
  • Executing the scripts as one sh block in config.yml did not help
  • Executing the scripts via fastlane did not help
  • Executing the scripts directly as steps did not help

The config looks something like (i can’t really upload the entire config for security reasons):

    steps:
      - checkout:
          path: ~/project
      - merge_translations
      - create_release_branch
      - create_release_ticket
      - create_pull_request

Each of the steps is calling their respective command from top of the config:

Example:

commands:
  create_pull_request:
    steps:
      - run:
          name: Create Pull Requests
          command: bash ../.circleci/scripts/create_pull_request.sh      

Here’s the screenshot from when I was connected to the CircleCI machine via SSH - from before the script was executed, and after - when all files got deleted for some reason:

I can say that I do not have an answer for you, but to help others can you share more detail about the executor environment you are running?

Thanks for the answer, yes - sorry about that, totally forgot about that piece of info.

    executor:
      name: android/android-machine
      resource-class: large

Hello all!

It (unsurprisingly) turned out to be my fault. The issue was that I used a git checkout [branch] step in my scripts (when it wasn’t even necessary) and the machine checked out to a whole, other branch after each executed script. This naturally caused the files from other branches to not be there.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.