[Launchpad-reviewers] [Merge] ~ines-almeida/launchpad:update-ftpmaster-generate-content-cron-start into launchpad:master

2024-03-14 Thread Ines Almeida
Ines Almeida has proposed merging 
~ines-almeida/launchpad:update-ftpmaster-generate-content-cron-start into 
launchpad:master.

Commit message:
charm: update ftpmaster-publisher genrate-content cron script to run earlier

This is relevant because currently this job runs during most Launchpad 
developer's working hours, and can block DB deployments.
Updating the start time of the script to start daily at 9pm instead of 4am


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/462433

This change was manually applied in production last week.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ines-almeida/launchpad:update-ftpmaster-generate-content-cron-start into 
launchpad:master.
diff --git a/charm/launchpad-ftpmaster-publisher/templates/crontab.j2 b/charm/launchpad-ftpmaster-publisher/templates/crontab.j2
index 87b4237..2cb676c 100644
--- a/charm/launchpad-ftpmaster-publisher/templates/crontab.j2
+++ b/charm/launchpad-ftpmaster-publisher/templates/crontab.j2
@@ -5,7 +5,7 @@ LPCONFIG=launchpad-ftpmaster-publisher
 
 {% if active -%}
 03-58/5 * * * * umask 022; {{ code_dir }}/cronscripts/publish-ftpmaster.py -v -d ubuntu >> {{ logs_dir }}/publish-ftpmaster.log 2>&1
-02 4 * * * {{ code_dir }}/cronscripts/generate-contents-files.py -v --distribution=ubuntu >> {{ logs_dir }}/generate-contents-files.log 2>&1
+02 21 * * * {{ code_dir }}/cronscripts/generate-contents-files.py -v --distribution=ubuntu >> {{ logs_dir }}/generate-contents-files.log 2>&1
 
 # cprov 2008-02-07: parallel run of death-row, at :10 it will run simultaneously with apt-ftparchive.
 10 */6 * * * {{ code_dir }}/scripts/process-death-row.py -d ubuntu -q --log-file=DEBUG:{{ logs_dir }}/process-death-row.log
___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


[Launchpad-reviewers] [Merge] ~ines-almeida/launchpad-layers:update-git-domain-config into launchpad-layers:main

2024-03-14 Thread Ines Almeida
Ines Almeida has proposed merging 
~ines-almeida/launchpad-layers:update-git-domain-config into 
launchpad-layers:main.

Commit message:
launchpad-base: update git domain configuration values to use default value if 
not set

`domain_git` is generally used to determine if an environment has git code 
hosting enabled or not.
But in cases where we don't want git hosting to be enabled, we still want the 
domain values to build and display URLs.
Adding a default placeholder value will enable us to display these placeholder 
URLs.



Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad-layers/+git/launchpad-layers/+merge/462428

This replaces: 
https://code.launchpad.net/~ines-almeida/launchpad-mojo-specs/+git/launchpad-mojo-specs/+merge/461985
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~ines-almeida/launchpad-layers:update-git-domain-config into 
launchpad-layers:main.
diff --git a/launchpad-base/templates/launchpad-base-lazr.conf b/launchpad-base/templates/launchpad-base-lazr.conf
index a73f081..be77d35 100644
--- a/launchpad-base/templates/launchpad-base-lazr.conf
+++ b/launchpad-base/templates/launchpad-base-lazr.conf
@@ -34,11 +34,14 @@ lp_url_hosts: {{ bzr_lp_url_hosts }}
 secure_codebrowse_root: https://{{ domain_bzr }}/
 supermirror_root: http://{{ domain_bzr }}/
 {%- endif %}
