diff mbox series

[kteam-tools] cranky-test-build: Add a --dry-run commandline option

Message ID 20180426082853.8536-1-juergh@canonical.com
State New
Headers show
Series [kteam-tools] cranky-test-build: Add a --dry-run commandline option | expand

Commit Message

Juerg Haefliger April 26, 2018, 8:28 a.m. UTC
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 cranky/cranky-test-build | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Kleber Sacilotto de Souza April 26, 2018, 12:34 p.m. UTC | #1
On 04/26/18 10:28, Juerg Haefliger wrote:
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  cranky/cranky-test-build | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/cranky/cranky-test-build b/cranky/cranky-test-build
> index 45a31c7eef2f..9cabb15356b5 100755
> --- a/cranky/cranky-test-build
> +++ b/cranky/cranky-test-build
> @@ -16,7 +16,7 @@ function out()
>  function usage()
>  {
>  	cat <<EOF
> -usage: cranky-test-build [-h] [-c COMMIT] [-t TARGET] [-a ARCH[,ARCH,...]] HOST
> +usage: cranky-test-build [-h] [-d] [-c COMMIT] [-t TARGET] [-a ARCH[,ARCH,...]] HOST
>  
>  Build kernel binary packages using Kamal's git-build-kernel build script.
>  
> @@ -30,6 +30,8 @@ Optional arguments:
>                                is used, build all architectures listed under
>                                debian.master/config/.
>    -c, --commit COMMIT         Build from commit COMMIT instead of 'HEAD'.
> +  -d, --dry-run               Do everything except push to the builder, i.e.,
> +                              don't trigger the build(s).
>    -t, --target TARGET         Build target TARGET instead of 'binary'.
>    -h, --help                  Show this help message and exit.
>  
> @@ -61,6 +63,7 @@ EOF
>  host=
>  arches=($(dpkg-architecture -q DEB_HOST_ARCH))
>  commit=HEAD
> +dry_run=0
>  target=binary
>  
>  while [ "${#}" -gt 0 ] ; do
> @@ -73,6 +76,9 @@ while [ "${#}" -gt 0 ] ; do
>  			shift
>  			commit=${1}
>  			;;
> +		-d|--dry-run)
> +			dry_run=1
> +			;;
>  		-h|--help)
>  			usage
>  			;;
> @@ -185,5 +191,9 @@ trap out EXIT INT TERM HUP
>  # Finally cycle through the arches and do the builds
>  for arch in "${arches[@]}" ; do
>  	echo "Info: Doing a test build for arch '${arch}', target '${target}'"
> -	git push --force "${host}" "${BUILD_BRANCH}:${arch}-${target}" || true
> +	if [ ${dry_run} -eq 1 ] ; then
> +		echo "Info: Skipping the build (dry-run)"
> +	else
> +		git push --force "${host}" "${BUILD_BRANCH}:${arch}-${target}" || true
> +	fi
>  done
>
Juerg Haefliger April 30, 2018, 2:56 p.m. UTC | #2
Applied to master branch.

...Juerg
diff mbox series

Patch

diff --git a/cranky/cranky-test-build b/cranky/cranky-test-build
index 45a31c7eef2f..9cabb15356b5 100755
--- a/cranky/cranky-test-build
+++ b/cranky/cranky-test-build
@@ -16,7 +16,7 @@  function out()
 function usage()
 {
 	cat <<EOF
-usage: cranky-test-build [-h] [-c COMMIT] [-t TARGET] [-a ARCH[,ARCH,...]] HOST
+usage: cranky-test-build [-h] [-d] [-c COMMIT] [-t TARGET] [-a ARCH[,ARCH,...]] HOST
 
 Build kernel binary packages using Kamal's git-build-kernel build script.
 
@@ -30,6 +30,8 @@  Optional arguments:
                               is used, build all architectures listed under
                               debian.master/config/.
   -c, --commit COMMIT         Build from commit COMMIT instead of 'HEAD'.
+  -d, --dry-run               Do everything except push to the builder, i.e.,
+                              don't trigger the build(s).
   -t, --target TARGET         Build target TARGET instead of 'binary'.
   -h, --help                  Show this help message and exit.
 
@@ -61,6 +63,7 @@  EOF
 host=
 arches=($(dpkg-architecture -q DEB_HOST_ARCH))
 commit=HEAD
+dry_run=0
 target=binary
 
 while [ "${#}" -gt 0 ] ; do
@@ -73,6 +76,9 @@  while [ "${#}" -gt 0 ] ; do
 			shift
 			commit=${1}
 			;;
+		-d|--dry-run)
+			dry_run=1
+			;;
 		-h|--help)
 			usage
 			;;
@@ -185,5 +191,9 @@  trap out EXIT INT TERM HUP
 # Finally cycle through the arches and do the builds
 for arch in "${arches[@]}" ; do
 	echo "Info: Doing a test build for arch '${arch}', target '${target}'"
-	git push --force "${host}" "${BUILD_BRANCH}:${arch}-${target}" || true
+	if [ ${dry_run} -eq 1 ] ; then
+		echo "Info: Skipping the build (dry-run)"
+	else
+		git push --force "${host}" "${BUILD_BRANCH}:${arch}-${target}" || true
+	fi
 done