action #11518

openQA Project - action #13868: isotovideo should support test postrun hook

[sle] Mark used SLE SCC Codes

Added by RBrownSUSE almost 4 years ago. Updated over 1 year ago.

Status:NewStart date:06/04/2016
Priority:NormalDue date:
Assignee:-% Done:

30%

Category:Enhancement to existing tests
Target version:QA - future
Difficulty:
Duration:

Description

From Artem,

Hi, everyone.

May we kindly ask to evaluate the possibility to de-register a system
when the test run on openQA for specific build is done.

That will allow us to keep organization with Alpha keys tidy.


Any ideas on how we can implement this? Having the worker do it seems hard work (it might not know enough about the system to do it) but having the VM do it might not be viable... can we do a post fail hook on all tests?

History

#1 Updated by okurz over 3 years ago

  • Project changed from openQA Project to openQA Tests

#2 Updated by mkravec over 3 years ago

  • Assignee set to mkravec

#3 Updated by mkravec over 3 years ago

We can not:
- post-fail hook: We unregister only if some test fail (and after every failed test). Non fatal tests would unregister, but job would continue running
- hook that would unregister after last test finishes (or fatal test fails): this would be ignored when restarting & canceling job from webui (when newer build is scheduled)
- hook that would trigger when we destroy VM (root console is available anymore)

As suggested, maybe worker can do it (hard work solution):
- save credentials during registration and unregister from worker when job is finished (calling http 'DELETE /connect/systems ... scc.suse.com')

Better suggestions?

#4 Updated by mkravec over 3 years ago

  • Parent task set to #13868

#5 Updated by mkravec over 3 years ago

System can be deregistered by calling scc url:
https://github.com/SUSE/connect/wiki/SCC-API-(Implemented)#deregister-system

Username & password are generated during registration and stored in:
/etc/zypp/credentials.d/

#6 Updated by RBrownSUSE over 3 years ago

mkravec wrote:

Username & password are generated during registration and stored in:

/etc/zypp/credentials.d/

