Search code examples
androidgitlabgitlab-autodevops

What's the easiest way to enable gitlab auto devops for an android project


What is the minimal set of steps to properly enable gitlab's "auto devops" feature for an Android project? After enabling the feature I get a pipeline but not the jobs I would expect such as assembleDebug, etc.

Steps taken to enable Auto Devops (clicking through gitlab UI):

gitlab -> project(git repo) ->
settings -> CI/CD -> 
Auto Devops -> Expand -> 
"Default to Auto DevOps pipeline" & "Automatic deployment to staging, manual deployment to production

Solution

  • There is an "auto devops template" maintained here. Utilizing that file is as simple as creating a .gitlab-ci.yml file (at the root of your android project) and then include that file as the template you want to use:

    include:
      # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml
      - template: Android.gitlab-ci.yml
    

    That's it.

    (To take it a step further and stay on the "bleeding edge" of java/android versions, see this answer)