@@ -9,6 +9,14 @@ url="$2"
9
9
10
10
z40=0000000000000000000000000000000000000000
11
11
12
+ function user_input_to_proceed() {
13
+ read -p ' Proceed with push? (y/N): ' yesno < /dev/tty
14
+ case " $yesno " in
15
+ y|Y|yes|Yes|YES) ;;
16
+ * ) echo " Aborting push" >&2 ; exit 1 ;;
17
+ esac
18
+ }
19
+
12
20
while read local_ref local_sha remote_ref remote_sha ; do
13
21
if [ " $local_sha " = $z40 ] ; then
14
22
# Handle delete
@@ -21,15 +29,18 @@ while read local_ref local_sha remote_ref remote_sha ; do
21
29
# Update to existing branch, examine new commits
22
30
range=" $remote_sha ..$local_sha "
23
31
24
- # Check for WIP commit
25
- commit=$( git rev-list -n 1 " $range " -- concourse/pipelines/* )
26
- if [ -n " $commit " ] ; then
32
+ # Check for changed files in concourse/pipelines
33
+ changed_pipeline_ymls=$( git rev-list -n 1 " $range " -- concourse/pipelines/* .yml)
34
+ changed_pipeline_pys=$( git rev-list -n 1 " $range " -- concourse/pipelines/* .py)
35
+ changed_pipeline_templates=$( git rev-list -n 1 " $range " -- concourse/pipelines/templates/* )
36
+
37
+ # if either a change to generators or a change to the templates, but no new pipeline file, warn user
38
+ if [ -n " ${changed_pipeline_pys}${changed_pipeline_templates} " ] && [ -z " $changed_pipeline_ymls " ] ; then
39
+ echo ' You appear to have changed pipeline inputs (generator or template). Please check in the corresponding generated pipeline.'
40
+ user_input_to_proceed
41
+ elif [ -n " $changed_pipeline_ymls " ] ; then
27
42
echo ' You appear to be pushing a change to a pipeline. Please make sure you ran `fly set-pipeline` first.'
28
- read -p ' Proceed with push? (y/N): ' yesno < /dev/tty
29
- case " $yesno " in
30
- y|Y|yes|Yes|YES) ;;
31
- * ) echo " Aborting push" >&2 ; exit 1 ;;
32
- esac
43
+ user_input_to_proceed
33
44
fi
34
45
done
35
46
0 commit comments