+{#- If `domain_git` is not set, use a placeholder default value. #}
+{#- These domain config values are used to build URLs within Launchpad. #}
+{% set domain_git_or_default = domain_git or "git.not.enabled" %}
+internal_git_api_endpoint: http://{{ domain_git_or_default }}:19417/
+git_anon_root: git://{{ domain_git_or_default }}/
+git_browse_root: https://{{ domain_git_or_default }}/
+git_ssh_root: git+ssh://{{ domain_git_or_default }}/
 {%- if domain_git %}
-internal_git_api_endpoint: http://{{ domain_git }}:19417/
-git_anon_root: git://{{ domain_git }}/
-git_browse_root: https://{{ domain_git }}/
-git_ssh_root: git+ssh://{{ domain_git }}/
 {{- opt("loose_objects_threshold", git_loose_objects_threshold) }}
 {{- opt("packs_threshold", git_packs_threshold) }}
 {%- endif %}
___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


[Launchpad-reviewers] [Merge] ~pelpsi/launchpad:snap-component-integration into launchpad:master

2024-03-14 Thread Simone Pelosi
Simone Pelosi has proposed merging ~pelpsi/launchpad:snap-component-integration 
into launchpad:master.

Commit message:
Add Snap Component support

Reference: LP142
Snap Components are processed and uploaded to the
snapcraft storage before pushing the Snap to the store.
Once every component is updated on the storage we can push
the Snap to the store.
push` function changed to support the new `components` parameter.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/launchpad/+git/launchpad/+merge/461063
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~pelpsi/launchpad:snap-component-integration into launchpad:master.
diff --git a/lib/lp/snappy/interfaces/snapbuildjob.py b/lib/lp/snappy/interfaces/snapbuildjob.py
index 12e4b8b..c1bfc24 100644
--- a/lib/lp/snappy/interfaces/snapbuildjob.py
+++ b/lib/lp/snappy/interfaces/snapbuildjob.py
@@ -13,7 +13,7 @@ __all__ = [
 from lazr.restful.fields import Reference
 from zope.interface import Attribute, Interface
 from zope.interface.interfaces import IObjectEvent
-from zope.schema import Int, TextLine
+from zope.schema import Dict, Int, TextLine
 
 from lp import _
 from lp.services.job.interfaces.job import IJob, IJobSource, IRunnableJob
@@ -68,6 +68,15 @@ class ISnapStoreUploadJob(IRunnableJob):
 readonly=True,
 )
 
+components_ids = Dict(
+title=_(
+"The IDs returned by the store when uploading snap components."
+"The key is the component name and the value is the related id."
+),
+required=False,
+readonly=True,
+)
+
 status_url = TextLine(
 title=_("The URL on the store to get the status of this build"),
 required=False,
diff --git a/lib/lp/snappy/model/snapbuildjob.py b/lib/lp/snappy/model/snapbuildjob.py
index 539fb1c..0384b0c 100644
--- a/lib/lp/snappy/model/snapbuildjob.py
+++ b/lib/lp/snappy/model/snapbuildjob.py
@@ -244,6 +244,18 @@ class SnapStoreUploadJob(SnapBuildJobDerived):
 self.snapbuild.store_upload_metadata["upload_id"] = upload_id
 
 @property
+def components_ids(self):
+"""See `ISnapStoreUploadJob`."""
+return self.store_metadata.get("components_ids")
+
+@components_ids.setter
+def components_ids(self, components_ids):
+"""See `ISnapStoreUploadJob`."""
+if self.snapbuild.store_upload_metadata is None:
+self.snapbuild.store_upload_metadata = {}
+self.snapbuild.store_upload_metadata["components_ids"] = components_ids
+
+@property
 def status_url(self):
 """See `ISnapStoreUploadJob`."""
 return self.store_metadata.get("status_url")
@@ -333,6 +345,15 @@ class SnapStoreUploadJob(SnapBuildJobDerived):
 pass
 return timedelta(minutes=1)
 
+def _extract_component_name(self, filename):
+# +_.comp
+start = filename.find("+")
+end = filename.rfind("_")
+if start == -1 or end == -1:
+return filename
+else:
+return filename[start + 1 : end]
+
 def run(self):
 """See `IRunnableJob`."""
 client = getUtility(ISnapStoreClient)
@@ -346,6 +367,17 @@ class SnapStoreUploadJob(SnapBuildJobDerived):
 ),
 None,
 )
+# Get components if any
+components = []
+components_ids = {}
+for _, lfa, _ in self.snapbuild.getFiles():
+if lfa.filename.endswith(".comp"):
+comp_name = self._extract_component_name(lfa.filename)
+components_ids[comp_name] = None
+components.append(lfa)
+
+if "components_ids" not in self.store_metadata:
+self.components_ids = components_ids
 if snap_lfa is None:
 # Nothing to do.
 self.error_message = None
@@ -354,12 +386,24 @@ class SnapStoreUploadJob(SnapBuildJobDerived):
 self.upload_id = client.uploadFile(snap_lfa)
 # We made progress, so reset attempt_count.
 self.attempt_count = 1
+# Process components
+for component in components:
+# if the id is None, we need to upload the component
+comp_name = self._extract_component_name(
+component.filename
+)
+if self.components_ids.get(comp_name) == None:
+self.components_ids[comp_name] = client.uploadFile(
+component
+)
+self.attempt_count = 1
 if "status_url" not in self.store_metadata:
 self.status_url = client.push(
-self.snapbuild,