← Back to team overview

canonical-ubuntu-qa team mailing list archive

Re: [Merge] qa-jenkins-jobs:pre-commit-hooks into qa-jenkins-jobs:master

 


Diff comments:

> diff --git a/.yamllint-jobs b/.yamllint-jobs
> new file mode 100644
> index 0000000..45421e4
> --- /dev/null
> +++ b/.yamllint-jobs
> @@ -0,0 +1,12 @@
> +---
> +extends: default
> +
> +ignore:
> +  - "**/*.yaml"
> +  - "!**/*jobs*.yaml"
> +  - "!jobs/macros.yaml"
> +
> +rules:
> +  indentation: disable
> +  line-length: disable
> +  document-start: disable

Could've sworn that requiring the starting line broke deploy-jobs, but that doesn't seem to be the case so there's no reason this rule can't be enforced.

> \ No newline at end of file
> diff --git a/scripts/flash-device.sh b/scripts/flash-device.sh
> index 1efa0db..9dbbbb8 100755
> --- a/scripts/flash-device.sh
> +++ b/scripts/flash-device.sh
> @@ -74,67 +76,67 @@ echo "Wifi: $WIFI"
>  echo "Fastboot: $FASTBOOT"
>  echo "Recovery: $RECOVERY"
>  QUERY_CMD="ubuntu-device-flash $SERVER $REVARGS query --channel=$CHANNEL --device $DEVICE --show-image"
> -echo $QUERY_CMD
> +echo "$QUERY_CMD"
>  $QUERY_CMD
>  
>  rootcmd () {
> -  adb -s $ANDROID_SERIAL shell "echo $PASSWD | sudo -S $*"
> +  adb -s "$ANDROID_SERIAL" shell "echo $PASSWD | sudo -S $*"
>  }
>  
>  # Handle fastboot mode and fastboot recovery mode
>  if [ x"$FASTBOOT_RECOVERY" != x ]; then
>    echo 'Rebooting to bootloader/fastboot'
> -  adb -s $ANDROID_SERIAL reboot bootloader
> +  adb -s "$ANDROID_SERIAL" reboot bootloader
>    sleep 10
>    echo "Flashing recovery image $FASTBOOT_RECOVERY"
> -  fastboot -s $ANDROID_SERIAL flash recovery $FASTBOOT_RECOVERY
> +  fastboot -s "$ANDROID_SERIAL" flash recovery "$FASTBOOT_RECOVERY"
>    echo "Rebooting into recovery"
> -  fastboot -s $ANDROID_SERIAL boot $FASTBOOT_RECOVERY
> +  fastboot -s "$ANDROID_SERIAL" boot "$FASTBOOT_RECOVERY"
>    sleep 10
>    FASTBOOT=no
> -elif [ x"$FASTBOOT" = xyes ]; then
> +elif [ "$FASTBOOT" = xyes ]; then

According to https://www.shellcheck.net/wiki/SC2268 putting the x before a string comparison is unnecessary in bash since 1995(!). Although it should be removed from both sides of the comparison which I will do.

>    EXTRA="--bootstrap"
>    echo 'Rebooting to bootloader/fastboot'
> -  adb -s $ANDROID_SERIAL reboot bootloader
> +  adb -s "$ANDROID_SERIAL" reboot bootloader
>    sleep 10
>  fi
>  
>  echo 'flashing device'
>  FLASH_CMD="ubuntu-device-flash $SERVER $REVARGS touch --serial=$ANDROID_SERIAL --channel=$CHANNEL --device $DEVICE $DEVMODE $RECOVERY --wipe $EXTRA"
> -echo $FLASH_CMD
> +echo "$FLASH_CMD"
>  $FLASH_CMD
>  
>  echo 'waiting for device to boot'
> -adb -s $ANDROID_SERIAL wait-for-device
> +adb -s "$ANDROID_SERIAL" wait-for-device
>  echo 'waiting a few seconds for boot'
>  sleep 5
>  
>  # setup network; location of config per plars' advice
>  DEFAULT_NETWORK_CONFIG_PATH="/var/lib/jenkins/.ubuntu-ci/wifi.conf"
> -if [ -n NETWORK_CONFIG_PATH ]; then
> +if [ -n "$NETWORK_CONFIG_PATH" ]; then
>    NETWORK_CONFIG_PATH=$DEFAULT_NETWORK_CONFIG_PATH
>  fi
> -phablet-network -n $NETWORK_CONFIG_PATH
> +phablet-network -n "$NETWORK_CONFIG_PATH"
>  
>  # Disable the welcome wizard
> -if [ x"$WIZARD" = x"no" ]; then
> +if [ "$WIZARD" = x"no" ]; then
>    echo 'disabling wizard'
> -  phablet-config -s $ANDROID_SERIAL welcome-wizard --disable
> -  adb -s $ANDROID_SERIAL wait-for-device
> +  phablet-config -s "$ANDROID_SERIAL" welcome-wizard --disable
> +  adb -s "$ANDROID_SERIAL" wait-for-device
>    REBOOT_NEEDED=yes
>  fi
>  
>  # Disable the edges intro
> -if [ x"$EDGEINTRO" = x"no" ]; then
> +if [ "$EDGEINTRO" = x"no" ]; then
>    echo 'disabling edges intro'
> -  phablet-config -s $ANDROID_SERIAL edges-intro --disable
> -  adb -s $ANDROID_SERIAL wait-for-device
> +  phablet-config -s "$ANDROID_SERIAL" edges-intro --disable
> +  adb -s "$ANDROID_SERIAL" wait-for-device
>  fi
>  
> -if [ x"$REBOOT_NEEDED" = x"yes" ]; then
> +if [ "$REBOOT_NEEDED" = x"yes" ]; then
>    echo 'rebooting to activate previous changes'
> -  adb -s $ANDROID_SERIAL reboot
> -  adb -s $ANDROID_SERIAL wait-for-device
> +  adb -s "$ANDROID_SERIAL" reboot
> +  adb -s "$ANDROID_SERIAL" wait-for-device
>  fi
>  
>  # wait until our network is ready


-- 
https://code.launchpad.net/~canonical-platform-qa/qa-jenkins-jobs/+git/qa-jenkins-jobs/+merge/471372
Your team Canonical Platform QA Team is requested to review the proposed merge of qa-jenkins-jobs:pre-commit-hooks into qa-jenkins-jobs:master.



References