Esempio n. 1
0
  def __init__(self, factory, options, **kwargs):
    options_copy = copy.copy(options)
    options_copy.bom_path = None
    options_copy.bom_version = None
    options_copy.git_branch = 'master'
    options_copy.github_hostname = 'github.com'
    # Overrides later if --git_allow_publish_master_branch is false
    super(PublishHalyardCommand, self).__init__(factory, options_copy, **kwargs)

    check_options_set(options, ['halyard_version'])
    match = re.match(r'(\d+)\.(\d+)\.(\d+)-\d+', options.halyard_version)
    if match is None:
      raise_and_log_error(
          ConfigError('--halyard_version={version} is not X.Y.Z-<buildnum>'
                      .format(version=options.halyard_version)))
    self.__stable_version = '{major}.{minor}.{patch}'.format(
        major=match.group(1), minor=match.group(2), patch=match.group(3))

    self.__scm = BranchSourceCodeManager(options_copy, self.get_input_dir())
    self.__hal = HalRunner(options_copy)
    self.__gradle = GradleRunner(options_copy, self.__scm, self.metrics)
    self.__halyard_repo_md_path = os.path.join('docs', 'commands.md')

    dash = self.options.halyard_version.find('-')
    semver_str = self.options.halyard_version[0:dash]
    semver_parts = semver_str.split('.')
    if len(semver_parts) != 3:
      raise_and_log_error(
          ConfigError('Expected --halyard_version in the form X.Y.Z-N'))
    self.__release_branch = 'release-{maj}.{min}.x'.format(
        maj=semver_parts[0], min=semver_parts[1])
    self.__release_tag = 'version-' + semver_str
    self.__release_version = semver_str
Esempio n. 2
0
 def _check_args(self):
     options = self.options
     check_options_set(options, ["swagger_codegen_cli_jar_path"])
     check_path_exists(
         options.swagger_codegen_cli_jar_path,
         why="options.swagger_codegen_cli_jar_path",
     )
Esempio n. 3
0
 def __init__(self, factory, options, **kwargs):
     super(CreateReleaseChangelogCommand, self).__init__(factory, options, **kwargs)
     check_options_set(
         options,
         ["build_changelog_gist_url", "changelog_gist_url", "spinnaker_version"],
     )
     self.__git = GitRunner(options)
Esempio n. 4
0
    def __init__(self, factory, options, **kwargs):
        super(PublishSpinnakerCommand, self).__init__(factory, options,
                                                      **kwargs)
        check_options_set(options, [
            'spinnaker_version', 'spinnaker_release_alias', 'bom_version',
            'changelog_gist_url', 'github_owner', 'min_halyard_version'
        ])

        major, minor, _ = self.options.spinnaker_version.split('.')
        self.__branch = 'release-{major}.{minor}.x'.format(major=major,
                                                           minor=minor)

        options_copy = copy.copy(options)
        self.__bom_scm = BomSourceCodeManager(options_copy,
                                              self.get_input_dir())
        self.__hal = HalRunner(options)
        self.__git = GitRunner(options)
        self.__hal.check_property('spinnaker.config.input.bucket',
                                  options.halyard_bom_bucket)
        if options.only_repositories:
            self.__only_repositories = options.only_repositories.split(',')
        else:
            self.__only_repositories = []

        options_copy.git_branch = self.__branch
        self.__branch_scm = BranchSourceCodeManager(options_copy,
                                                    self.get_input_dir())
