Skip to content

Conversation

@ekohl
Copy link
Member

@ekohl ekohl commented Dec 5, 2025

What changes are you introducing?

Prior to this we created a CSS file for each build flavor, but with the same inputs. This duplication isn't needed so aligning on a single style.css leads to a quicker build and fewer files.

Why are you introducing these changes? (Explanation, links to references, issues, etc.)

In #4506 we're introducing additional guides which makes the existing problem even bigger.

Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)

Currently untested so I've made this a draft.

Contributor checklists

  • I am okay with my commits getting squashed when you merge this PR.
  • I am familiar with the contributing guidelines.

Please cherry-pick my commits into:

  • Foreman 3.17/Katello 4.19
  • Foreman 3.16/Katello 4.18 (Satellite 6.18)
  • Foreman 3.15/Katello 4.17
  • Foreman 3.14/Katello 4.16 (Satellite 6.17; orcharhino 7.4)
  • Foreman 3.13/Katello 4.15 (EL9 only)
  • Foreman 3.12/Katello 4.14 (Satellite 6.16; orcharhino 7.2 on EL9 only; orcharhino 7.3)
  • Foreman 3.11/Katello 4.13 (orcharhino 6.11 on EL8 only; orcharhino 7.0 on EL8+EL9; orcharhino 7.1 with Leapp)
  • Foreman 3.10/Katello 4.12
  • Foreman 3.9/Katello 4.11 (Satellite 6.15; orcharhino 6.8/6.9/6.10)
  • We do not accept PRs for Foreman older than 3.9.

Summary by Sourcery

Enhancements:

  • Standardize the SASS build target to output a common style.css file for all build flavors and update HTML generation to reference it.

Prior to this we created a CSS file for each build flavor, but with the
same inputs. This duplication isn't needed so aligning on a single
style.css leads to a quicker build and fewer files.
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 5, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Consolidates CSS generation for all build flavors to a single shared style.css and updates the HTML build target to depend on and reference that common stylesheet instead of flavor-specific CSS files.

Sequence diagram for HTML build with common stylesheet

sequenceDiagram
    participant Dev as Developer
    participant Make as Make
    participant Sass as Sass
    participant FS as Filesystem
    participant Ascii as Asciidoctor

    Dev->>Make: run make DEST_HTML
    Make->>Sass: build DEST_DIR/style.css from CSS_SOURCES
    Sass->>FS: write DEST_DIR/style.css
    FS-->>Make: DEST_DIR/style.css available

    Make->>FS: ensure IMAGES_TS and images in IMAGES_DIR
    FS-->>Make: IMAGES_TS up to date

    Make->>Ascii: build DEST_HTML
    Note over Make,Ascii: Pass attribute stylesheet=DEST_DIR/style.css
    Ascii->>FS: read SOURCES, DEPENDENCIES, DOCINFO_SOURCES
    Ascii->>FS: read DEST_DIR/style.css
    Ascii->>FS: write DEST_HTML and DEST_HTML.log
    FS-->>Make: DEST_HTML created
    Make-->>Dev: build finished with shared stylesheet
Loading

Flow diagram for shared CSS generation in the build process

flowchart LR
    subgraph Inputs
        CSS_SOURCES["CSS_SOURCES"]
        SOURCES["SOURCES"]
        DEPENDENCIES["DEPENDENCIES"]
        DOCINFO_SOURCES["DOCINFO_SOURCES"]
        IMAGES["IMAGES"]
    end

    CSS_SOURCES --> StyleTarget["DEST_DIR/style.css target"]
    StyleTarget --> StyleCSS["DEST_DIR/style.css"]

    IMAGES --> ImagesTarget["IMAGES_TS target"]
    ImagesTarget --> IMAGES_TS["IMAGES_TS"]

    SOURCES --> HTMLTarget["DEST_HTML target"]
    DEPENDENCIES --> HTMLTarget
    DOCINFO_SOURCES --> HTMLTarget
    StyleCSS --> HTMLTarget
    IMAGES_TS --> HTMLTarget

    HTMLTarget --> DEST_HTML["DEST_HTML (HTML output)"]
