Skip to content

Conversation

kksudo
Copy link
Contributor

@kksudo kksudo commented Jun 22, 2025

Optimized Docker Builds, Workflow, and Plugin Updates

This PR improves the Docker build process, GitHub Actions workflow, and plugin dependencies for the Headlamp Kubernetes plugins repository.

Main Changes

  1. Fixed Flux Dependencies: Resolved issues with the flux plugin dependencies to ensure stability.
  2. Fixed Multi-Architecture Builds: Corrected multi-architecture build issues for broader platform compatibility.
  3. Bumped Flux Plugin Version: Updated the flux plugin version in flux/package.json from 0.2.0 to 0.2.1.

Additional Improvements

  1. Multi-Plugin Builds: Updated .github/workflows/build-and-publish-image.yml to support building multiple plugins in a single GitHub Actions run using a matrix strategy.
  2. Cleaned Up Orphaned Workflow Processes: Removed lingering processes in the GitHub Actions workflow for improved reliability.
  3. Added GitHub Actions Cache: Implemented caching to speed up workflow runs.
  4. Optimized Dockerfile: Added logic to skip development dependencies in production builds when ENVIRONMENT is set to production.
  5. Added .dockerignore: Excluded node_modules, .git, and test files to reduce Docker image size and improve build efficiency.
  6. Configurable Image Versions: Introduced BASE_IMAGE_VERSION and FINAL_IMAGE_VERSION arguments in the Dockerfile and fixed unsupported Node base image versions.
  7. Added .gitignore: Included a .gitignore file to prevent unnecessary files from being tracked.
  8. Improve the Flux plugin documentation

https://github.com/kksudo/plugins/actions/runs/15802543339

image


issue links

  1. Error: Cannot find module @rollup/rollup-linux-arm64-gnu https://github.com/headlamp-k8s/plugins/actions/runs/14095869941/job/39482966413#step:9:287
  2. can't create plugins/flux directory Flux: v0.2.0 can't create plugins/flux directory #214

improves the Docker build process, GitHub Actions workflow, and plugin dependencies for the Headlamp Kubernetes plugins repository.

Signed-off-by: Kirill <[email protected]>
@kksudo kksudo force-pushed the bugfix/fix-multiarch branch from d4f7d8f to 8f40c05 Compare June 22, 2025 03:35
@kksudo
Copy link
Contributor Author

kksudo commented Jun 22, 2025

@illume Pls, review this PR

@illume
Copy link
Contributor

illume commented Jun 22, 2025

Wow, thanks for all these improvements.

Would you mind breaking the changes up into separate commits? With one separate topic per commit.

I think the flux package.json version change can be removed from the PR. The release can come later.

@kksudo
Copy link
Contributor Author

kksudo commented Jun 22, 2025

Wow, thanks for all these improvements.

Would you mind breaking the changes up into separate commits? With one separate topic per commit.

I think the flux package.json version change can be removed from the PR. The release can come later.

@illume ,
Done, pls check attached PRs

@@ -1,5 +1,7 @@
# Use the official Node.js 18 image as the base image for building the plugins
FROM node:18@sha256:d0bbfdbad0bff8253e6159dcbee42141db4fc309365d5b8bcfce46ed71569078 AS builder
ARG BASE_IMAGE_VERSION=18
Copy link
Contributor

Choose a reason for hiding this comment

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

For security reasons we need the full image version with the hash.

# Use the official Node.js 18 image as the base image for building the plugins
FROM node:18@sha256:d0bbfdbad0bff8253e6159dcbee42141db4fc309365d5b8bcfce46ed71569078 AS builder
ARG BASE_IMAGE_VERSION=18
ARG FINAL_IMAGE_VERSION=3.20.3
Copy link
Contributor

Choose a reason for hiding this comment

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

For security reasons we need the full image version with the hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For security reasons we need the full image version with the hash.

Would you like to get the dependabot , which could watch updates and make a PR for the updated docker image versions?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we had it. I will check it out. But in the current code, we need to keep the hash.

@@ -1,6 +1,6 @@
{
"name": "@headlamp-k8s/flux",
"version": "0.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the flux commits from this PR? I think this should be just about the image building.

Copy link
Contributor

Choose a reason for hiding this comment

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

The commit title needs to summarize what this commit does. It does update the docs but it should instead indicate what this is about.

image: ghcr.io/headlamp-k8s/headlamp-plugin-flux:latest
imagePullPolicy: Always
name: headlamp-plugins
securityContext:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to run this as root?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, I guess no.

@joaquimrocha
Copy link
Contributor

Thanks @kksudo . I think the image building changes for the GH action are nice. I left some comments though.

@kksudo
Copy link
Contributor Author

kksudo commented Jun 25, 2025

Thanks @kksudo . I think the image building changes for the GH action are nice. I left some comments though.
@joaquimrocha

Actually, I split this big PR to few small PRs. Should we close this one and use small PRs instead?

@illume
Copy link
Contributor

illume commented Jul 7, 2025

Yeah, let's close this one now you have all the other ones :)

@illume illume closed this Jul 7, 2025
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