SSHRsaPrivateKey: required variable is not present

Description of the issue

I have a android build-and-test-android workflow followed by a iOS build-and-test-ios workflow.
When It reaches build-and-test-ios chained workflow, the Activate SSH Key (RSA Private Key) step fails with following error:

failed to parse config:
- SSHRsaPrivateKey: required variable is not present

Environment:

Where did the issue happen?

If on Bitrise.io: iOS stack

Which build Step causes the issue and which version of the step?

E.g.: activate-ssh-key v4.1.0

Reproducibility

  • _Does a “Rebuild” help? No
  • _Does a rebuild without caches help? NO
  • Does the issue happen sporadically, or every time? : Everytime
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? :

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( Bitrise CLI )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: http://devcenter.bitrise.io/docker/run-your-build-locally-in-docker/ .

Build log

Please copy paste the build’s bitrise.io URL here (or if the issue happens somewhere else then the full logs), or if you can’t share the url / log here then send the url or full log through a private channel (e.g. email - Contact us ), with a link to the related Discuss issue.

1 Like

The reason for this is because the Activate SSH key step removes the SSH key input from the env vars in the build once it’s completed, for security reasons.

My recommended solution would be to make reusable (utility) workflow blocks if you want to chain android and iOS, something like this:

format_version: "11"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: other
workflows:
  _setup:
    steps:
    # common "setup" steps
    - activate-ssh-key@4:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@7: {}

  _android:
    steps: [] # android specific steps
  _ios:
    steps: [] # iOS specific steps

  _finishing:
    steps:
    # common "finishing" steps
    - deploy-to-bitrise-io@2: {}
  primary:
    before_run:
    - _setup
    - _android
    - _ios
    - _finishing

With this when you run primary it’ll Activate the SSH key and Git Clone the repo only once, then proceed with the _android specific steps, then with the _ios specific steps, and then with common _finishing steps.

If you have any questions let me know! :slight_smile:

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