Skip to content

Commit

Permalink
Merge branch 'master' into debian-xz
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaltom authored Aug 23, 2024
2 parents 8275973 + 9ae31f4 commit ac37bf4
Show file tree
Hide file tree
Showing 32 changed files with 2,156 additions and 623 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Prepare database
run: |
bundle exec rails db:migrate
bundle exec rails db:drop db:create db:migrate
- name: Run core tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ GEM
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.4)
rexml (3.3.6)
strscan
ronn (0.7.3)
hpricot (>= 0.8.2)
Expand Down
21 changes: 10 additions & 11 deletions PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ Note: Look below for direction on publishing to registry.
```
2. On github, submit a release for the tag. See https://help.github.com/en/articles/creating-releases for assistance.
#### Helm chart update process
RMT helm chart is found [here](https://github.com/SUSE/helm-charts.git).
Edit `rmt-helm/Chart.yaml` to update the chart version (`version`) and rmt-version (`appVersion`). The `BuildTag` version needs to be updated. Look at this example [pull-request](https://github.com/SUSE/helm-charts/pull/5) bumping the version.
[Bruno Leon](mailto:[email protected]) is the maintainer and point of contact for rmt-helm.
#### Submit Requests to openSUSE Factory and SLES
To get a maintenance request accepted, each changelog entry needs to have at
Expand Down Expand Up @@ -106,8 +98,15 @@ You can check the status of your requests [here](https://build.opensuse.org/pack
After your requests have been accepted, they still have to pass maintenance testing before they are released to customers. You can check their progress at [maintenance.suse.de](https://maintenance.suse.de/search/?q=rmt-server). If you still need help, the maintenance team can be reached at [[email protected]]([email protected]) or #maintenance on irc.suse.de.


## Packaging and publishing to SUSE registry
## Container image and publishing to SUSE registry

SUSE registry houses the rmt-server docker image. The image is built on OBS/IBS, project for SLES 15sp4 based distributions can be found [here](https://build.opensuse.org/package/show/devel:BCI:SLE-15-SP4/rmt-server-image).
SUSE registry houses the rmt-server docker image. The image is built automatically on OBS/IBS, and can be found [here](https://build.opensuse.org/package/show/devel:BCI:SLE-15-SP6/rmt-server-image). It is getting published here: `registry.suse.com/suse/rmt-server`.


#### Helm chart update process

RMT helm chart is defined [here](https://github.com/SUSE/helm-charts.git) and published at `registry.suse.com/suse/rmt-helm`.

Edit `rmt-helm/Chart.yaml` to update the chart version (`version`) and rmt-version (`appVersion`). The `BuildTag` version needs to be updated. Look at this example [pull-request](https://github.com/SUSE/helm-charts/pull/5) bumping the version.

At the moment of writing, the publishing process has to be done manually. This can be achieved by reaching out to the Auto-Build team (only available internally).
Please reach out to the BCI team if you have build related questions.
6 changes: 4 additions & 2 deletions app/controllers/api/connect/v3/systems/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ def remove_previous_product_activations(product_ids)
end

def load_subscription
# Find subscription by regcode if provided, otherwise use the first subscription (bsc#1220109)
if params[:token].present? && !@system.byos?
# Find subscription by regcode if provided and not a public cloud system,
# otherwise check if there's already an activation with a matching
# subscription (for migrations, bsc#1220109)
if params[:token].present? && @system.not_applicable?
@subscription = Subscription.find_by(regcode: params[:token])
unless @subscription
raise ActionController::TranslatedError.new(N_('No subscription with this Registration Code found'))
Expand Down
13 changes: 13 additions & 0 deletions db/migrate/20240821114908_change_local_path_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class ChangeLocalPathType < ActiveRecord::Migration[6.1]
def up
safety_assured do
change_column :repositories, :local_path, :text
change_column :downloaded_files, :local_path, :text
end
end

def down
change_column :repositories, :local_path, :string
change_column :downloaded_files, :local_path, :string
end
end
6 changes: 3 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_07_29_103525) do
ActiveRecord::Schema.define(version: 2024_08_21_114908) do

create_table "activations", charset: "utf8", force: :cascade do |t|
t.bigint "service_id", null: false
Expand All @@ -34,7 +34,7 @@
create_table "downloaded_files", charset: "utf8", force: :cascade do |t|
t.string "checksum_type"
t.string "checksum"
t.string "local_path"
t.text "local_path"
t.bigint "file_size", unsigned: true
t.index ["checksum_type", "checksum"], name: "index_downloaded_files_on_checksum_type_and_checksum"
t.index ["local_path"], name: "index_downloaded_files_on_local_path", unique: true
Expand Down Expand Up @@ -104,7 +104,7 @@
t.string "auth_token"
t.boolean "installer_updates", default: false, null: false
t.boolean "mirroring_enabled", default: false, null: false
t.string "local_path", null: false
t.text "local_path", null: false
t.datetime "last_mirrored_at"
t.string "friendly_id"
t.index ["external_url"], name: "index_repositories_on_external_url", unique: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def verify_product_activation

if product.base?
verify_base_product_activation(product)
else
verify_extension_activation(product)
elsif !product.free? && params[:token].blank?
verify_payg_extension_activation!(product)
end
rescue InstanceVerification::Exception => e
unless @system.byos?
Expand All @@ -79,19 +79,18 @@ def verify_product_activation
raise ActionController::TranslatedError.new('Unexpected instance verification error has occurred')
end

def verify_extension_activation(product)
def verify_payg_extension_activation!(product)
return if product.free?

base_product = @system.products.find_by(product_type: :base)

subscription = Subscription.joins(:product_classes).find_by(
subscription_product_classes: {
product_class: base_product.product_class
}
)

# This error would occur only if there's a problem with subscription setup on SCC side
raise "Can't find a subscription for base product #{base_product.product_string}" unless subscription
raise InstanceVerification::Exception, "Can't find a subscription for base product #{base_product.product_string}" unless subscription

allowed_product_classes = subscription.product_classes.pluck(:product_class)

Expand All @@ -100,6 +99,8 @@ def verify_extension_activation(product)
'The product is not available for this instance'
)
end
logger.info "Product #{@product.product_string} available for this instance"
InstanceVerification.update_cache(request.remote_ip, @system.login, product.id)
end

def verify_base_product_activation(product)
Expand Down
Loading

0 comments on commit ac37bf4

Please sign in to comment.