From c7e1c8bc0c09d22d3e6cc87bbbceda97d9fd32db Mon Sep 17 00:00:00 2001 From: Emanuele Aina <emanuele.aina@collabora.com> Date: Thu, 12 May 2022 21:09:22 +0200 Subject: [PATCH 1/5] gitlab-ci: Cope with OBS slowdown OBS 2.10 has just been deployed and we started hitting timeouts. Be more patient, maybe the new OBS version some time to get accustomed. Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com> --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 572ab66..146320e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -194,7 +194,7 @@ packaging-data-fetch-binaries-published: packaging-data-fetch-obs: stage: fetch - timeout: 1h 30m + timeout: 3h tags: - lightweight before_script: -- GitLab From 85802ab7ac8a8b50a93348c5ef3b3966a713586d Mon Sep 17 00:00:00 2001 From: Emanuele Aina <emanuele.aina@collabora.com> Date: Mon, 16 May 2022 17:02:43 +0200 Subject: [PATCH 2/5] HACK: Skip OBS scanning by default The OBS 2.10 update made things sensibly slower, causing timeouts in the packaging-data-fetch-obs job. Disable it for now. Set `SKIP_OBS` to `no` to run the job again. See https://phabricator.apertis.org/T8880 Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com> --- .gitlab-ci.yml | 11 +++++++++++ bin/packaging-check-invariants | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 146320e..83c0a3b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,13 @@ variables: For instance use `*` to process all updates, `dash` to only process `pkg/dash`. Leave it empty to not trigger any update. value: "" + SKIP_OBS: + description: | + The OBS 2.10 update made things sensibly slower, causing timeouts in the + packaging-data-fetch-obs job. Disable it for now. + See https://phabricator.apertis.org/T8880 + value: "yes" + stages: - lint @@ -214,6 +221,8 @@ packaging-data-fetch-obs: paths: - packaging-data-obs.yaml rules: + - if: $SKIP_OBS == "yes" + when: never - if: $TRIGGER_FROM_JOB when: never - if: $CI_PIPELINE_SOURCE != "merge_request_event" @@ -263,6 +272,8 @@ packaging-check-invariants: python3-gitlab python3-yaml script: + - | + test "$SKIP_OBS" = yes && echo '{}' > packaging-data-obs.yaml - ./bin/yaml-merge --input packaging-data-downstream.yaml --input packaging-data-sources-upstream.yaml diff --git a/bin/packaging-check-invariants b/bin/packaging-check-invariants index 2ff49e0..f855959 100755 --- a/bin/packaging-check-invariants +++ b/bin/packaging-check-invariants @@ -2,6 +2,7 @@ import argparse import logging +import os import debian.debian_support import yaml @@ -558,6 +559,10 @@ class Error(Exception): pass +def hack_skip_obs(): + return os.environ.get("SKIP_OBS") == "yes" + + def is_stable_channel(channel): if channel.endswith("pre"): return False @@ -906,7 +911,7 @@ class InvariantChecker: logging.debug( f"Checking if {package.name} branch {branch}/{source.component} is in {obsproject}" ) - if obsproject not in package.get("obs", {}): + if obsproject not in package.get("obs", {}) and not hack_skip_obs(): self.error( package.name, Report.OBS_PACKAGE_MISSING_BUT_ON_APT, -- GitLab From 7b3f54e3a3b772f743df18afec3385135ebe7d29 Mon Sep 17 00:00:00 2001 From: Emanuele Aina <emanuele.aina@collabora.com> Date: Thu, 19 May 2022 12:49:10 +0200 Subject: [PATCH 3/5] gitlab-ci: Give more time to storage_stats as well For some reason even `storage_stats` seems to be running slower, hitting the 1h30m timeout. Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com> --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83c0a3b..0bc7e40 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -258,7 +258,7 @@ storage-usage: artifacts: paths: - storage.yaml - timeout: 1h 30m + timeout: 3h rules: - if: $TRIGGER_FROM_JOB when: never -- GitLab From 9b9ef876af696fcf11db24d1173c90bdc9f4838a Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez <ryan.gonzalez@collabora.com> Date: Wed, 18 May 2022 15:17:14 -0500 Subject: [PATCH 4/5] Fix incorrect handling of HTTP error statuses All non-2xx statuses were actually being ignored, because status codes aren't propagated as errors by default. https://phabricator.apertis.org/T8593 Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com> --- storage_stats/src/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage_stats/src/client.rs b/storage_stats/src/client.rs index e54adb2..0809a53 100644 --- a/storage_stats/src/client.rs +++ b/storage_stats/src/client.rs @@ -54,7 +54,7 @@ impl Client { // NOTE: the URL should be printed since get() is instrumented. debug!("GET"); - Ok(self.client.get(url.clone()).send().await?.bytes().await?) + Ok(self.client.get(url.clone()).send().await?.error_for_status()?.bytes().await?) } #[instrument(skip(self))] -- GitLab From 1f917c26cbe9a25464f1c0e0d16d5ae9fbd70e1b Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez <ryan.gonzalez@collabora.com> Date: Wed, 18 May 2022 15:19:03 -0500 Subject: [PATCH 5/5] Ignore missing files in snapshots If a snapshot has any missing files, it would make the entire dashboard collection fail, which isn't really the ideal behavior to have. https://phabricator.apertis.org/T8593 Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com> --- storage_stats/src/repository.rs | 37 +++++++++++++++++---------- storage_stats/src/stats.rs | 45 ++++++++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/storage_stats/src/repository.rs b/storage_stats/src/repository.rs index 0990e7c..cbd6a7d 100644 --- a/storage_stats/src/repository.rs +++ b/storage_stats/src/repository.rs @@ -88,22 +88,31 @@ async fn read_deb822_file< download: F, client: &'client Client, url: &'url str, -) -> Result<T> { - let bytes = download(client, url) - .await - .with_context(|| format!("Failed to download {}", url))?; - - let file = tokio::task::block_in_place(|| { - rfc822_like::from_bytes(&bytes[..]) - .with_context(|| format!("Failed to parse {}", url)) - })?; +) -> Result<Option<T>> { + match lift_404( + download(client, url) + .await + .with_context(|| format!("Failed to download {}", url)), + )? { + Some(bytes) => { + let file = tokio::task::block_in_place(|| { + rfc822_like::from_bytes(&bytes[..]) + .with_context(|| format!("Failed to parse {}", url)) + })?; + + debug!("Retrieved repo file"); + Ok(Some(file)) + } - debug!("Retrieved repo file"); - Ok(file) + None => Ok(None), + } } impl Repository { - pub async fn read_release(&self, client: &Client) -> Result<RepositoryRelease> { + pub async fn read_release( + &self, + client: &Client, + ) -> Result<Option<RepositoryRelease>> { read_deb822_file(Client::get, client, &format!("{}/Release", &self.url)).await } @@ -111,7 +120,7 @@ impl Repository { &self, client: &Client, component: &str, - ) -> Result<Vec<SourcePackage>> { + ) -> Result<Option<Vec<SourcePackage>>> { read_deb822_file( get_maybe_compressed_file, client, @@ -125,7 +134,7 @@ impl Repository { client: &Client, component: &str, arch: &str, - ) -> Result<Vec<BinaryPackage>> { + ) -> Result<Option<Vec<BinaryPackage>>> { read_deb822_file( get_maybe_compressed_file, client, diff --git a/storage_stats/src/stats.rs b/storage_stats/src/stats.rs index abc0521..3231a93 100644 --- a/storage_stats/src/stats.rs +++ b/storage_stats/src/stats.rs @@ -10,7 +10,7 @@ use anyhow::{Context, Result}; use futures::{future::try_join_all, stream, try_join, StreamExt, TryStreamExt}; use serde_derive::Serialize; use std::sync::Arc; -use tracing::{debug, info, instrument}; +use tracing::{debug, info, instrument, warn}; async fn scan_source_packages( client: Client, @@ -18,9 +18,23 @@ async fn scan_source_packages( component: String, agg: Arc<StorageUsageAggregator>, ) -> Result<()> { - for pkg in repo.read_sources(&client, &component).await? { - for file in pkg.files { - agg.add(&repo.id, format!("{}/{}", pkg.directory, file.filename), file.size); + match repo.read_sources(&client, &component).await? { + Some(pkgs) => { + for pkg in pkgs { + for file in pkg.files { + agg.add( + &repo.id, + format!("{}/{}", pkg.directory, file.filename), + file.size, + ); + } + } + } + None => { + warn!( + "Repository {}, component {} is missing its Sources file", + repo.id, component + ); } } @@ -34,8 +48,18 @@ async fn scan_binary_packages( arch: String, agg: Arc<StorageUsageAggregator>, ) -> Result<()> { - for pkg in repo.read_packages(&client, &component, &arch).await? { - agg.add(&repo.id, pkg.filename, pkg.size); + match repo.read_packages(&client, &component, &arch).await? { + Some(pkgs) => { + for pkg in pkgs { + agg.add(&repo.id, pkg.filename, pkg.size); + } + } + None => { + warn!( + "Repository {}, component {}, arch {} is missing its Packages file", + repo.id, component, arch + ); + } } Ok(()) @@ -50,7 +74,14 @@ async fn aggregate_basic_stats( ) -> Result<()> { debug!("Scanning repo"); - let release = repo.read_release(client).await?; + let release = match repo.read_release(client).await? { + Some(release) => release, + None => { + warn!("Repository {} is missing its Release file", repo.id); + return Ok(()); + } + }; + let metadata_size: usize = release.files.iter().map(|entry| entry.size).sum(); agg.register_key(repo.id.to_owned(), metadata_size); -- GitLab