Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing environment variables to start-emulator-and-run-tests arguments causes job to fail as of 2.1.1 #56

Open
growse opened this issue Sep 20, 2022 · 5 comments
Assignees
Labels
backlog Identified as a backlog item, often combined with low-priority and help-wanted labels

Comments

@growse
Copy link

growse commented Sep 20, 2022

Orb version 2.1.1

What happened

Orb can no longer accept step arguments that are environment variables.

I have a step that looks like this:

run-andoid-emulator-and-tests:
    steps:
      - android/start-emulator-and-run-tests:
          additional-avd-args: "-d pixel_3a -c 1G"
          additional-emulator-args: "-memory 4096 -cores 3"
          test-command: $GRADLE_TEST_COMMAND
          system-image: $SYSTEM_IMAGE

This works great on 2.1.0. On 2.1.1 however, it fails at "Create avd 'test'":

#!/bin/bash -eo pipefail
#!/bin/bash
echo "no" | avdmanager --verbose create avd -n ${PARAM_AVD_NAME} -k ${PARAM_SYSTEM_IMAGE} ${PARAM_ADDITIONAL_ARGS}

Error: Package path is not valid. Valid system image paths are:ository...       
system-images;android-29;default;x86_64
null

Exited with code exit status 1

CircleCI received exit code 1

(See https://app.circleci.com/pipelines/github/owntracks/android/1025/workflows/7844a0b9-deec-447a-838e-99d67c476e2a/jobs/4071)

If I replace system-image: $SYSTEM_IMAGE with a hard-coded value, the create AVD stage works, but then the "Run tests with max tries of 2" step fails with:

#!/bin/bash -eo pipefail
#!/bin/bash
run_with_retry() {
            MAX_TRIES=${PARAM_MAX_TRIES}
            n=1
            until [ $n -gt $MAX_TRIES ]
            do
              echo "Starting test attempt $n"
              ${PARAM_TEST_COMMAND} && break
              n=$((n+1))
              sleep "${PARAM_RETRY_INTERVAL}"
            done
            if [ $n -gt $MAX_TRIES ]; then
              echo "Max tries reached (${PARAM_MAX_TRIES})"
              exit 1
            fi
        }
        run_with_retry

Starting test attempt 1
environment: line 7: ${GRADLE_TEST_COMMAND}: command not found
Starting test attempt 2
environment: line 7: ${GRADLE_TEST_COMMAND}: command not found
Max tries reached (2)

Exited with code exit status 1

CircleCI received exit code 1

(See https://app.circleci.com/pipelines/github/owntracks/android/1022/workflows/502e1a7a-d62e-43d8-9110-c3dfb6c649ee/jobs/4062)

Expected behavior

Environemnt var values should be passed through to the orb correctly, as they were in 2.1.0

@ryanbourdais
Copy link
Contributor

Hi @growse are you still receiving this issue?

@ryanbourdais ryanbourdais self-assigned this Feb 16, 2023
@growse
Copy link
Author

growse commented Feb 17, 2023

@ryanbourdais ryanbourdais added the backlog Identified as a backlog item, often combined with low-priority and help-wanted labels label Feb 21, 2023
@ryanbourdais
Copy link
Contributor

Hi @growse, I've spent some time looking into this over the last few days, and it looks like using this command with environment variables is not currently possible with the state of the orb. Changing it to allow for this usage would require the step to be rewritten and remove other features that have been added to this command, such as running in background. As a result, I am going to backlog this issue for now and keep an eye on it to see how the orb changes in the coming months and revisit it periodically.

@luzfcb
Copy link

luzfcb commented Nov 13, 2023

@ryanbourdais, any update on this? Circle-ci does not provide a way to invalidate the cache other than simply renaming the cache key, because of that, I need an easy way without changing the code of the application to invalidate the cache used by restore-gradle-cache-prefix and defines the API version of the android system-image

      - android/start-emulator-and-run-tests:
          restore-gradle-cache-prefix: ${ANDROID_LARGE_CACHE_VERSION}-android-${ANDROID_LARGE_API_VERSION}-large
          system-image: system-images;android-${ANDROID_LARGE_API_VERSION};google_apis;x86_64
          additional-avd-args: --device pixel_5
          avd-name: pixel5_api_31

@ryanbourdais
Copy link
Contributor

Hi @luzfcb, no there is no update on this currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Identified as a backlog item, often combined with low-priority and help-wanted labels
Projects
None yet
Development

No branches or pull requests

3 participants