Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for uploading Google Compute Engine disk images.
|
|
|
|
#
|
|
|
|
|
|
|
|
GCE_IMG?= ${.OBJDIR}/gce.raw
|
|
|
|
GCE_UPLOAD_TGTS= gce-check-depends \
|
|
|
|
gce-do-package \
|
|
|
|
gce-do-upload
|
|
|
|
# I do not yet have a better way to deal with the "must be run interactively"
|
|
|
|
# thing, so this is a fail-safe "do not do anything."
|
|
|
|
.if !defined(GCE_LOGIN_SKIP) || empty(GCE_LOGIN_SKIP)
|
|
|
|
GCE_UPLOAD_TGTS= gce-do-login
|
|
|
|
.endif
|
|
|
|
CLEANFILES+= ${GCE_UPLOAD_TGTS}
|
|
|
|
|
|
|
|
GCE_BUCKET?=
|
2018-05-10 21:46:58 +00:00
|
|
|
GCE_LICENSE?=
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
|
2018-03-30 19:08:37 +00:00
|
|
|
.if !defined(GCE_FAMILY) || empty(GCE_FAMILY)
|
|
|
|
GCE_FAMILY= ${TYPE:tl}-${REVISION:S,.,-,}
|
|
|
|
.endif
|
|
|
|
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE"
|
2020-08-12 16:25:25 +00:00
|
|
|
SNAPSHOT_DATE= -v${BUILDDATE}
|
2018-03-30 19:08:37 +00:00
|
|
|
GCE_FAMILY_SUFX= -snap
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
# Really? Uppercase characters are not allowed? Sigh...
|
|
|
|
# And don't even get me started on the '.'.
|
|
|
|
GCE_TARGET:= ${OSRELEASE:S,.raw,,:tl:S,.,-,g}${SNAPSHOT_DATE}
|
|
|
|
|
|
|
|
gce-upload: ${GCE_UPLOAD_TGTS}
|
|
|
|
|
|
|
|
gce-check-depends:
|
|
|
|
.for VAR in _BUCKET
|
|
|
|
. if !defined(GCE${VAR}) || empty(GCE${VAR})
|
|
|
|
@echo "Variable GCE${VAR} cannot be empty."
|
|
|
|
@false
|
|
|
|
. endif
|
|
|
|
.endfor
|
2016-08-05 19:00:45 +00:00
|
|
|
.if !exists(/usr/local/bin/gcloud)
|
2015-07-01 08:48:49 +00:00
|
|
|
. if !exists(${PORTSDIR}/net/google-cloud-sdk/Makefile)
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
. if !exists(/usr/local/sbin/pkg-static)
|
|
|
|
env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf
|
|
|
|
. endif
|
2023-07-17 20:16:46 +00:00
|
|
|
env ASSUME_ALWAYS_YES=yes pkg install -y net/google-cloud-sdk \
|
|
|
|
lang/python
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
. else
|
2021-03-04 14:22:45 +00:00
|
|
|
env UNAME_r=${UNAME_r} make -C ${PORTSDIR}/net/google-cloud-sdk BATCH=1 all install clean
|
2023-07-12 20:08:40 +00:00
|
|
|
env UNAME_r=${UNAME_r} make -C ${PORTSDIR}/lang/python BATCH=1 all install clean
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
gce-do-package:
|
|
|
|
@# Yes, really... Sigh.
|
|
|
|
cd ${.OBJDIR} && mv gce.raw disk.raw
|
|
|
|
cd ${.OBJDIR} && tar --format=gnutar -zcf \
|
|
|
|
${GCE_TARGET:S,${.OBJDIR}/,,}.tar.gz disk.raw
|
|
|
|
cd ${.OBJDIR} && mv disk.raw gce.raw
|
|
|
|
touch ${.OBJDIR}/${.TARGET}
|
|
|
|
|
|
|
|
gce-do-login:
|
|
|
|
@echo "This requires human interaction, which is not yet supported."
|
|
|
|
@true
|
|
|
|
|
|
|
|
gce-do-upload:
|
|
|
|
@# Fallthrough in case the bucket already exists.
|
|
|
|
/usr/local/bin/gsutil mb gs://${GCE_BUCKET} || true
|
|
|
|
/usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET}.tar.gz \
|
|
|
|
gs://${GCE_BUCKET}/
|
2016-08-05 19:00:45 +00:00
|
|
|
/usr/local/bin/gcloud compute images create ${GCE_TARGET} \
|
2018-05-10 21:46:58 +00:00
|
|
|
--family=${GCE_FAMILY}${GCE_FAMILY_SUFX} ${GCE_LICENSE} \
|
2016-08-05 19:00:45 +00:00
|
|
|
--source-uri gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz
|
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.
By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.
I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.
As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.
MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation
2015-06-27 01:29:59 +00:00
|
|
|
touch ${.OBJDIR}/${.TARGET}
|
|
|
|
|