def CMDupload(parser, args): """Uploads a new version of specific (or all) modules of an app. Version name looks like <number>-<commit sha1>[-tainted-<who>], where: number git commit number, monotonically increases with each commit commit sha1 upstream commit hash the branch is based of tainted git repo has local modifications compared to upstream branch who username who uploads the tainted version Doesn't make it a default unless --switch is specified. Use 'switch' subcommand to change default serving version. """ parser.add_tag_option() parser.add_switch_option() parser.add_force_option() parser.allow_positional_args = True app, options, modules = parser.parse_args(args) for module in modules: if module not in app.modules: parser.error('No such module: %s' % module) version = calculate_version.calculate_version(app.app_dir, options.tag) # Updating indexes, queues, etc is a disruptive operation. Confirm. if not options.force: approved = gae_sdk_utils.confirm( 'Upload new version, update indexes, queues and cron jobs?', app, version, modules) if not approved: print('Aborted.') return 1 # 'appcfg.py update <list of modules>' does not update the rest of app engine # app like 'appcfg.py update <app dir>' does. It updates only modules. So do # index, queues, etc. updates manually afterwards. app.update_modules(version, modules) app.update_indexes() app.update_queues() app.update_cron() app.update_dispatch() print('-' * 80) print('New version:') print(' %s' % version) print('Uploaded as:') print(' https://%s-dot-%s.appspot.com' % (version, app.app_id)) print('Manage at:') print(' https://appengine.google.com/deployment?app_id=s~' + app.app_id) print('-' * 80) if options.switch: if 'tainted-' in version: print('') print >> sys.stderr, 'Can\'t use --switch with a tainted version!' return 1 print('Switching as default version') app.set_default_version(version) return 0
def CMDversion(parser, args): """Prints version name that correspond to current state of the checkout. 'update' subcommand uses this version when uploading code to GAE. Version name looks like <number>-<commit sha1>[-tainted-<who>], where: number git commit number, monotonically increases with each commit commit sha1 upstream commit hash the branch is based of tainted git repo has local modifications compared to upstream branch who username who uploads the tainted version """ parser.add_tag_option() app, options, _ = parser.parse_args(args) print(calculate_version.calculate_version(app.app_dir, options.tag)) return 0
def CMDupload(parser, args): """Uploads a new version of specific (or all) modules of an app. Note that module yamls are expected to be named module-<module name>.yaml Version name looks like <number>-<commit sha1>[-tainted-<who>], where: number git commit number, monotonically increases with each commit commit sha1 upstream commit hash the branch is based of tainted git repo has local modifications compared to upstream branch who username who uploads the tainted version Doesn't make it a default unless --switch is specified. Use 'switch' subcommand to change default serving version. """ parser.add_tag_option() parser.add_option('-x', '--switch', action='store_true', help='Switch version after uploading new code') parser.add_switch_option() parser.add_force_option() parser.allow_positional_args = True app, options, modules = parser.parse_args(args) for module in modules: if module not in app.modules: parser.error('No such module: %s' % module) # Additional chars is for the app_id as well as 5 chars for '-dot-'. version = calculate_version.calculate_version(app.app_dir, options.tag, len(app.app_id) + 5) # Updating indexes, queues, etc is a disruptive operation. Confirm. if not options.force: approved = gae_sdk_utils.confirm( 'Upload new version, update indexes, queues and cron jobs?', app, version, modules, default_yes=True) if not approved: print('Aborted.') return 1 app.update(version, modules) print('-' * 80) print('New version:') print(' %s' % version) print('Uploaded as:') print(' https://%s-dot-%s.appspot.com' % (version, app.app_id)) print('Manage at:') print(' https://console.cloud.google.com/appengine/versions?project=' + app.app_id) print('-' * 80) if not options.switch: return 0 if 'tainted-' in version: print('') print >> sys.stderr, 'Can\'t use --switch with a tainted version!' return 1 _print_version_log(app, version) print('Switching as default version') app.set_default_version(version) return 0
def calculate_version(self, tag=None): return calculate_version.calculate_version(self.app_dir, tag)