Updating Codemagic Android build status to self-hosted GitLab repository

466 Views Asked by At

I have self-hosted GitLab repository and I use Codemagic CI.

I have already configured automatic triggering with webhooks in GitLab settings, but after the build is complete, the status is not displayed in the MR tab in GitLab.

1

There are 1 best solutions below

1
On BEST ANSWER

Unfortunately Codemagic doesn't report build status back to self-hosted repositories. However you can add simple curl command in publishing/scripts section to report passed or failed statuses.

scripts:
  - # you build commands
    ...
  - name: Build finished successfully
    script: touch ~/.SUCCESS
publishing:
  scripts:
    - name: Report build status
      script: |
        if [ -a "~/.SUCCESS" ] ; then
           # build successful
        else
           # build failed
        fi  

see also GitLab API doc how to add status check https://docs.gitlab.com/ee/api/status_checks.html#set-status-of-an-external-status-check

ps: if you use Workflow Editor you can add post-publishing script and use built-in environment variable CM_BUILD_STEP_STATUS