Periodically update Puppetfile_unit
This updates the script to automatically update puppet constraints so that Puppetfile_unit is updated as well as Puppetfile. We introduced this separate file[1] a while ago but have not been updated it properly. Updating it periodically helps us catch up with any update in the dependent modules more timely. [1] 047ea125ddefa8151d6592d4772560a1b23a13dc Depends-on: https://review.opendev.org/875301 Change-Id: I4d89a2985781f14d9ff7f76f412f0b8ccc4c6ddb
This commit is contained in:
		| @@ -57,3 +57,40 @@ done | ||||
|  | ||||
| # for debug | ||||
| cat $DIR/Puppetfile | ||||
|  | ||||
| # header | ||||
| echo -e "# Auto-generated Puppetfile for Puppet OpenStack project\n" > $DIR/Puppetfile_unit | ||||
|  | ||||
| # Unit test Modules | ||||
| for e in $(cat unit_modules.txt); do | ||||
|     namespace=$(echo $e | awk -F'/' '{print $1}' | cut -d "," -f 1) | ||||
|     module=$(echo $e | awk -F'/' '{print $2}' | cut -d "," -f 1) | ||||
|     title=$(echo $module | awk -F'/' '{print $1}' | cut -d "-" -f 2) | ||||
|     pin=$(echo $e | grep "," | cut -d "," -f 2) | ||||
|     if [ ! -z "$pin" ]; then | ||||
|         git ls-remote --exit-code https://github.com/$namespace/$module $pin | ||||
|         if (($? == 2)); then | ||||
|             if ! git ls-remote --exit-code https://github.com/$namespace/$module | grep -q $pin; then | ||||
|                 echo "Wrong pin: $pin does not exist in $module module." | ||||
|                 exit 1 | ||||
|             else | ||||
|                 tag=$pin | ||||
|             fi | ||||
|         else | ||||
|             tag=$pin | ||||
|         fi | ||||
|     else | ||||
|         git clone https://github.com/$namespace/$module modules/$module | ||||
|         tag=$(cd modules/$module; git describe --tags $(git rev-list --tags --max-count=1)) | ||||
|         rm -rf modules/$module | ||||
|     fi | ||||
|     cat >> $DIR/Puppetfile_unit <<EOF | ||||
| mod '$title', | ||||
|   :git => 'https://github.com/$namespace/$module', | ||||
|   :ref => '$tag' | ||||
|  | ||||
| EOF | ||||
| done | ||||
|  | ||||
| # for debug | ||||
| cat $DIR/Puppetfile_unit | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Takashi Kajinami
					Takashi Kajinami