Esempio n. 5
0
  def __init__(self, factory, options, **kwargs):
    options_copy = copy.copy(options)
    options_copy.bom_path = None
    options_copy.bom_version = None
    options_copy.git_branch = 'master'
    options_copy.github_hostname = 'github.com'
    # Overrides later if --git_allow_publish_master_branch is false
    super(PublishHalyardCommand, self).__init__(factory, options_copy, **kwargs)

    check_options_set(options, ['halyard_version'])
    match = re.match(r'(\d+)\.(\d+)\.(\d+)-\d+', options.halyard_version)
    if match is None:
      raise_and_log_error(
          ConfigError('--halyard_version={version} is not X.Y.Z-<buildnum>'
                      .format(version=options.halyard_version)))
    self.__stable_version = '{major}.{minor}.{patch}'.format(
        major=match.group(1), minor=match.group(2), patch=match.group(3))

    self.__scm = BranchSourceCodeManager(options_copy, self.get_input_dir())
    self.__hal = HalRunner(options_copy)
    self.__gradle = GradleRunner(options_copy, self.__scm, self.metrics)
    self.__halyard_repo_md_path = os.path.join('docs', 'commands.md')

    dash = self.options.halyard_version.find('-')
    semver_str = self.options.halyard_version[0:dash]
    semver_parts = semver_str.split('.')
    if len(semver_parts) != 3:
      raise_and_log_error(
          ConfigError('Expected --halyard_version in the form X.Y.Z-N'))
    self.__release_branch = 'release-{maj}.{min}.x'.format(
        maj=semver_parts[0], min=semver_parts[1])
    self.__release_tag = 'version-' + semver_str
    self.__release_version = semver_str
Esempio n. 6
0
  def __init__(self, factory, options, **kwargs):
    super(PublishSpinnakerCommand, self).__init__(factory, options, **kwargs)
    check_options_set(options, [
        'spinnaker_version',
        'spinnaker_release_alias',
        'bom_version',
        'changelog_gist_url',
        'github_owner',
        'min_halyard_version'
    ])

    major, minor, _ = self.options.spinnaker_version.split('.')
    self.__branch = 'release-{major}.{minor}.x'.format(
        major=major, minor=minor)

    options_copy = copy.copy(options)
    self.__bom_scm = BomSourceCodeManager(options_copy, self.get_input_dir())
    self.__hal = HalRunner(options)
    self.__git = GitRunner(options)
    self.__hal.check_property(
        'spinnaker.config.input.bucket', options.halyard_bom_bucket)
    if options.only_repositories:
      self.__only_repositories = options.only_repositories.split(',')
    else:
      self.__only_repositories = []

    options_copy.git_branch = self.__branch
    self.__branch_scm = BranchSourceCodeManager(
        options_copy, self.get_input_dir())
Esempio n. 7
0
    def __init__(self, *pos_args, **kwargs):
        super(BranchSourceCodeManager, self).__init__(*pos_args, **kwargs)
        options = self.options
        check_options_set(options,
                          ['git_branch', 'github_owner', 'github_hostname'])

        self.__github_owner = (options.github_owner if hasattr(
            options, 'github_owner') else None)
Esempio n. 8
0
    def __init__(self, factory, options, **kwargs):
        check_options_set(options, [
            'build_gce_service_account', 'build_gce_project',
            'publish_gce_image_project'
        ])

        options.github_disable_upstream_push = True
        super(BuildGceComponentImages, self).__init__(factory, options,
                                                      **kwargs)
Esempio n. 9
0
 def __init__(self, factory, options, **kwargs):
     super(GetNextPatchParametersCommand,
           self).__init__(factory, options, **kwargs)
     check_options_set(
         options,
         [
             "major_minor_version",
         ],
     )
Esempio n. 10
0
  def __init__(self, *pos_args, **kwargs):
    super(BranchSourceCodeManager, self).__init__(*pos_args, **kwargs)
    options = self.options
    check_options_set(options,
                      ['git_branch', 'github_owner', 'github_hostname'])

    self.__github_owner = (options.github_owner
                           if hasattr(options, 'github_owner')
                           else None)
Esempio n. 11
0
  def __init__(self, factory, options, **kwargs):
    super(PushChangelogCommand, self).__init__(factory, options, **kwargs)
    check_options_set(
        options, ['build_changelog_gist_url', 'git_branch'])

    if not options.changelog_path:
      options.changelog_path = os.path.join(
          self.get_output_dir(command=BUILD_CHANGELOG_COMMAND), 'changelog.md')
    check_path_exists(options.changelog_path, why='changelog_path')

    self.__git = GitRunner(options)
    def __init__(self, factory, options, **kwargs):
        super(PushChangelogCommand, self).__init__(factory, options, **kwargs)
        check_options_set(options, ['build_changelog_gist_url', 'git_branch'])

        if not options.changelog_path:
            options.changelog_path = os.path.join(
                self.get_output_dir(command=BUILD_CHANGELOG_COMMAND),
                'changelog.md')
        check_path_exists(options.changelog_path, why='changelog_path')

        self.__git = GitRunner(options)
