Skip to content

on-prem: cloud provider config modal (COMPOSER-2488) #3103

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

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

Conversation

kingsleyzissou
Copy link
Collaborator

@kingsleyzissou kingsleyzissou commented Apr 14, 2025

Add a modal/page to configure the osbuild-worker with the required configs for the various cloud providers

JIRA: COMPOSER-2488

@kingsleyzissou kingsleyzissou force-pushed the worker-modal branch 11 times, most recently from 06d6e30 to 8affe64 Compare April 16, 2025 10:13
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 7.52351% with 295 lines in your changes missing coverage. Please review.

Project coverage is 83.67%. Comparing base (a1700a3) to head (4e3565a).

Files with missing lines Patch % Lines
src/Components/CloudProviderConfig/AWSConfig.tsx 0.00% 166 Missing and 1 partial ⚠️
...onents/CloudProviderConfig/CloudProviderConfig.tsx 0.00% 67 Missing and 1 partial ⚠️
...omponents/CloudProviderConfig/validators/index.tsx 0.00% 27 Missing and 1 partial ⚠️
src/Components/ImagesTable/Status.tsx 67.85% 9 Missing ⚠️
...Components/sharedComponents/ImageBuilderHeader.tsx 25.00% 9 Missing ⚠️
src/Router.tsx 0.00% 9 Missing ⚠️
src/test/mocks/cockpit/cockpitFile.ts 16.66% 5 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3103      +/-   ##
==========================================
- Coverage   84.69%   83.67%   -1.03%     
==========================================
  Files         187      190       +3     
  Lines       23417    23712     +295     
  Branches     2416     2420       +4     
==========================================
+ Hits        19833    19840       +7     
- Misses       3567     3852     +285     
- Partials       17       20       +3     
Files with missing lines Coverage Δ
...Components/CreateImageWizard/CreateImageWizard.tsx 97.21% <100.00%> (ø)
src/test/mocks/cockpit/cockpitFile.ts 19.60% <16.66%> (-2.14%) ⬇️
src/Components/ImagesTable/Status.tsx 83.47% <67.85%> (-0.30%) ⬇️
...Components/sharedComponents/ImageBuilderHeader.tsx 90.76% <25.00%> (-6.69%) ⬇️
src/Router.tsx 0.00% <0.00%> (ø)
...omponents/CloudProviderConfig/validators/index.tsx 0.00% <0.00%> (ø)
...onents/CloudProviderConfig/CloudProviderConfig.tsx 0.00% <0.00%> (ø)
src/Components/CloudProviderConfig/AWSConfig.tsx 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kingsleyzissou kingsleyzissou force-pushed the worker-modal branch 2 times, most recently from b540c5b to 11f0e9f Compare April 16, 2025 11:29
@kingsleyzissou kingsleyzissou force-pushed the worker-modal branch 2 times, most recently from fae04a1 to 33544e8 Compare April 29, 2025 16:45
@kingsleyzissou
Copy link
Collaborator Author

kingsleyzissou commented Apr 29, 2025

Last step remaining is to restart the worker and then this is ready.

@kingsleyzissou kingsleyzissou force-pushed the worker-modal branch 4 times, most recently from ece3737 to c1de9c7 Compare April 30, 2025 11:03
export type AWSWorkerConfig =
| {
bucket?: string | undefined;
region?: string | undefined;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The region isn't actually used at all by the osbuild-worker, but it makes sense to save this info here for the on-prem version

Error
</Title>
<EmptyStateBody>
There was an error reading the `/etc/osbuild-worker/osbuild-worker.toml`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe the copy here could be improved, any suggestions?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's sort out copy later.

@kingsleyzissou kingsleyzissou changed the title [wip] on-prem: cloud provider config modal on-prem: cloud provider config modal Apr 30, 2025
@kingsleyzissou kingsleyzissou marked this pull request as ready for review April 30, 2025 11:43
@kingsleyzissou kingsleyzissou changed the title on-prem: cloud provider config modal on-prem: cloud provider config modal (COMPOSER-2488) Apr 30, 2025
@kingsleyzissou
Copy link
Collaborator Author

I added a note to the the guides about configuring the worker globally for AWS uploads, since this PR essentially follows that pattern.

osbuild/osbuild.github.io#159

@kingsleyzissou kingsleyzissou force-pushed the worker-modal branch 2 times, most recently from 422fca4 to 5dadefc Compare May 7, 2025 12:48
Comment on lines +652 to +670
await cockpit.spawn(['systemctl', 'stop', 'osbuild-*'], {
superuser: 'require',
});

await cockpit.spawn(
[
'systemctl',
'start',
'osbuild-composer.socket',
'osbuild-composer',
],
{
superuser: 'require',
}
);
Copy link

Choose a reason for hiding this comment

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

The code stops all osbuild services with osbuild-* but only explicitly starts osbuild-composer.socket and osbuild-composer. Since this PR is configuring the osbuild-worker, it should also explicitly start the osbuild-worker service to ensure it picks up the new configuration. Consider adding it to the services being started.

Suggested change
await cockpit.spawn(['systemctl', 'stop', 'osbuild-*'], {
superuser: 'require',
});
await cockpit.spawn(
[
'systemctl',
'start',
'osbuild-composer.socket',
'osbuild-composer',
],
{
superuser: 'require',
}
);
await cockpit.spawn(['systemctl', 'stop', 'osbuild-*'], {
superuser: 'require',
});
await cockpit.spawn(
[
'systemctl',
'start',
'osbuild-composer.socket',
'osbuild-composer',
'osbuild-worker',
],
{
superuser: 'require',
}
);

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm on the fence about this. We do sort of need to restart the osbuild-local-worker.socket but this is taken care of by restarting the service and the osbuild-composer.socket. @croissanne do you have any opinions on this?

@kingsleyzissou kingsleyzissou force-pushed the worker-modal branch 2 times, most recently from 48da3b7 to 4e3565a Compare May 8, 2025 10:59
Analytics was enabled for on-prem which broke the images table. This
commit disables the analytics for the on-prem frontend.
A select box with dropdown options makes more sense for the AWS region
from a UX point of view.
This simplifies the validation and will make it easier to validate the
whole form later on.
Setup the footer for the AWS config step.
Create a few types to help stick to conventions and tidy up the code.
Add a query to load the `/etc/osbuild-worker/osbuild-worker.toml` config
and use this to set the state of the `cloudConfig` store slice.
Add an error component to improve the UI when there is an issue reading
the `osbuild-worker.toml` file.
This is still a wip since the form fields aren't yet disabled when the
config toggle is set to off.
Create the `osbuild-worker.toml` file if it doesn't exist already.
Add the `modify` file function which performs atomic modifications to a
file.
Add an endpoint to update the worker config.
Save the AWS config modifications to the `osbuild-worker.toml` file.
Restart osbuild-composer and the worker after updating the config, this
is a necessary step for osbuild-composer to register the changes.
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.

2 participants