2015-06-21 05:39:34 +01:00
|
|
|
#
|
|
|
|
# $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
|
|
|
|
|
2015-06-25 15:58:50 +01:00
|
|
|
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE"
|
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005:
r284893 (brd):
Add initial support for building Vagrant images for VMWare.
Next steps will be adding Virtualbox support and uploading
to Hashicorp Atlas for others to consume.
r284895:
Add default VAGRANT_IMG variable.
r284896:
Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the
VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF.
Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF
is set. There is intent to intentionally have separate
variants of configuration entries, but the defaults do not
yet have any reason to be different.
r284897:
Instead of hard-coding the PROVIDERS for upload, add the
VAGRANT_PROVIDERS variable. Right now, it defaults to only
vmware_desktop, virtualbox support is to follow at some point.
While here, fix the hashicorp URL: s/vagrant/atlas/, which
was result of a sed(1) replace (and my fault).
r284942 (brd):
Add Support for uploading Vagrant images to Hashicorp Atlas.
r284968:
Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if
not set, which expands to '11.0-CURRENT', for example.
If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix
the VAGRANT_VERSION with the snapshot date.
r284996:
Fix the gcloud port/package name.
r285005:
Remove the HH-MM suffix from the build date suffix.
It was useful when working out several kinks when testing
automated image uploading when retrying was necessary, but
now it is making things much too messy.
Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
|
|
|
SNAPSHOT_DATE!= date +-%Y-%m-%d
|
2015-06-21 05:39:34 +01:00
|
|
|
.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}
|
|
|
|
|