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

Fixes #38109 - As a user, I want to install flatpaks on remote hosts via REX #11264

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

sjha4
Copy link
Member

@sjha4 sjha4 commented Dec 17, 2024

What are the changes introduced in this pull request?

Adds a new job template to setup flatpak remote, authentication and possibly install a flatpak repo on a host

Considerations taken when implementing this change?

We are not installing flatpak/podman. Admin/Client will need to do that on their own.
This will need to be run with sudo or as root on the host

What are the testing steps for this pull request?


To import the new job template:
In Rails console: ForemanInternal.all.first.delete
Then run: bundle exec rails db:seed


  1. Run the job template on a host.
  2. Monitor the execution output and make sure you are able to see the flatpak installation on the host.

@sjha4 sjha4 changed the title Fixes #38109 - As a user, I want to install flatpaks on remote hosts Fixes #38109 - As a user, I want to install flatpaks on remote hosts via REX Dec 17, 2024
Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Thanks @sjha4

I did not test this yet, but left some annoying nitpicks etc. below. Sorry!

@@ -0,0 +1,37 @@
<%#
kind: job_template
name: Install Flatpak and Firefox
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming you're changing this so it's an input and not hard-coded to Firefox, right? Why have a template specifically for Firefox?

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..This was bait for you to take a look and drive the PR from here on.. <3

Copy link
Member

Choose a reason for hiding this comment

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

You know how to trick me!

kind: job_template
name: Install Flatpak and Firefox
job_category: Katello
description_format: 'Install Flatpak and Firefox'
Copy link
Member

Choose a reason for hiding this comment

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

description_format can use wildcards and incorporate the input.

Comment on lines 17 to 18
- name: Password
description: Password for container registry login
Copy link
Member

Choose a reason for hiding this comment

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

This is where we're meant to use the personal auth token, right? Maybe the input or description should call that out.

flatpak remote-add --authenticator-name=org.flatpak.Authenticator.Oci <%= remote_name %> oci+<%= server_url %>/
podman login <%= server_url %> --username <%= username %> --password <%= password %>
cp /run/containers/0/auth.json /etc/flatpak/oci-auth.json
flatpak install firefox --assumeyes
Copy link
Member

Choose a reason for hiding this comment

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

The actual install could probably be split into a second template, and then called here with render_template. Then you could do flatpak installs separately assuming your installations and logins are already in place.

name: Install Flatpak and Firefox
job_category: Katello
description_format: 'Install Flatpak and Firefox'
feature: katello_host_flatpak_install
Copy link
Member

Choose a reason for hiding this comment

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

If you're introducing a new REX feature, you'll have to register the feature (in plugin.rb I think?)

You don't have to use a feature, if you don't need easy access from Hammer or web UI..

@sjha4
Copy link
Member Author

sjha4 commented Dec 20, 2024

@jeremylenz Thanks for the reviews..Working on them. This is kind of an early draft to make sure the flow makes sense..I'll split this into 2 templates : 1 for remote-add/authentication and another for the flatpak install.

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

On second thought, I think it actually is a good idea to introduce and register new REX Features. The reason is that it makes it much easier to invoke REX jobs from the web UI. (sorry, I don't think I remembered this fully before)

Per the job_invocations API docs, in order to invoke a new REX job via API you need to either send the feature name, or the job template ID. Job template ID will be different for every database, so if we ever want to invoke one of these templates via web UI, we would need to have a feature.

kind: job_template
name: Install Flatpak application on host
job_category: Katello
description_format: 'Install Flatpak application on host'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description_format: 'Install Flatpak application on host'
description_format: 'Install Flatpak application %{Application name} on host'

Would be nice to include the application name here, as this will probably be displayed in the UI as a toast.

kind: job_template
name: Setup Flatpak remote on host
job_category: Katello
description_format: 'Setup Flatpak remote on host'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description_format: 'Setup Flatpak remote on host'
description_format: 'Set up Flatpak remote on host'

@@ -0,0 +1,35 @@
<%#
kind: job_template
name: Setup Flatpak remote on host
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name: Setup Flatpak remote on host
name: Set up Flatpak remote on host

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

I didn't actually install podman or flatpak, but templates do render correctly and fail as expected. 👍 LGTM

Copy link

@vsedmik vsedmik left a comment

Choose a reason for hiding this comment

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

Looks good to me.
packit/PRT passed at SatelliteQE/robottelo#17207

@sjha4
Copy link
Member Author

sjha4 commented Jan 15, 2025

There is one pipeline failing. db:seed with ruby 2.7..Re-running suite to see if it's transient.. 😕

@sjha4 sjha4 merged commit ea0409b into Katello:master Jan 15, 2025
19 checks passed
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.

3 participants