Loading

File-Level Changes

Change Details Files
Generate a single shared stylesheet instead of per-build CSS files and wire it into the HTML build pipeline.
  • Change the SASS build target to output style.css rather than a build-specific CSS filename derived from $(BUILD).css.
  • Update the HTML output target dependency to require the shared style.css instead of a build-specific CSS file.
  • Adjust the Asciidoctor invocation to reference the shared style.css via the stylesheet attribute instead of a build-specific CSS path.
guides/common/Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added Needs tech review Requires a review from the technical perspective Needs style review Requires a review from docs style/grammar perspective Needs testing Requires functional testing labels Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

The PR preview for 07adb9d is available at theforeman-foreman-documentation-preview-pr-4517.surge.sh

The following output files are affected by this PR:

show diff

show diff as HTML

@ekohl ekohl marked this pull request as ready for review December 5, 2025 16:04
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Consider extracting style.css into a Make variable (e.g. STYLESHEET_NAME) so the filename remains configurable and avoids scattering a hard-coded name across the build logic.
  • If multiple flavors can be built concurrently, using a single $(DEST_DIR)/style.css target may introduce race conditions; it might be safer to either make the rule .PHONY or ensure flavor builds serialize the stylesheet generation.
  • Double-check the clean/dist-clean targets (or equivalent) to ensure they now remove the old per-flavor $(BUILD).css artifacts and correctly handle the single style.css file.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting `style.css` into a Make variable (e.g. `STYLESHEET_NAME`) so the filename remains configurable and avoids scattering a hard-coded name across the build logic.
- If multiple flavors can be built concurrently, using a single `$(DEST_DIR)/style.css` target may introduce race conditions; it might be safer to either make the rule `.PHONY` or ensure flavor builds serialize the stylesheet generation.
- Double-check the clean/dist-clean targets (or equivalent) to ensure they now remove the old per-flavor `$(BUILD).css` artifacts and correctly handle the single `style.css` file.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ekohl
Copy link
Member Author

ekohl commented Dec 5, 2025

I believe this is now ready for review.

@aneta-petrova
Copy link
Member

Based on what I can tell, this does seem like a change for the better. However, in the spirit of the Chesterton's Fence principle, before approving I'd also like to know: Why do we currently create a CCS file for each build? Was there a reason for this originally, and if so, what was that reason?

@ekohl
Copy link
Member Author

ekohl commented Dec 5, 2025

#1002 (comment) suggests that if you run things in parallel then you can have problems, but I struggle to see how. Perhaps if you build multiple guides in parallel.

Edit: perhaps it refers to the cache instead.

Copy link
Member

@aneta-petrova aneta-petrova left a comment

Choose a reason for hiding this comment

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

Okay, thanks for the reply. I think it's worth a try.

@aneta-petrova aneta-petrova removed Needs tech review Requires a review from the technical perspective Needs style review Requires a review from docs style/grammar perspective Needs testing Requires functional testing labels Dec 8, 2025
@aneta-petrova aneta-petrova merged commit 8dd38f3 into theforeman:master Dec 8, 2025
9 of 10 checks passed
@aneta-petrova
Copy link
Member

It looks like shortly after this PR was merged, the GHA bot started posting unreasonably long lists of updated guides. For example:

#4524 (comment)

Or, in a PR that doesn't have impact on any guide at all:

#4558 (comment)

Does anyone have an idea of what could be causing this? Could it have something to do with the changes to the makefile that were introduced in this PR?

@ekohl ekohl deleted the use-a-single-css-style-file branch January 2, 2026 14:16
@ekohl
Copy link
Member Author

ekohl commented Jan 2, 2026

If you read the diff for #4558 then it's about the new foremanctl builds that are introduced. Somehow the old build doesn't recognize them.

Right now I'm unsure what triggers that exactly and I can check when I get back to work, but I don't think it's this PR.

@evgeni
Copy link
Member

evgeni commented Jan 6, 2026

#4566

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