Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 2015 19:20:00 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284567 - head/release
Message-ID:  <201506181920.t5IJK0fO086193@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Thu Jun 18 19:20:00 2015
New Revision: 284567
URL: https://svnweb.freebsd.org/changeset/base/284567

Log:
  Add Makefile.azure, used to upload VHD images to the
  Microsoft Azure environment, similar to the EC2 AMIs.
  
  MFC after:	3 days
  Tested with:	stable/10@r284517 (patched)
  Sponsored by:	The FreeBSD Foundation

Added:
  head/release/Makefile.azure   (contents, props changed)
Modified:
  head/release/Makefile.vm

Added: head/release/Makefile.azure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/release/Makefile.azure	Thu Jun 18 19:20:00 2015	(r284567)
@@ -0,0 +1,53 @@
+#
+# $FreeBSD$
+#
+#
+# Makefile for uploading Microsoft Azure disk images.
+#
+
+AZURE_IMG?=		${.OBJDIR}/azure.vhdf
+AZURE_UPLOAD_TGTS=	azure-check-depends \
+			azure-do-upload
+CLEANFILES+=		${AZURE_UPLOAD_TGTS}
+
+.if defined(AZURE_UPLOAD_CONF) && !empty(AZURE_UPLOAD_CONF)
+. for VAR in _STORAGE _ACCOUNT _KEY
+AZURE${VAR}!=	grep -E ^AZURE${VAR} ${AZURE_UPLOAD_CONF} | awk -F'	' '{print $$2}'
+. endfor
+.endif
+
+.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT"
+SNAPSHOT_DATE!=		date +-%Y-%m-%d
+.endif
+
+AZURE_TARGET:=		${OSRELEASE}${SNAPSHOT_DATE}.vhd
+
+azure-upload:		${AZURE_UPLOAD_TGTS}
+
+azure-check-depends:
+.for VAR in _STORAGE _ACCOUNT _KEY
+. if !defined(AZURE${VAR}) || empty(AZURE${VAR})
+	@echo "Variable AZURE${VAR} cannot be empty."
+	@false
+. endif
+.endfor
+.if !exists(/usr/local/bin/azure)
+. if !exists(/usr/local/bin/npm)
+.  if !exists(${PORTSDIR}/www/npm/Makefile)
+.   if !exists(/usr/local/sbin/pkg-static)
+	env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf
+.   endif
+	env ASSUME_ALWAYS_YES=yes pkg install -y www/npm
+.  else
+	make -C ${PORTSDIR}/www/npm BATCH=1 all install clean
+.  endif
+. endif
+	npm install -g azure-cli
+.endif
+
+azure-do-upload:
+	/usr/local/bin/azure storage blob upload \
+		${AZURE_IMG} ${AZURE_STORAGE} ${AZURE_TARGET} \
+		-t page -a ${AZURE_ACCOUNT} -k "${AZURE_KEY}"
+	touch ${.OBJDIR}/${.TARGET}
+

Modified: head/release/Makefile.vm
==============================================================================
--- head/release/Makefile.vm	Thu Jun 18 18:28:38 2015	(r284566)
+++ head/release/Makefile.vm	Thu Jun 18 19:20:00 2015	(r284567)
@@ -154,3 +154,4 @@ cloudware-install:
 .endif
 
 .include "${.CURDIR}/Makefile.ec2"
+.include "${.CURDIR}/Makefile.azure"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506181920.t5IJK0fO086193>