Skip to content

Commit

Permalink
Allow overriding of install repos Issue#1474
Browse files Browse the repository at this point in the history
* Use agama.install_url=https://..,https://.. boot param
* multiple values can be separted by commas
  • Loading branch information
lkocman committed Aug 20, 2024
1 parent 5f2b96b commit f68f4f7
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 10 deletions.
23 changes: 23 additions & 0 deletions doc/boot_arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ See [URL handling in the
installer](https://github.com/yast/yast-installation/blob/master/doc/url.md) to find more details
about the supported URLs.

## Custom Installation URL Configuration

You can override the default `installation_url` set in the product files [here](https://github.com/openSUSE/agama/tree/master/products.d) by passing the `agama.install_url` parameter as a boot option in the bootloader.
This is particularly useful for any pre-production testing in openQA.

**Note:** Setting this variable will impact all products. You can specify multiple URLs by separating them with commas.

### Example Usage

To specify a custom installation URL, pass following as a parameter to kernel in the bootloader:

```
agama.install_url=https://myrepo,https://myrepo2
```

### Multiple URLs


### Example Usage

To specify a custom installation URL, use the following syntax:


## Changing configuration values

Instead of loading a full configuration file, you might be interested in adjusting just a few
Expand Down
48 changes: 38 additions & 10 deletions service/lib/agama/software/product_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,29 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require "agama/cmdline_args"
require "agama/software/product"
require "logger"

module Agama
module Software
# Builds products from the information of a config file.
class ProductBuilder
# @param config [Agama::Config]
def initialize(config)
def initialize(config, logger: Logger.new($stdout))
@config = config
@logger = logger
end

# Builds the products.
#
# @return [Array<Agama::Product>]
def build
cmdline_args = CmdlineArgs.read_from("/proc/cmdline")
@logger.info cmdline_args
config.products.map do |id, attrs|
data = product_data_from_config(id)
create_product(id, data, attrs)
create_product(id, data, attrs, cmdline_args)
end
end

Expand All @@ -45,23 +50,46 @@ def build
# @return [Agama::Config]
attr_reader :config

def create_product(id, data, attrs)
def create_product(id, data, attrs, cmdline_args)
product = initialize_product(id, data, attrs)
set_repositories(product, data, cmdline_args)
set_software(product, data)
set_translations(product, attrs)
product
end

def initialize_product(id, data, attrs)
Agama::Software::Product.new(id).tap do |product|
product.display_name = attrs["name"]
product.description = attrs["description"]
product.name = data[:name]
product.version = data[:version]
end
end

def set_repositories(product, data, cmdline_args)
install_url = cmdline_args.data["install_url"]
if install_url
@logger.info "agama.install_url is set to #{install_url}"
product.repositories = install_url.split(",")
else
product.repositories = data[:repositories]
product.labels = data[:labels]
product.mandatory_packages = data[:mandatory_packages]
product.optional_packages = data[:optional_packages]
product.mandatory_patterns = data[:mandatory_patterns]
product.optional_patterns = data[:optional_patterns]
product.user_patterns = data[:user_patterns]
product.translations = attrs["translations"] || {}
end
end

def set_software(product, data)
product.labels = data[:labels]
product.mandatory_packages = data[:mandatory_packages]
product.optional_packages = data[:optional_packages]
product.mandatory_patterns = data[:mandatory_patterns]
product.optional_patterns = data[:optional_patterns]
product.user_patterns = data[:user_patterns]
end

def set_translations(product, attrs)
product.translations = attrs["translations"] || {}
end

# Data from config, filtering by arch.
#
# @param id [String]
Expand Down
6 changes: 6 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Aug 19 15:13:46 UTC 2024 - Lubos Kocman <[email protected]>

- Allow overriding of install repos which is needed by openQA
- Override urls by using agama.install_url=https://.. boot param

-------------------------------------------------------------------
Mon Aug 12 11:44:15 UTC 2024 - Josef Reidinger <[email protected]>

Expand Down

0 comments on commit f68f4f7

Please sign in to comment.