Is it possible to mark gitlab ci jobs to start manually?
I need it for deploying application but I want to decide if it's going to be deployed
GitLab Setting You can add a new trigger by going to your project's Settings ➔ CI/CD under Triggers. How to get the project ID? going to your project's Settings ➔ General under General project.
In GitLab CI/CD you can easily configure a job to require manual intervention before it runs. The job gets added to the pipeline, but doesn't run until you click the play button on it. Notice that the manual job gets skipped, and the pipeline completes successfully even though the manual job did not get triggered.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With