Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tool to bootstrap openQA with only one command #1936

Merged
merged 1 commit into from
Dec 21, 2018

Conversation

asdil12
Copy link
Member

@asdil12 asdil12 commented Dec 19, 2018

Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing stuff. Now about adding a test and removing redundancy … :)

@@ -0,0 +1,61 @@
#!/bin/bash -x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make that #!/bin/sh -e? By default I would not make that "-x". We can leave that to the user, don't you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would give the user more info on what is happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sh -ex?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some tests and it seems that sh -e won't work because zypper --root installation will return 107 and also because of some potential error (that my script actually deals with) when starting the container.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to explicitly catch these, e.g. zypper … ||: to explicitly ignore the exit code then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I use -e in almost all my scripts and either do what oliver suggests or use the command as an if condition and actually handle the error. I would keep the -x, too.

script/openqa-bootstrap Outdated Show resolved Hide resolved
script/openqa-bootstrap Show resolved Hide resolved
fi
/usr/share/openqa/script/fetchneedles

if ping -c1 gitlab.suse.de. ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the script and it didn't work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix it or be more specific

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did nothing for the sle needles.
Also I don't see why I should need an additional script for a simple git clone …; chown ….

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not just that as it also does the normal "fetchneedles" call

@Martchus
Copy link
Contributor

I already said in the progress ticket that I like it. Did you test that the RPM actually builds?

@asdil12
Copy link
Member Author

asdil12 commented Dec 19, 2018

Did you test that the RPM actually builds?

No - I just tested the scripts on w3.

@codecov
Copy link

codecov bot commented Dec 19, 2018

Codecov Report

Merging #1936 into master will increase coverage by 0.46%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1936      +/-   ##
==========================================
+ Coverage   88.64%   89.11%   +0.46%     
==========================================
  Files         154      154              
  Lines       10360    10360              
==========================================
+ Hits         9184     9232      +48     
+ Misses       1176     1128      -48
Impacted Files Coverage Δ
lib/OpenQA/Worker/Engines/isotovideo.pm 94.97% <0%> (+0.55%) ⬆️
lib/OpenQA/WebAPI/Controller/LiveViewHandler.pm 96.46% <0%> (+1.32%) ⬆️
lib/OpenQA/Worker/Jobs.pm 83.93% <0%> (+1.47%) ⬆️
lib/OpenQA/Worker/Common.pm 83.97% <0%> (+2.78%) ⬆️
lib/OpenQA/Scheduler/Scheduler.pm 88.47% <0%> (+3.22%) ⬆️
lib/OpenQA/WebAPI/Controller/Developer.pm 100% <0%> (+3.44%) ⬆️
lib/OpenQA/Scheduler.pm 100% <0%> (+51.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 143b8a4...413cc11. Read the comment docs.

@asdil12
Copy link
Member Author

asdil12 commented Dec 20, 2018

Did you test that the RPM actually builds?

No - I just tested the scripts on w3.

I just tested building and installing an RPM and it worked fine.

@asdil12 asdil12 force-pushed the bootstrap branch 2 times, most recently from 5eb786e to 92a2fc7 Compare December 20, 2018 13:21
@Martchus
Copy link
Contributor

Martchus commented Dec 20, 2018

Maybe mention the script in the setup guide (you have already written https://w3.suse.de/~dheidler/openqa-container.html anyways)? And note that is has only been tested under Tumbleweed so far (if that's the case).

@asdil12 asdil12 force-pushed the bootstrap branch 4 times, most recently from 3d43332 to cba5f57 Compare December 20, 2018 16:11
@okurz
Copy link
Member

okurz commented Dec 21, 2018

@asdil12 I suggest to add either an automatic test or at least cover how to use/test it within documentation. Can you do that?

@asdil12
Copy link
Member Author

asdil12 commented Dec 21, 2018

@okurz I am planning to test this using openQA. I will add some documentation, though.

@asdil12 asdil12 force-pushed the bootstrap branch 3 times, most recently from c051d65 to 3eb5f26 Compare December 21, 2018 13:16
[source,sh]
-------------------------------------------------------------------------------
zypper in openQA-bootstrap
/usr/share/openqa/script/openqa-bootstrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you call this script as post-install action of command specific subpackages?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because this will just result in an rpm that takes forever to install without giving user feedback as rpm caches the script output until the script returns.
Also this script adds some repos and installs some packages. This wouldn't work due to the already locked rpm database.

zypper in openQA-bootstrap
/usr/share/openqa/script/openqa-bootstrap-container

systemd-run -tM openqa1 /bin/bash # start a shell in the container
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would I want /need that or is it just an additional example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need this eg. to run openqa-clone-job or openqa-client

%files bootstrap
%{_datadir}/openqa/script/openqa-bootstrap
%{_datadir}/openqa/script/openqa-bootstrap-container

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving these to /usr/bin on install as they already have an openqa-prefix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having them in this special dir makes it harder to accidentally execute this scripts.

# add extra repos for leap
source /etc/os-release
if $NAME == "openSUSE Leap" ; then
zypper -n addrepo obs://devel:openQA devel:openQA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest the addrepo parameters "-f -p 105"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-f is already the default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does -p 105 increase or decrease the priority?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It decreases priority which should be fine for "devel:openQA" itself, meaning: Only if we can not find the package in the main repos we install packages from here. However, thinking about it, depending on the needed features we might want to prefer "devel:openQA" so -p 95 would be more suitable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--> #1944

# setup database
systemctl enable --now postgresql
su postgres -c "createuser -D geekotest"
su postgres -c "createdb -O geekotest openqa"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rely on the openqa-setup-db systemd service here to prevent duplication?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because consider it as very ugly to use a systemd job for a task, that is only executed once.
This is the job of an sh script - not of a systemd.service file.
Also it will help users to understand, what this script does and therefore act as some kind of setup documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we should be consistent within this repo still. We can suggest to replace the existing openqa-setup-db service with a script instead as well

@okurz
Copy link
Member

okurz commented Dec 21, 2018

I added more comments but actually I am fine when anyone merges in the current state. We can always improve later still

@Martchus Martchus merged commit e86402b into os-autoinst:master Dec 21, 2018
coolo pushed a commit that referenced this pull request Dec 21, 2018
commit e86402b
Merge: 143b8a4 413cc11
Author:     Martchus <martchus@gmx.net>
AuthorDate: Fri Dec 21 15:05:56 2018 +0100
Commit:     GitHub <noreply@github.com>
CommitDate: Fri Dec 21 15:05:56 2018 +0100

    Merge pull request #1936 from asdil12/bootstrap

    Add tool to bootstrap openQA with only one command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants