Home/Guides/How do I get notified when a build on a remote Mac finishes or fails?

How do I get notified when a build on a remote Mac finishes or fails?

Updated · airankrush

What this guide covers

When you finish, you get a message on your phone in all three cases: build succeeded, build failed, and build machine offline. You need: a remote Mac already connected to CI and a chat tool that accepts webhooks.

Steps

  1. Start with the CI platform's built-in notifications

    GitHub, GitLab and Jenkins can all send email or in-app notifications to the people involved when a job fails. This layer needs nothing done on the build machine. First confirm it is turned on and that the address it sends to is one you actually read.

    Its shortcoming is that it reaches individuals, not a team channel, and the information is fairly general. The next two layers fill that gap.

  2. Add a step to the pipeline that runs only on failure

    Taking GitHub Actions as the example, according to the expressions documentation, failure() is true when any previous step fails, and always() makes a step run no matter what:

    - name: Notify on failure
      if: ${{ failure() }}
      run: ./scripts/notify.sh "Build failed: ${{ github.workflow }}"

    Keep the message-sending logic in one script and reuse it across pipelines. Other CI systems have an equivalent post-failure step.

  3. Send to a chat tool with a webhook

    Taking Slack as the example, according to its Incoming Webhooks documentation, you POST a piece of JSON with a text field to the webhook URL:

    curl -X POST -H 'Content-type: application/json' --data '{"text":"Build finished"}' "$WEBHOOK_URL"

    The documentation stresses that the webhook URL is itself a secret and must not go into a public repository. Store it in CI's secret variables. Bot APIs for other tools such as Telegram work in a similar way; go by each tool's official documentation for the request format.

  4. This is an outbound request, so the network configuration stays untouched

    A notification is this Mac sending an HTTPS request to the chat tool's servers. That is ordinary outbound access; it needs no port mapped to the outside and no change to the machine's network configuration.

    The reverse approach, such as having a chat bot connect into this machine to trigger builds, needs inbound access and is not suitable for a rented machine. Triggering should go through the CI platform.

  5. Add notifications to long jobs you run by hand too

    For an archive or script that runs straight in tmux rather than through CI, append the notification to the command. Use a semicolon rather than && so it is sent on success and on failure:

    ./build.sh; ./scripts/notify.sh "build.sh finished, exit code $?"

    Desktop notifications on the remote Mac appear only on that machine's screen, and you will not see them once you disconnect, so do not depend on them.

  6. The case that is easiest to miss: the build machine is offline

    If the service did not come back after the build machine restarted, or the network dropped, jobs do not fail. They just stay queued, and none of the "notify on failure" steps above fire.

    There are two ways to cover this. One is to set a timeout or a queue time limit for jobs on the CI platform (go by each platform's documentation for the exact configuration), so that a long wait with no runner picking the job up turns into a failure that can be notified. The other is to make a habit of connecting and confirming the agent is online every time you restart the machine from the customer console.

  7. Keep secrets out of notifications

    It is tempting to paste the last few dozen log lines into a failure notification, and logs may contain tokens, certificate passwords or internal addresses. Send only the status, branch, commit and a link to the log, and read the details on the CI platform.

    Before the rental ends, revoke the webhook or bot token you issued for this machine in the chat tool.

FAQ

Can the remote Mac pop a system notification onto my phone?

System notifications show only on that Mac. To reach your phone, forward through a channel already on it, such as a chat tool or email.

The notification is not going out. How do I troubleshoot?

First run the same command by hand in Terminal on the remote Mac and look at the response. Common causes are an invalid webhook URL, or the CI secret variable not being injected into this job.

Can I look at the build machine's screen from my phone?

Yes, connect with the UU Remote mobile app; see checking progress from your phone with UU Remote. It suits an occasional check and is no substitute for notifications.

Will the platform notify me when my machine goes offline?

Machine status can be viewed in the customer console. Whether there is a proactive offline alert depends on the delivery notes; you can check with Contact support. The online status of the build agent itself is something you need to monitor yourself.

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All guides