| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | set +x | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-25 17:55:57 -08:00
										 |  |  | if [[ $(uname) != "Linux" ]]; then | 
					
						
							| 
									
										
										
										
											2020-03-07 22:07:47 +05:30
										 |  |  |   echo "ERROR: this script is designed to be run on Linux. Can't run on $(uname)" | 
					
						
							| 
									
										
										
										
											2019-11-25 17:55:57 -08:00
										 |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  | if [[ ($1 == '--help') || ($1 == '-h') ]]; then | 
					
						
							| 
									
										
										
										
											2019-11-22 20:30:38 -08:00
										 |  |  |   echo "usage: $(basename $0)" | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  |   echo | 
					
						
							|  |  |  |   echo "Pull from upstream & run checkout_build_archive_upload.sh" | 
					
						
							|  |  |  |   echo "in a safe way so that multiple instances of the script cannot be run" | 
					
						
							| 
									
										
										
										
											2019-11-22 20:25:36 -08:00
										 |  |  |   echo | 
					
						
							|  |  |  |   echo "This script is designed to be run as a cronjob" | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  |   exit 0 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 18:52:51 -08:00
										 |  |  | if [[ (-z $AZ_ACCOUNT_KEY) || (-z $AZ_ACCOUNT_NAME) ]]; then | 
					
						
							|  |  |  |   echo "ERROR: Either \$AZ_ACCOUNT_KEY or \$AZ_ACCOUNT_NAME environment variable is missing." | 
					
						
							|  |  |  |   echo "       'Azure Account Name' and 'Azure Account Key' secrets that are required" | 
					
						
							|  |  |  |   echo "       to upload builds ot Azure CDN." | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-22 15:48:25 -08:00
										 |  |  | if ! command -v az >/dev/null; then | 
					
						
							| 
									
										
										
										
											2019-11-21 19:14:30 -08:00
										 |  |  |   echo "ERROR: az is not found in PATH" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2019-11-21 18:52:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  | # Setup a LOCKDIR so that we don't run the same script multiple times. | 
					
						
							| 
									
										
										
										
											2019-11-22 20:25:36 -08:00
										 |  |  | LOCKDIR="/tmp/$(basename $0).lock" | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  | if [[ -d ${LOCKDIR} ]]; then | 
					
						
							|  |  |  |   echo "Already running (lockdir $LOCKDIR exists. Remove it manually if running)" | 
					
						
							|  |  |  |   exit 0 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2019-11-22 20:25:36 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 17:39:11 -08:00
										 |  |  | mkdir -p $LOCKDIR | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  | # make sure the lockfile is removed when we exit and then claim it | 
					
						
							|  |  |  | trap "rm -rf ${LOCKDIR}; cd $(pwd -P); exit" INT TERM EXIT | 
					
						
							|  |  |  | cd "$(dirname "$0")" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 17:43:53 -08:00
										 |  |  | IS_FIRST_RUN_FILE="/tmp/pw-buildbot-first-run.txt"; | 
					
						
							|  |  |  | if ! [[ -f $IS_FIRST_RUN_FILE ]]; then | 
					
						
							|  |  |  |   source ./send_telegram_message.sh | 
					
						
							|  |  |  |   send_telegram_message '**Linux Buildbot Is Active**' | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2019-12-26 21:20:29 +01:00
										 |  |  | touch "$IS_FIRST_RUN_FILE" | 
					
						
							| 
									
										
										
										
											2019-12-10 17:43:53 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  | # Check if git repo is dirty. | 
					
						
							|  |  |  | if [[ -n $(git status -s) ]]; then | 
					
						
							| 
									
										
										
										
											2019-11-22 20:25:36 -08:00
										 |  |  |   echo "ERROR: dirty GIT state - commit everything and re-run the script." | 
					
						
							| 
									
										
										
										
											2019-11-21 15:25:46 -08:00
										 |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | git pull origin master | 
					
						
							| 
									
										
										
										
											2020-01-17 14:23:31 -08:00
										 |  |  | ../checkout_build_archive_upload.sh firefox-linux >/tmp/$(basename $0)--firefox-linux.log || true | 
					
						
							| 
									
										
										
										
											2019-11-22 20:25:36 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | git pull origin master | 
					
						
							| 
									
										
										
										
											2020-01-17 14:23:31 -08:00
										 |  |  | ../checkout_build_archive_upload.sh webkit-gtk >/tmp/$(basename $0)--webkit-gtk.log || true | 
					
						
							| 
									
										
										
										
											2020-01-17 14:37:17 -08:00
										 |  |  | ../checkout_build_archive_upload.sh webkit-wpe >/tmp/$(basename $0)--webkit-wpe.log || true | 
					
						
							| 
									
										
										
										
											2020-01-17 16:37:49 -08:00
										 |  |  | ../checkout_build_archive_upload.sh webkit-gtk-wpe >/tmp/$(basename $0)--webkit-gtk-wpe.log || true |