Esempio n. 13
0
 def __init__(self, factory, options, **kwargs):
   super(PublishChangelogCommand, self).__init__(
       factory, make_options_with_fallback(options),
       source_repository_names=[SPINNAKER_GITHUB_IO_REPOSITORY_NAME],
       **kwargs)
   check_options_set(options, ['spinnaker_version'])
   self.__markdown_path = os.path.join(
       self.get_output_dir(command=BUILD_CHANGELOG_COMMAND),
       'changelog.md')
   check_path_exists(self.__markdown_path,
                     why='output from "%s"' % BUILD_CHANGELOG_COMMAND)
  def __init__(self, factory, options, **kwargs):
    options.github_disable_upstream_push = True
    super(BuildDebianCommand, self).__init__(factory, options, **kwargs)
    self.__semaphore = Semaphore(options.max_local_builds)

    if not os.environ.get('BINTRAY_KEY'):
      raise_and_log_error(ConfigError('Expected BINTRAY_KEY set.'))
    if not os.environ.get('BINTRAY_USER'):
      raise_and_log_error(ConfigError('Expected BINTRAY_USER set.'))
    check_options_set(
        options, ['bintray_org', 'bintray_jar_repository',
                  'bintray_debian_repository', 'bintray_publish_wait_secs'])
Esempio n. 15
0
    def __init__(self, factory, options, **kwargs):
        check_options_set(options,
                          ['build_gce_service_account', 'build_gce_project'])

        options.github_disable_upstream_push = True
        super(BuildGceComponentImages, self).__init__(factory, options,
                                                      **kwargs)
        artifact_sources = self.source_code_manager.bom['artifactSources']
        self.__image_project = artifact_sources['googleImageProject']
        if not self.__image_project:
            raise_and_log_error(
                ConfigError('BOM has no artifactSources.googleImageProject'))
Esempio n. 16
0
  def __init__(self, factory, options, **kwargs):
    check_options_set(
        options,
        ['build_gce_service_account',
         'build_gce_project'])

    options.github_disable_upstream_push = True
    super(BuildGceComponentImages, self).__init__(factory, options, **kwargs)
    artifact_sources = self.source_code_manager.bom['artifactSources']
    self.__image_project = artifact_sources['googleImageProject']
    if not self.__image_project:
      raise_and_log_error(
          ConfigError('BOM has no artifactSources.googleImageProject'))
Esempio n. 17
0
    def __init__(self, factory, options, **kwargs):
        super(PublishSpinnakerCommand, self).__init__(factory, options,
                                                      **kwargs)
        check_options_set(options, [
            'spinnaker_version', 'bom_version', 'github_owner',
            'min_halyard_version'
        ])

        options_copy = copy.copy(options)
        self.__scm = BomSourceCodeManager(options_copy, self.get_input_dir())
        self.__hal = HalRunner(options)
        self.__git = GitRunner(options)
        self.__hal.check_property('spinnaker.config.input.bucket',
                                  options.halyard_bom_bucket)
 def __init__(self, factory, options, **kwargs):
     super(PublishChangelogCommand, self).__init__(
         factory,
         make_options_with_fallback(options),
         source_repository_names=[SPINNAKER_GITHUB_IO_REPOSITORY_NAME],
         **kwargs)
     check_options_set(options, ['spinnaker_version', 'changelog_gist_url'])
     try:
         logging.debug('Verifying changelog gist exists at "%s"',
                       options.changelog_gist_url)
         urlopen(options.changelog_gist_url)
     except HTTPError as error:
         raise_and_log_error(
             ConfigError(u'Changelog gist "{url}": {error}'.format(
                 url=options.changelog_gist_url, error=error.message)))
Esempio n. 19
0
  def __init__(self, factory, options, **kwargs):
    super(CollectArtifactVersions, self).__init__(
        factory, options, **kwargs)

    check_options_set(options,
                      ['docker_registry', 'bintray_org',
                       'bintray_jar_repository', 'bintray_debian_repository'])
    user = os.environ.get('BINTRAY_USER')
    password = os.environ.get('BINTRAY_KEY')
    if user and password:
      encoded_auth = base64.encodestring('{user}:{password}'.format(
          user=user, password=password))[:-1]  # strip eoln
      self.__basic_auth = 'Basic ' + encoded_auth
    else:
      self.__basic_auth = None
