'Updating Codemagic Android build status to self-hosted GitLab repository

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.



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mikhail Tokarev