GitLab CI Start job manually (deployment)

Manually approved build steps are not supported directly afaik. But it should be possible to achieve similar behaviour by using ci triggers.

build_package:
  stage: build
  script:
  - make build

upload_package:
  stage: package
  script:
  - if [ -n "${UPLOAD_TO_S3}" ]; then make upload; fi

Then you can trigger rebuild by making POST request and passing configured variable.

curl -X POST \
  -F token=TOKEN \
  -F ref=master \
  -F "variables[UPLOAD_TO_S3]=true" \
  https://gitlab.example.com/api/v3/projects/9/trigger/builds

If you have own instance of gitlab it should be possible to inject javascript button on each merge request which will make curl call.


This has changed since the first answer has been posted. Here's the link to the original Gitlab Issue. It is now supported to do something like

production:
  stage: deploy
  script: run-deployment $OMNIBUS_GITLAB_PACKAGE
  environment: production
  when: manual

Note the when: manual attribute. The UI updates itself to provide a way for users to trigger the job.