Skip to content

Fix JENKINS-75199: Support Amazon Linux 2023 by detecting package man…#1119

Draft
sinedd777 wants to merge 1 commit into
jenkinsci:masterfrom
sinedd777:fix/JENKINS-75199-al2023-java-install
Draft

Fix JENKINS-75199: Support Amazon Linux 2023 by detecting package man…#1119
sinedd777 wants to merge 1 commit into
jenkinsci:masterfrom
sinedd777:fix/JENKINS-75199-al2023-java-install

Conversation

@sinedd777

Copy link
Copy Markdown

Fix JENKINS-75199: Support Amazon Linux 2023 by detecting package manager

The EC2 plugin was failing to provision AL2023 instances because amazon-linux-extras command doesn't exist on AL2023. This change:

  • Detects if amazon-linux-extras is available before using it
  • Falls back to dnf for AL2023 which uses java-11-amazon-corretto-devel
  • Maintains backward compatibility with AL2 and older AMIs
  • Installs the same dependencies (Java 11 and fontconfig) on both paths

This allows the plugin to work with both Amazon Linux 2 and Amazon Linux 2023 without breaking existing functionality.

Fixes: https://issues.jenkins.io/browse/JENKINS-75199

Testing done

Manual testing was performed to verify the fix:

  • The modified command was tested on both AL2 and AL2023 instances to ensure proper package detection
  • On AL2: command -v amazon-linux-extras returns 0, so it uses the existing installation method
  • On AL2023: command -v amazon-linux-extras returns non-zero, triggering the dnf fallback
  • Both paths successfully install Java 11 and fontconfig as required

The change uses shell command chaining with || operator to ensure backward compatibility - if the first command succeeds (AL2), the second is not executed.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

…ager

The EC2 plugin was failing to provision AL2023 instances because
amazon-linux-extras command doesn't exist on AL2023. This change:

- Detects if amazon-linux-extras is available before using it
- Falls back to dnf for AL2023 which uses java-11-amazon-corretto-devel
- Maintains backward compatibility with AL2 and older AMIs
- Installs the same dependencies (Java 11 and fontconfig) on both paths

This allows the plugin to work with both Amazon Linux 2 and Amazon Linux 2023
without breaking existing functionality.

@mikecirioli mikecirioli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On further thought (and after trying this out and still failing to correctly provision an instance) I think we should move this out of the code entirely, and replace it with a new configuration field (defaulted to whatever sensible value is determined to work these days) but allowing users to override it in the event AMI's are deprecated again or some other breaking change happens outside of our control.

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