2

I'm trying to set up a basic CI/CD pipeline for an Android project using AWS CodePipeline and I have 3 steps in the pipeline as follows:

  1. Source: Pull project from GitHub repo
  2. Build: Build the android app using a docker image (futurenda/ android-sdk)
  3. Test: Run instrumentation tests (espresso tests)

Currently the Source and Build steps work fine (both are successful). From my understanding of running tests in CodePipeline, you can use CodeBuild and simply invoke the tests as you normally would from the command line. In this case, to invoke Espresso tests I can run sh gradlew connectedAndroidTest on my local machine.

I've set the pipeline up with the Build and Test steps being 2 seperate CodeBuild projects, each with their own buildspec.yml file. For the Build step (which is working), the file is named buildspec-build.yml, and is found by CodeBuild without issue. However, for the Test step (not working) my buildspec.yml file is not found. They are both located in the root of my project (and confirmed to be pushed to my remote GitHub repo).

The error I receive is: stat /codebuild/output/src712781592/src/buildspec.yml: no such file or directory. This happens during the DOWNLOAD_SOURCE step in the CodeBuild project. I've checked to CodeBuild project to ensure it is indeed expecting a file named buildspec.yml.

Any ideas?

Here are both of my buildspec.yml files, if it matters:

buildspec-test.yml (found by CodeBuild):

version: 0.2
phases:
    build:
        commands:
          - $ANDROID_HOME/tools/bin/sdkmanager "build-tools;27.0.3" "platforms;android-27"
          - sh gradlew assembleDebug
    artifacts:
         files:
             - app/build/outputs/apk/debug/app-debug.apk
             #some other stuff here.

tester-buildspec.yml (not found by codebuild):

version: 0.2
phases:
  build:
    commands:
      - sh gradlew connectedAndroidTest
artifacts:
  files:
    #other stuff that doesn't really matter here

Just to recap: I have a pipeline set up with 2 CodeBuild projects as steps within the pipeline. The first CodeBuild project finds the buildspec.yml file, but the second one doesn't.

  • 1
    I have a working pipeline for travis-ci and Android if that helps? github.com/montao/gamex/blob/master/.travis.yml – Niklas Rosencrantz May 9 '18 at 18:26
  • I'll take a look at it. Thanks, Niklas! Much appreciated. – 121c May 10 '18 at 1:17
  • I don't know if you are still interested, anyway I think the problem is in the pipeline definition, have you set correctly the inputartifact property in the codepipeline template? Could you post the template? – LilloX Dec 19 '18 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.