Deleting that dirs contents is only necessary if we intend to reuse the image (like with upgrades, so we'll need to do it, but maybe not always)

#7 Updated by mkravec over 3 years ago

PR: https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/1923

Deleting dir contents is part of poo#10996 - required when publishing hdd

#8 Updated by dgutu over 3 years ago

mkravec wrote:

PR: https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/1923


Deleting dir contents is part of poo#10996 - required when publishing hdd

This solution, to delete data should be applied only for sles12sp0 because the version of SUSEConnect is not able to unregister the system. "SUSEConnect -d" works for sles12sp1.

#9 Updated by mkravec over 3 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 100

#10 Updated by okurz over 3 years ago

  • Category set to Enhancement to existing tests

#11 Updated by maritawerner over 3 years ago

Any update here?

#12 Updated by mkravec over 3 years ago

First solution was dismissed as we found out that unregistering all tests after execution might break maintenance (where they expect registered image).
I am working on proposed solution where we upload information required for unregistration into assets and unregister from background job after few days.
Current problem is that assets are not uploaded on obsoleted/canceled tests, which requires backend changes.

Issue was on hold for a moment as I was working on other things, I will continue this week.

#13 Updated by mkravec about 3 years ago

  • Assignee deleted (mkravec)
  • % Done changed from 100 to 30

I implemented part that uploads SCC credentials as job asset or variable. What needs to be done is part that uses that information and deregister system when all related jobs are finished.

Proposed solution from backend developers was to implement a openQA plugin for this task.
I have little backend knowledge, so will free this issue for the moment (so anybody interested can look at it).
If nobody takes it I will continue after I finish tasks that I can solve faster.

#14 Updated by RBrownSUSE almost 3 years ago

  • Project changed from openQA Tests to openQA Project
  • Subject changed from SLE SCC Deregister on Test End to [tools]SLE SCC Deregister on Test End
  • Category deleted (Enhancement to existing tests)

Now a backend task, tagging appropriately

#15 Updated by okurz@suse.de almost 3 years ago

Does not make sense to me. SCC can not be related to Backend. "Everything AdamWill from Fedora can solve should be in openQA project, everything else in tests repo" or suseqa

#16 Updated by RBrownSUSE almost 3 years ago

it's going to require modifications to os-autoinst and probably few or not os-autoinst-distri-opensuse

After all, the tests will not know when they're finished with the image, only os-autoinst or openQA can know that.

Therefore, it's a backend task

Sure, it's not a backend task that is relevant to Adam, which is why it has a nice new shiney [tools] tag on it to show that it's relevant to the SLE QA Tools team

But I think it should still be in the appropriate tracker - after all, Red Hat have their own registration system, their openQA might not be plugged into it, but maybe our solution for SCC is useful as a reference for that. Or maybe we need a common 'registration library' to abstract that away in the backend regardless of which registration system is in use.

Still, don't see how it's a openQA test ticket.

#17 Updated by RBrownSUSE almost 3 years ago

it's going to require modifications to os-autoinst and probably few or not os-autoinst-distri-opensuse

After all, the tests will not know when they're finished with the image, only os-autoinst or openQA can know that.

Therefore, it's a backend task

Sure, it's not a backend task that is relevant to Adam, which is why it has a nice new shiney [tools] tag on it to show that it's relevant to the SLE QA Tools team

But I think it should still be in the appropriate tracker - after all, Red Hat have their own registration system, their openQA might not be plugged into it, but maybe our solution for SCC is useful as a reference for that. Or maybe we need a common 'registration library' to abstract that away in the backend regardless of which registration system is in use.

Still, don't see how it's a openQA test ticket.

#18 Updated by okurz almost 3 years ago

  • Category set to Feature requests

#19 Updated by coolo almost 3 years ago

Assets just don't cut it - as mkravec found out.

And I don't think we should extend the backend for this - it's just a too special problem IMO.

How about a minimal web app our tests post the used codes to - implementing this app is a finger exercise for a trainee/intern. And doing a POST to a given URL from the test is easy to add too (in dubio use curl within the SUT, but we already use LWP::Simple in lib/x11regressiontest.pm

That app then stores the keys and will periodically talk to SCC to deregister.

#20 Updated by coolo over 2 years ago

  • Project changed from openQA Project to openQA Tests
  • Subject changed from [tools]SLE SCC Deregister on Test End to Mark used SLE SCC Codes
  • Category deleted (Feature requests)
  • Status changed from In Progress to New

As stated before, I disagree with Richard and this should be handled outside of openQA from within the tests.

#21 Updated by okurz about 2 years ago

  • Category set to Enhancement to existing tests
  • Priority changed from High to Normal
  • Target version set to future

#22 Updated by okurz almost 2 years ago

  • Subject changed from Mark used SLE SCC Codes to [sle] Mark used SLE SCC Codes

Well, I would regard it as a task for [tools] as it is not really tailored for any of the other groups but coolo just removed the tag so …

#23 Updated by okurz almost 2 years ago

Is this request still useful when it only concerns openQA tests? For example I do not care to deregister my system in manual tests.

#24 Updated by okurz over 1 year ago

  • Target version changed from future to future

#25 Updated by skotov over 1 year ago

In the SCC Alpha organization we currently see a huge amount of
registered systems:
https://scc.suse.com/subscriptions?current_organization=309910

This makes one of our API endpoints very slow.

To resolve the current situation soonish we plan to deregister systems which has no activity since 2 weeks (timeframe not yet agreed / negotiable) from time to time.

However it would be really nice if openQA tests would deregister systems after (at least) successful tests. Other things (systems that left after unsuccessful tests) could be cleaned up on our side.

In general the database records like system registrations done by openQA or manual QA sessions should be cleaned up right after the test.

#26 Updated by szarate over 1 year ago

I think we don't rely too much on having systems already registered in SCC, @okurz if you don't have any arguments I would agree for SCC to delete keys with no activity in the timeframe that he's proposing, while the idea proposed by coolo about a small web app could also be a potential gain but would need other efforts to be taken :).

#27 Updated by okurz over 1 year ago

I had discussed this with @skotov already over chat:

In general, I guess with low risk we can try as long as we inform all reviewers of openQA test reviewers, e.g. with a message to openqa@suse.de and probably maintenance@suse.de . If there are any problems we will see in tests and handle this accordingly. Right now I can't think of any like qcow images from virtual machines that are registered and we rely on the registration for longer than one test run which is less than a day in each case I guess. However, in case of manual tests I can think of we register a system and leave it around for e.g. 2 months and then it would be a minor annoyance if the registration is lost again. Can we apply the deletion to special codes for openQA only and not all codes from the alpha org? I suggest the following: Cleanup existing alpha organisations, create new codes which are easy to remember like the existing ones in the openQA orga for manual testing which are valid way longer, e.g. 1 year, and cleanup the ones in openQA orga after two weeks because they should be only used for automated tests. If anyone uses these openQA codes for manual tests then it's their own fault if it's invalidated after two weeks :) I would solve it by convention, not by an additional feature in SCC

#28 Updated by digitaltomm over 1 year ago

okurz wrote:

I had discussed this with @skotov already over chat:

In general, I guess with low risk we can try as long as we inform all reviewers of openQA test reviewers, e.g. with a message to openqa@suse.de and probably maintenance@suse.de .

@okurz: could you switch the openqa tests to the openqa organization that I created for you? (SCC_ORG_ECABHE)
Then it would be clearly seperated which subscriptions are used for openqa automated tests, and the cleanup can run just there not to kill systems that might still be used manually.

#29 Updated by okurz over 1 year ago

digitaltomm wrote:

@okurz: could you switch the openqa tests to the openqa organization that I created for you? (SCC_ORG_ECABHE)

Yes, I would like us to do that but currently the organisation is quite limited in its applicability as we only cover a small subset of products in this orga. Could you add subscriptions for all relevant products as provided already in SCC_ORG_DAJJBA. And for the sake of consistency it would be great to have pronouncable regcodes for all products (but not a necessity).

#30 Updated by skotov over 1 year ago

@okurz: please see the example cleanup script here
https://github.com/SUSE/connect/pull/380/files

Also available in: Atom PDF