I am looking to create a nightly scheduled run of the pipeline if none exists. I want to do this via code rather than via the gitlab UI. The idea is it confirms that there is no problem with the infrastructure that would fail the pipeline when it is needed to run.
Thus is there a way I can add a stage to the yml file to create a scheduled pipeline run (for the current pipeline) that will create a cron scheduled pipeline to run every night (without keep adding to them)?
Tried to run
curl --request POST --form "token=$CI_JOB_TOKEN" --form description="Build packages" --form ref="master" --form cron="30 0 * * *" --form cron_timezone="UTC" --form active="true" "https://gitlab.com/example_project/pipeline_schedules"
But getting a response:
The change you requested was rejected. Make sure you have access to the thing you tried to change.
Does the CI_JOB_TOKEN not provide relevant authentication (or is there other settings)