Esempio n. 20
0
 def __init__(self, factory, options, **kwargs):
   super(PublishChangelogCommand, self).__init__(
       factory, make_options_with_fallback(options),
       source_repository_names=[SPINNAKER_GITHUB_IO_REPOSITORY_NAME],
       **kwargs)
   check_options_set(options, ['spinnaker_version', 'changelog_gist_url'])
   try:
     logging.debug('Verifying changelog gist exists at "%s"',
                   options.changelog_gist_url)
     urlopen(options.changelog_gist_url)
   except HTTPError as error:
     raise_and_log_error(
         ConfigError(
             u'Changelog gist "{url}": {error}'.format(
                 url=options.changelog_gist_url,
                 error=error.message)))
Esempio n. 21
0
  def __init__(self, factory, options, **kwargs):
    options_copy = copy.copy(options)
    options_copy.git_branch = 'master'
    options_copy.github_hostname = 'github.com'
    super(PublishSpinCommand, self).__init__(factory, options_copy, **kwargs)

    check_options_set(options, ['spin_version']) # Ensure we have a version to promote.
    bom_contents = BomSourceCodeManager.load_bom(options_copy)
    gate_entry = bom_contents.get('services', {}).get('gate', {})
    if not gate_entry:
      raise_and_log_error(
          ConfigError('No gate service entry found in bom {}'.format(bom_contents)))

    self.__spinnaker_version = options.bom_version or bom_contents['version']
    self.__gate_version = gate_entry['version']
    self.__stable_version = None # Set after promote_spin.
    self.__no_changes = False # Set after promote_spin.
    self.__scm = BranchSourceCodeManager(options_copy, self.get_input_dir())
    self.__gcs_uploader = SpinGcsUploader(options)
Esempio n. 22
0
  def __init__(self, factory, options, **kwargs):
    options_copy = copy.copy(options)
    options_copy.git_branch = 'master'
    options_copy.github_hostname = 'github.com'
    super(PublishSpinCommand, self).__init__(factory, options_copy, **kwargs)

    check_options_set(options, ['spin_version']) # Ensure we have a version to promote.
    bom_contents = BomSourceCodeManager.load_bom(options_copy)
    gate_entry = bom_contents.get('services', {}).get('gate', {})
    if not gate_entry:
      raise_and_log_error(
          ConfigError('No gate service entry found in bom {}'.format(bom_contents)))

    self.__spinnaker_version = options.bom_version or bom_contents['version']
    self.__gate_version = gate_entry['version']
    self.__stable_version = None # Set after promote_spin.
    self.__no_changes = False # Set after promote_spin.
    self.__scm = BranchSourceCodeManager(options_copy, self.get_input_dir())
    self.__gcs_uploader = SpinGcsUploader(options)
Esempio n. 23
0
 def __init__(self, factory, options, **kwargs):
     super(InitiateReleaseBranchCommand,
           self).__init__(factory, options, **kwargs)
     check_options_set(options, ['spinnaker_version'])
     self.__git = GitRunner(options)
Esempio n. 24
0
 def _check_args(self):
   check_path_exists(self.__html_path,
                     why='output from running "build_apidocs"')
   check_options_set(self.options, ['spinnaker_version'])
Esempio n. 25
0
 def _check_args(self):
   options = self.options
   check_options_set(options, ['swagger_codegen_cli_jar_path'])
   check_path_exists(options.swagger_codegen_cli_jar_path,
                     why='options.swagger_codegen_cli_jar_path')
Esempio n. 26
0
 def _check_args(self):
     check_path_exists(self.__html_path,
                       why='output from running "build_apidocs"')
     check_options_set(self.options, ['spinnaker_version'])
Esempio n. 27
0
 def __init__(self, factory, options, **kwargs):
   super(InitiateReleaseBranchCommand, self).__init__(
       factory, options, **kwargs)
   check_options_set(options, ['spinnaker_version'])
   self.__git = GitRunner(options)