We are using Azure DevOps YAML pipeline with a schedule cron trigger in order to build and release our app daily in our test environment (YAML content below). However, it seems that when the build starts, only the latest commit show in the build changes. How can I make sure that all commits between the previous build and the current one shows up in the changes ?
I have to mention that, in one of the stages, there is a job with continueOnError set to true. Maybe this could be the cause too ?
YAML content:
# Pipeline build name
name: $(date:yyyyMMdd)$(rev:.r)
schedules:
- cron: '0 11 * * 1-5' # This value use UTC, so we need to set it at 11am for it to run at 1pm in french time zone
displayName: Livraison automatique en recette
always: true # Whether to always run the pipeline or only if there have been source code changes since the last successful scheduled run; the default is false.
batch: false # Whether to run the pipeline if the previously scheduled run is in-progress; the default is false.
branches:
include:
- develop
trigger: none
resources:
repositories:
- repository: self
type: github
ref: refs/heads/develop
# Build input parameters
parameters:
...
# Build variable
# For now, values are the same as previous pipelines
variables:
...
# Build stages, depending on input parameters
stages:
...
I've tried setting the always
and batch
parameters to true
, then to false
. I've also tried triggering the pipeline manually, in which case all changes appear correctly.
On pipeline result page, there's a "view change(s)" button, it shows the commits and associated changes that triggered the build.
It compares with last successful run:
not
display.new
changes.With continueOnError: true
, the step will proceed to next one, if real error reported in the step, the pipeline is treated as not successful
, the old changes will still be contained as below:
The always
and batch
only determine how the schedule trigger works, please check the doc for the usage.
In above, the changes could be different based on previous run state.
If you would like to get all commits between the previous build and the current one(current repo, not repository resource), you can use rest api Builds - Get Changes Between Builds.
GET https://dev.azure.com/{organization}/{project}/_apis/build/changes?fromBuildId={fromBuildId}&$top={$top}&api-version=7.1
BTW, the github repository resource in your yaml is not correct, please don't use self
as the name as it points to current repo, change it to others. please refer to the sample for your reference.
Check with source repo on github, the commits are same for the two triggers.