def init_argparser(self, parser, defaults): super(PublishSpinnakerFactory, self).init_argparser(parser, defaults) HalRunner.add_parser_args(parser, defaults) GitRunner.add_parser_args(parser, defaults) GitRunner.add_publishing_parser_args(parser, defaults) PublishChangelogFactory().init_argparser(parser, defaults) self.add_argument(parser, 'spinnaker_release_alias', defaults, None, help='The spinnaker version alias to publish as.') self.add_argument( parser, 'halyard_bom_bucket', defaults, 'halconfig', help='The bucket manaing halyard BOMs and config profiles.') self.add_argument( parser, 'bom_version', defaults, None, help='The existing bom version usef for this release.') self.add_argument(parser, 'min_halyard_version', defaults, None, help='The minimum halyard version required.')
def _do_command(self): """Implements CommandProcessor interface.""" options = self.options spinnaker_version = options.spinnaker_version options_copy = copy.copy(options) options_copy.git_branch = "master" # push to master in spinnaker.io publish_changelog_command = PublishChangelogFactory().make_command( options_copy) changelog_gist_url = options.changelog_gist_url # Make sure changelog exists already. # If it does not then fail. try: logging.debug("Verifying changelog ready at %s", changelog_gist_url) urlopen(changelog_gist_url) except HTTPError: logging.error(exception_to_message) raise_and_log_error( ConfigError( 'Changelog gist "{url}" must exist before publising a release.' .format(url=changelog_gist_url), cause="ChangelogMissing", )) bom = self.__hal.retrieve_bom_version(self.options.bom_version) bom["version"] = spinnaker_version bom_path = os.path.join(self.get_output_dir(), spinnaker_version + ".yml") write_to_path(yaml.safe_dump(bom, default_flow_style=False), bom_path) self.__hal.publish_bom_path(bom_path) self.push_branches_and_tags(bom) self.__hal.publish_spinnaker_release( spinnaker_version, options.spinnaker_release_alias, changelog_gist_url, options.min_halyard_version, ) prior_version = get_prior_version(spinnaker_version) if prior_version is not None: self.__hal.deprecate_spinnaker_release(prior_version) logging.info("Publishing changelog") publish_changelog_command()
def _do_command(self): """Implements CommandProcessor interface.""" options = self.options spinnaker_version = options.spinnaker_version options_copy = copy.copy(options) options_copy.git_branch = 'master' # push to master in spinnaker.github.io publish_changelog_command = PublishChangelogFactory().make_command( options_copy) changelog_gist_url = options.changelog_gist_url # Make sure changelog exists already. # If it does not then fail. try: logging.debug('Verifying changelog ready at %s', changelog_gist_url) urllib2.urlopen(changelog_gist_url) except urllib2.HTTPError as error: logging.error(error.message) raise_and_log_error( ConfigError( 'Changelog gist "{url}" must exist before publising a release.' .format(url=changelog_gist_url), cause='ChangelogMissing')) bom = self.__hal.retrieve_bom_version(self.options.bom_version) bom['version'] = spinnaker_version bom_path = os.path.join(self.get_output_dir(), spinnaker_version + '.yml') write_to_path(yaml.dump(bom, default_flow_style=False), bom_path) self.__hal.publish_bom_path(bom_path) self.push_branches_and_tags(bom) self.__hal.publish_spinnaker_release(spinnaker_version, options.spinnaker_release_alias, changelog_gist_url, options.min_halyard_version) logging.info('Publishing changelog') publish_changelog_command()