Draft: External jobs PoC
What does this MR do and why?
Not to be merged. Spike for #427389 (closed).
Screenshots or screen recordings
How to set up and validate locally
- Create a personal access token
- Create a new project, and add the following
.gitlab-ci.yml
:stages: - build - sync - report build: stage: build script: - echo 'build' sync: stage: sync external: true environment: production timeout: 10m report: stage: report script: - echo 'report'
- Make a note of the ID of your project, and the SHA for the commit you just created
- View the created pipeline, and wait until the
build
job has finished (should be almost instant) - Observe the
sync
job "starts", but is not actually running via runner - From a terminal, execute the following, replacing TOKEN, PROJECT_ID, BRANCH and SHA with the relevant values:
curl --request POST \ --header "PRIVATE-TOKEN: <TOKEN>" \ "https://gdk.test:3443/api/v4/projects/<PROJECT_ID>/pipeline_callback?ref=<BRANCH>&sha=<SHA>&job_name=sync&job_status=success"
- Watch the pipeline page, and observe the
sync
job completes successfully, thereport
job starts and completes, and the pipeline succeeds - [Optional] Start another pipeline, and execute the same
curl
command, this time withjob_status=failed
. The pipeline will fail as expected - [Optional] Adjust the timeout in the external job definition to
1m
. The pipeline will fail by itself when the timeout is reached
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Tiger Watson