diff --git a/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php b/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php index 7256a1ab36bb17284cf6a7822b545a4f3f26dfb2..461c46ab9dada341531c624441f38fc24a7878c0 100644 --- a/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php +++ b/drupalorg_project/plugins/release_packager/DrupalorgProjectPackageRelease.class.php @@ -159,7 +159,7 @@ class DrupalorgProjectPackageRelease implements ProjectReleasePackagerInterface */ protected function _createPackage(&$files) { // Remember if the tar.gz version of this release file already exists. - if (is_file($this->filenames['full_dest_tgz'])) { + if (is_file($this->filenames['full_dest_tgz']) || is_file($this->filenames['full_dest_zip'])) { $this->build_type = 'rebuild'; } @@ -181,6 +181,27 @@ class DrupalorgProjectPackageRelease implements ProjectReleasePackagerInterface throw new Exception(format_string('%release_title does not have a VCS repository defined', ['%release_title' => $this->release_node->title])); } + if ($this->project_short_name === 'drupal_cms') { + // Use the CI build instead. + try { + $gitlab_project_id = versioncontrol_project_repository_load($this->project_node->nid)->gitlab_project_id; + $client = new GuzzleHttp\Client(); + $response = $client->request('GET', 'https://git.drupalcode.org/api/v4/projects/' . $gitlab_project_id . '/jobs/artifacts/' . urlencode($this->git_label) . '/raw/drupal-cms.zip', [ + 'query' => ['job' => 'drupal.org release'], + ]); + file_unmanaged_save_data((string) $response->getBody(), $this->filenames['full_dest_zip'], FILE_EXISTS_REPLACE); + $files[$this->filenames['path_zip']] = 0; + return $this->build_type; + } + catch (Exception $e) { + watchdog('package_error', 'Exception in fetching CI artifact for @id: @message', [ + '@id' => $this->project_short_name, + '@message' => $e->getMessage(), + ], WATCHDOG_NOTICE); + } + return 'no-op'; + } + // Clone this release from Git if (!drush_shell_exec('git clone --branch=%s %s %s', $this->git_label, $this->git_url, $this->git_checkout_dir)) { throw new Exception(format_string('Git clone failed: <pre>@output</pre>', ['@output' => implode("\n", drush_shell_exec_output())]));