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

Support Fedora Image Mode #3229

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Support Fedora Image Mode #3229

wants to merge 5 commits into from

Conversation

thrix
Copy link
Collaborator

@thrix thrix commented Sep 19, 2024

To support Fedora Image mode the following changes were required:

  • Fix rsync installation. The tool is not included in the distribution and
    the installation method was completely broken, i.e. rpm-ostree has
    no --install-root option. We did not hit it as there is no good
    testing environment available that would cover this.

  • Introduce TMT_SCRIPTS_DEST_DIR environment variable set by default
    to /var/tmp/tmt/bin which hosts the tmt scripts. The original path
    is not writable on these systems. The PATH is set system wide via a
    new /etc/profile.d/tmt.sh script.

Signed-off-by: Miroslav Vadkerti [email protected]

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@thrix thrix added this to the 1.37 milestone Sep 19, 2024
@thrix thrix self-assigned this Sep 19, 2024
thrix added a commit to testing-farm/gluetool-modules that referenced this pull request Sep 20, 2024
With tmt from this MR:

teemtee/tmt#3229

Signed-off-by: Miroslav Vadkerti <[email protected]>
@thrix thrix force-pushed the image-mode-fedora branch 4 times, most recently from 5617f1e to 71c72d1 Compare October 1, 2024 08:19
@thrix thrix requested a review from happz October 1, 2024 08:20
tmt/steps/execute/scripts/tmt.sh.j2 Fixed Show fixed Hide fixed
tmt/steps/execute/scripts/tmt.sh.j2 Fixed Show fixed Hide fixed
tmt/steps/execute/scripts/tmt.sh.j2 Fixed Show fixed Hide fixed
tmt/steps/execute/scripts/tmt.sh.j2 Fixed Show fixed Hide fixed
tmt/steps/execute/scripts/tmt.sh.j2 Fixed Show fixed Hide fixed
To support Fedora Image mode the following changes were required:

* Fix `rsync` installation. The tool is not included in the distribution and
  the installation method was completely broken, i.e. `rpm-ostree` has
  no `--install-root` option. We did not hit it as there is no good
  testing environment available that would cover this.

* Introduce `TMT_SCRIPTS_DEST_DIR` environment variable set by default
  to `/var/tmp/tmt/bin` which hosts the `tmt` scripts. The original path
  is not writable on these systems. The `PATH` is set system wide via a
  new `/etc/profile.d/tmt.sh` script.

Signed-off-by: Miroslav Vadkerti <[email protected]>
@thrix thrix marked this pull request as ready for review October 1, 2024 08:30
tmt/steps/execute/__init__.py Outdated Show resolved Hide resolved
tmt/steps/execute/__init__.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@martinhoyer martinhoyer left a comment

Choose a reason for hiding this comment

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

Do I understand it correctly, that the intention is to have default directory which is writable on all platforms, as opposed to having a default directory, which would be changed if 'default' is not writable?

.github/workflows/shellcheck.yml Outdated Show resolved Hide resolved
tmt/steps/execute/__init__.py Outdated Show resolved Hide resolved
@thrix thrix modified the milestones: 1.37, 1.38 Oct 1, 2024
@thrix thrix added the priority | must high priority, must be included in the next release label Oct 1, 2024
@happz happz added the step | execute Stuff related to the execute step label Oct 1, 2024
To support Fedora Image mode the following changes were required:

* Fix `rsync` installation. The tool is not included in the distribution and
  the installation method was completely broken, i.e. `rpm-ostree` has
  no `--install-root` option. We did not hit it as there is no good
  testing environment available that would cover this.

* Introduce `TMT_SCRIPTS_DEST_DIR` environment variable set by default
  to `/var/tmp/tmt/bin` which hosts the `tmt` scripts. The original path
  is not writable on these systems. The `PATH` is set system wide via a
  new `/etc/profile.d/tmt.sh` script.

Signed-off-by: Miroslav Vadkerti <[email protected]>
tmt/steps/execute/__init__.py Outdated Show resolved Hide resolved
tmt/steps/execute/__init__.py Outdated Show resolved Hide resolved
tmt/steps/execute/__init__.py Outdated Show resolved Hide resolved
@thrix
Copy link
Collaborator Author

thrix commented Oct 2, 2024

@happz @psss added docs, all comments should be resolved

@thrix
Copy link
Collaborator Author

thrix commented Oct 2, 2024

Btw we agreed on getting this into Testing Farm sooner than 1.38, once we verify it does not break anything.

@thrix
Copy link
Collaborator Author

thrix commented Oct 2, 2024

Please vote for the new location in this discussion poll:

#3260

@kkaarreell
Copy link
Collaborator

What about SELinux? Given this dir hosts executables, it should be assigned with the respective selinux context.

@kkaarreell
Copy link
Collaborator

Do I understand it correctly, that the intention is to have default directory which is writable on all platforms, as opposed to having a default directory, which would be changed if 'default' is not writable?

I am also interested to know. It looks like that alternative location would require some system "bending" and I am not sure if doing this by default Is a good approach. I expect that most tested systems won't be bootc.

@thrix
Copy link
Collaborator Author

thrix commented Oct 3, 2024

What about SELinux? Given this dir hosts executables, it should be assigned with the respective selinux context.

Thanks, depending on the discussion we can adjust the SELinux context. I did not yet see a problem with this with the current path /var/tmp/tmt/bin but might be worth checking :)

@thrix
Copy link
Collaborator Author

thrix commented Oct 3, 2024

Do I understand it correctly, that the intention is to have default directory which is writable on all platforms, as opposed to having a default directory, which would be changed if 'default' is not writable?

I am also interested to know. It looks like that alternative location would require some system "bending" and I am not sure if doing this by default Is a good approach. I expect that most tested systems won't be bootc.

Bending is already in place and we talked about proper documentation. Feel free to read the MR docs being added.

options=["-p", "--chmod=755"],
superuser=guest.facts.is_superuser is not True)
with script as source:
for dest in [script.path, *script.aliases]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@thrix Not related to the problem this PR is addressing, but I thought it might be a good idea to bring it up since we're doing changes in this code:
I've noticed the copying of the scripts can take quite some time when copying to remote host and I suspect it could be vastly sped-up if we copy them in batch instead of one at a time.

If you say it's more suitable to handle in separate PR, I'll open an issue to not forget about it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@martinhoyer yes please, not definitely something for this patch :)

@@ -597,16 +680,18 @@ def prepare_tests(self, guest: Guest, logger: tmt.log.Logger) -> list[TestInvoca

def prepare_scripts(self, guest: "tmt.steps.provision.Guest") -> None:
""" Prepare additional scripts for testing """
# Create scripts directory
guest.execute(Command("mkdir", "-p", str(effective_scripts_dest_dir())))
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about using rsync with --mkpath ?
Actually, there is also --executability or --perms/--chmod to get rid of the other ssh command.
(again, can be a separate PR)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@martinhoyer rsync --mkpath was added in rsync 3.2.3 (6 Aug 2020). I wonder if it will work on all supported OSes

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I did check that before writing the comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That option has to exist for rsync on the guest as well, right? If so we definitely cannot use that as rhel-7 has just rsync-3.1.2

@thrix thrix added the ci | full test Pull request is ready for the full test execution label Oct 7, 2024
@thrix
Copy link
Collaborator Author

thrix commented Oct 7, 2024

/packit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution priority | must high priority, must be included in the next release step | execute Stuff related to the execute step
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants