Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android CI using Bitbucket Pipelines and Docker

Tags:

I am trying to set up Continuous Integration (CI) in Bitbucket Pipelines for Android.

I have created a sample blank activity using Android Studio 2.1.1.

With Pipelines I'm using the uber/android-build-environment Docker container which creates the environment nicely. Here is my bitbucket-pipelines.yml

image: uber/android-build-environment:latest  pipelines:   default:     - step:         script:           - echo y | android update sdk --filter "extra-android-m2repository" --no-ui -a # Grab the Android Support Repo which isn't included in the container           - ./gradlew assembleDebug 

Some changes are needed since uber/android-build-environment is expecting to be run like so:

docker run -i -v $PWD:/project -t uber/android-build-environment /bin/bash /project/ci/build.sh 

For example, the source is not copied to the volume /project but instead Pipelines copies the contents of the Bitbucket repo to the working directory of the container at:

/opt/atlassian/bitbucketci/agent/build 

And when ./gradlew assembleDebug is run I get the following error:

...  FAILURE: Build failed with an exception.  * What went wrong: Could not create service of type TaskArtifactStateCacheAccess using TaskExecutionServices.createCacheAccess(). > Failed to create parent directory '/opt/atlassian/bitbucketci/agent/build/.gradle' when creating directory '/opt/atlassian/bitbucketci/agent/build/.gradle/2.10/taskArtifacts'  * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.  BUILD FAILED  Total time: 56.449 secs 

Running ls -al in the working directory gives:

ls -al total 52 drwxr-xr-x 5 root root 4096 May 31 22:33 . drwxr-xr-x 3 root root 4096 May 31 22:43 .. drwxr-xr-x 3 root root 4096 May 31 22:33 app -rw-r--r-- 1 root root  462 May 31 22:33 bitbucket-pipelines.yml -rw-r--r-- 1 root root  498 May 31 22:33 build.gradle drwxr-xr-x 8 root root 4096 May 31 22:33 .git -rw-r--r-- 1 root root  387 May 31 22:33 .gitignore drwxr-xr-x 3 root root 4096 May 31 22:33 gradle -rw-r--r-- 1 root root  855 May 31 22:33 gradle.properties -rwxr-xr-x 1 root root 4971 May 31 22:33 gradlew -rw-r--r-- 1 root root 2314 May 31 22:33 gradlew.bat -rw-r--r-- 1 root root   15 May 31 22:33 settings.gradle 
like image 637
Ryan R Avatar asked Jun 01 '16 00:06

Ryan R


People also ask

Does Bitbucket allow automation of CI CD pipeline?

Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket. It allows you to automatically build, test, and even deploy your code based on a configuration file in your repository.

Does DBT work with Bitbucket?

dbt Cloud, a much beloved method of dbt deployment, supports GitHub- and Gitlab-based CI/CD out of the box. It doesn't support Bitbucket, AWS CodeCommit/CodeDeploy, or any number of other services, but you need not give up hope even if you are tethered to an unsupported platform.

Does Bitbucket data center have pipelines?

Bitbucket Cloud has an exclusive built-in CI/CD tool, Pipelines, that enables you to build, test, and deploy directly from within Bitbucket.

What is difference between Jenkins and Bitbucket?

Teams choose Bitbucket because it has a superior Jira integration, built-in CI/CD, & is free for up to 5 users. On the other hand, Jenkins is detailed as "An extendable open source continuous integration server". In a nutshell Jenkins CI is the leading open-source continuous integration server.


1 Answers

It's a bug in their system , I report it(issue url, it's quite long) to them and they have fixed it (fix url).I have tested on my project and it successfully build.Try to build your project now and good luck.

like image 187
Geng Jiawen Avatar answered Oct 09 '22 02:10

Geng Jiawen