Parcourir la source

feat: --repository accepts remote https:// URLs (downloads .usmr into the deploy context)

clanker il y a 1 semaine
Parent
commit
df74addb5c
1 fichiers modifiés avec 19 ajouts et 1 suppressions
  1. 19 1
      src/cli/Deploy.vala

+ 19 - 1
src/cli/Deploy.vala

@@ -555,7 +555,25 @@ private int deploy_provision_repositories(Vector<string> overrides, string conte
     var selected = new Vector<string>();
     if(overrides.length > 0) {
         foreach(var path in overrides) {
-            selected.add(Path.is_absolute(path) ? path : Path.build_filename(project_dir, path));
+            if(path.has_prefix("https://") || path.has_prefix("http://")) {
+                // Remote .usmr URL: download into the context's repos/ dir
+                // so the container resolves from the remote host directly
+                var destination = Path.build_filename(context_dir, "repos");
+                DirUtils.create_with_parents(destination, 0755);
+                var filename = path.substring(path.last_index_of("/") + 1);
+                var local = Path.build_filename(destination, filename);
+                try {
+                    printerr("Downloading repository descriptor from \"$path\"...\n");
+                    File.new_for_uri(path).copy(File.new_for_path(local), FileCopyFlags.OVERWRITE);
+                }
+                catch(Error e) {
+                    printerr(@"Failed to download repository from \"$path\": $(e.message)\n");
+                    return 237;
+                }
+            }
+            else {
+                selected.add(Path.is_absolute(path) ? path : Path.build_filename(project_dir, path));
+            }
         }
     }
     else {