I have a Gitlab CI pipeline schedule and noticed that pipelines are not running (anymore).
When starting the schedule manually via the UI (<repo-root>/-/pipeline_schedules) it shows the following
However, there is not pipeline started and no error message is provided.
What can I do in this situation?
The success message is misleading in the sense that one might thing the pipeline was actually created, although it only means that a pipeline was scheduled.
There are various reasons, why a schedule cannot run (anymore).
This can be for example because of conflicting rules or outdated fields in your yml caused by breaking changes due to Gitlab upgrades.
To get to the root of the problem why your pipeline did not run you can trigger a pipeline manually and set the
CI_PIPELINE_SOURCE to hold "schedule" as value.
To do so, go to <repo-root>/-/pipelines/new, set your target branch or tag and the variable as follows
Additionally, you may want to provide further variables required to properly simulate your problematic schedule via the manual run.
Next hit Run pipeline and you should observe an actual error message why the pipeline could not run.
Related
I am using azureml schedules to schedule azureml pipelines. When I want to update a pipeline I am disabling the schedule, deleting and re-publishing the updated pipeline and re-creating the schedule. However every time I do this, the schedule.create command sets the pipeline running as soon as it is published (instead of just setting it to run at the provided recurrence intervals).
Can I disable this behaviour? I dont need the pipeline to automatically run every time I commit and re-run the publish pipelines
I would like to switch from my jenkins jobs to gitlab pipelines entirely.
However, some jobs are never executed as the result of a pipeline.
I would like to be able to trigger these jobs/tasks manually (e.g. by pressing a button or curl).
These manual jobs are intended to perform some source code modifications (such as dependency updates, creating tickets for external rollouts, ...) and create a MR as a result (which is then covered by the normal ci pipelines).
Unfortunately, I haven't found a way to trigger these.
There is the trigger API, that allows to run the pipeliens for a certain branch, but I would like to trigger a pipeline only by name.
I explicitly don't want to rerun the default pipelines on these triggers.
I also considered using environments/deployments, but these tasks lack a real lifecycle and I don't wish to repurpose those for my needs.
TLDR: How do I trigger a job/pipeline by name?
update-dependencies:
only:
- triggers
script:
- update-dependencies.sh
You can use:
when: manual
Example:
update-dependencies:
script:
- update-dependencies.sh
when: manual
How it looks:
I've enabled the option - Settings/General/Merge Requests/Merge Checks - Pipelines must succeed.
Since then every merge requests automatically starts execution of the pipeline which is actually what i want. The problem is that this is running forever , i'm receiving message : Checking pipeline status
If i run the pipeline manually from CI/CD Pipelines - Run pipeline finish immediately. I don't understand what is wrong and why it stuck , can i check logs somewhere or something ?
For testing , the pipeline is really simple , just exit 1 .. but still not working ..
At this stage , "running pipeline" is not listed in pipeline list even if the status in merge request is
Checking pipeline status
We ran into a case where a merge request does not contain the .gitlab-ci.yml file. The fix is simply to do a rebase
For troubleshooting purposes, pipelines can be run manually on particular branches at CI/CD -> Pipelines -> Run Pipeline
For me what happened that .gitlab-ci.yml file was having issue as I have mentioned "master" as value for "only" label .. , then everything worked after updating it with my correct branch name which IMO should be "main"
Encountered this myself just now, using Gitlab shared runners. Tried re-running one individual job from the pipeline in the hope that it would resolve the issue. It did not. The best way is to change the commit id of the latest change in the MR.
You can either create an empty commit as suggested by #Bhargav11 or, to keep a cleaner commit history, do
$ git commit --amend --no-edit
$ git push --force
on your branch.
check if current branch you are checking the pipeline status and branch specified in "only: field" are same
only:
- master
This happens to me with pipelines that has no job that triggers on merge-requests.
If I have no tests or anything I wish to run during a merge requests I create a "dummy" job that doesn't do anything.
Rule to trigger on merge requests:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
Then add a simple echo in the script section:
script: echo "Dummy job for merge-request"
Just add an empty commit to trigger it again.
git commit -n -m "commit comment"
From GitLab documentation:
"Checking pipeline status" message
This message is shown when the merge request has no pipeline
associated with the latest commit yet. This might be because:
GitLab hasn't finished creating the pipeline yet
You are using an external CI service and GitLab hasn't heard back from the service yet.
You are not using CI/CD pipelines in your project.
You are using CI/CD pipelines in your project, but your configuration prevented a pipeline from running on the source branch for your merge request.
The latest pipeline was deleted (this is a known issue).
I found what was wrong in my case. The problem was with the runners. There was "Shared runners" enabled by default which caused the confusion. I've just disabled them and enable my own runner and everything started to work as expected. You can check this in CI / CD Settings, I think they are enabled by default. Basically , pipelines are nothing more than a trigger for the runner... then the runner is responsible for the execution.
In our case, simply creating a copy of the branch (git checkout -b new-branch-name) and making a new MR with the identical code allowed us to work around the issue. The new MR pipeline executed successfully.
In my case, I had made a typo on the filename and had forgotten to add a dot before it.
Please ensure the filename is .gitlab-ci.yml
How did I debug this?
On the GitLab UI, I went into CI/CD editor and couldn't see my file.
I've been using Azure Pipelines for a while now and haven't changed my azure-pipelines.yml file here in 2 months. Previously, when there was a new PR, the pipeline would trigger and cause the environment to be built and the tests would be run.
Today, there was a new PR but I noticed that the pipeline was not being triggered. Then, to further test this, I forked, cloned, and branched the repository myself and created another new PR and, again, the pipeline was not triggered.
It's not clear to me where things are getting stuck and it's not clear how one would debug this. I've gone through this Azure DevOps documentation but it wasn't useful. I can manually trigger the pipeline to execute and test the master branch but I don't know how to manually trigger the same thing for a PR. Here's my Azure DevOps page for reference.
As normal, you do not need config pr in YAML script if there's no any special demand, we would do pull request trigger for all branches. But, it start broken from 03-13 21:02 (UTC), which caused by us, you do not do anything wrong.
The fix is preparing with our best.
As Alex said, this is the implicit trigger which YAML support only, if you do not configure pr in YAML explicitly.
To avoid such stuck later, except the method that Alex mentioned: add pr into YAML. You can also make use of UI configuration which performance is very stable until now.
Just go Pipeline definition page => Click on three dots of right corner => Select Trigger:
Then you will see Triggers tab which has Continues integration and Pull request validation display below. Open Pull request validation and enable Override the YAML pull request trigger from here:
Additional, Our team has noticed this broken issue, will update whether it is fixed here once we have any fixed release in progress.
Update 3/18/2020:
Fixed has released to all region. Every one can work github pr trigger as the document shows now.
I have set up an Azure pipeline to run GUI tests twice a day. According to the documentation, it should only run if there have been code changes, but it always runs.
This is my cron schedule in "azure-pipelines-cypress.xml"
schedules:
- cron: "0 10 * * *"
displayName: Daily 12:00 build (UTC 10:00)
branches:
include:
- master
Note that the documentation (https://learn.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers?view=azure-devops&tabs=yaml#scheduled-triggers) states:
always: boolean # whether to always run the pipeline or only if there have been source code changes since the last run. The default is false.
Is this simply a bug or am I missing something?
Azure cron pipeline always runs
Update2:
I don't want it to run every time the master branch is updated. It
should run when the master branch is updated AND only at a scheduled
time.
But is that not the expected behavior of my current pipeline? The
current behavior acts as if I had set "always: true"
First of all, thanks Mick for your patience in providing a lot of detailed information.
Now, I figure out the issue and I could reproduce this issue on my side. If we set the scheduled triggers, but the build result is failed. In this case, even if we do not any change, the scheduled triggers will still fire. That because the latest build failed, so the last commit record was not recorded by the pipeline. When the scheduled time is reached, the last commit/source code change still exists. It will trigger scheduled triggers.
So, that the reason why your pipeline still executed, even if you do not do any change in the code/yaml.
If I successfully build the pipeline, the scheduled triggers works as expected.
So, it should be said that the documentation is not clear enough, it should be:
always: boolean # whether to always run the pipeline or only if there
have been source code changes since the last successful run. The
default is false.
I submit this to MS, Thank you for helping us build a better Azure DevOps.
Hope this helps.