mirror of
https://github.com/linuxserver/docker-jenkins-builder.git
synced 2026-02-20 02:13:29 +08:00
add custom delay to external triggers
add `external_trigger_delay_hours` var to jenkins-vars.yml that allows external triggers to check the time of last build and skip trigger based on custom delay
This commit is contained in:
parent
6f6d917d65
commit
fa8da80789
@ -45,3 +45,4 @@ optional_block_1: false
|
||||
changelogs: []
|
||||
custom_external_trigger: ""
|
||||
custom_package_trigger: ""
|
||||
external_trigger_delay_hours: 0
|
||||
|
||||
@ -120,6 +120,11 @@ jobs:
|
||||
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-{{ project_name }}/job/{{ ls_branch }}/lastBuild/api/json | jq -r '.building') == "true" ]; then
|
||||
echo "**** New version ${EXT_RELEASE} found; but there already seems to be an active build on Jenkins; exiting ****"
|
||||
exit 0
|
||||
{% if external_trigger_delay_hours > 0 %}
|
||||
elif [[ $(( $(date +%s%3N) - $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-{{ project_name }}/job/{{ ls_branch }}/lastBuild/api/json | jq -r '.timestamp') )) -lt $(( {{ external_trigger_delay_hours }} * 3600000 )) ]]; then
|
||||
echo "**** New version ${EXT_RELEASE} found; but the last build was less than {{ external_trigger_delay_hours }} hours ago; skipping trigger ****"
|
||||
exit 0
|
||||
{% endif %}
|
||||
else
|
||||
echo "**** New version ${EXT_RELEASE} found; old version was ${IMAGE_VERSION}. Triggering new build ****"
|
||||
response=$(curl -iX POST \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user