How to create a pipeline job for an external runner?

Hello gitlab community :wave:

I have a pipeline where I build applications, one way to build an app is to use a service ‘EAS’ that is basically a runner that runs on their premises.

Today, I’m launching the build using a command within a job, and that job is stalled doing nothing while polling for a result from the build job ran at EAS. Basically it looks like this:

 - build
 - deploy

.build-base: &build-base
  <<: *setup_expo
  image: node:14-alpine
    - key:
            - yarn.lock
        - node_modules

  <<: *build-base
  stage: build
    - apk add --no-cache bash git
    - yarn --frozen-lockfile --prefer-offline
    - yarn run eas build -p all --non-interactive --profile="production"

And here’s the build log:

All credentials are ready to build @zeloce/zaas-driver (app.zeloce.driver)
- Uploading to EAS Build (0 / 3.8 MB)
✔ Uploaded to EAS  Learn more:
🤖 Android build details:
🍎 iOS build details:
Waiting for builds to complete. You can press Ctrl+C to exit.
✔ All builds have finished
🤖 Android app:
🍎 iOS app:
Done in 3081.87s.

So it finishes with a total duration of 54 minutes 11 seconds.

So I end up having a job doing nothing for almost an hour running on the CI minutes.
I could launch the job and follow up on the other application, but I’d rather keep everything from within the pipeline.

I saw that some integrations (like does exactly that:

  • it launches a job on another service,
  • that job callbacks,
  • it updates the pipeline, adding an external job,
  • when you click on it it opens the webpage of that other job, and
  • updates the status of that external job with a success or failure when it’s done.

I tried to look the documentation of gitlab’s API and some other documentation elsewhere, I asked around on IRC or gitter for pointers, but no luck.

Is there any doc/tutorial/api doc that one could point to me where I can create/update an external job with the environment from within a gitlab pipeline’s job?

Thank you :pray:

So I found this documentation that might be what I’m looking for… :thinking:

It was, but now I’m having another yet related issue, that API endpoint does not work with the $CI_JOB_TOKEN, but it does with a personal access token.

Though, I’d like to callback the gitlab API to push new statuses from expo’s runners using the above API without having to permanently store a token that gives full access to the API through my account… And I believe the commit status API should be accessible using $CI_JOB_TOKEN.

But what bugs me is that people at did succeed to implement that feature without getting any access token from their users, so there should be a way to make that API accessible.