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

Node20 actions don't work on CentOS 7 #2

Open
snps-davidla opened this issue Apr 2, 2024 · 2 comments
Open

Node20 actions don't work on CentOS 7 #2

snps-davidla opened this issue Apr 2, 2024 · 2 comments

Comments

@snps-davidla
Copy link

actions/runner#2906

  • The Node20 install for actions was built against a newer glibc (RH 8.x+)
  • Our latest/new primary platform (Alma Linux 8) works for running such actions, but that doesn't help pipeline jobs we are obligated to run for our previous primary platform (CentOS 7).
  • This will occur again in the future for Node versions built against RH 9.x+ (or equivalent).
  • This is not a one-time issue to workaround, we need a forward-looking strategic solution (providing our own node20 build would be acceptable)
$ ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node
./actions-runner-linux-x64-2.313.0/externals/node20/bin/node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node)
./actions-runner-linux-x64-2.313.0/externals/node20/bin/node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node)
./actions-runner-linux-x64-2.313.0/externals/node20/bin/node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node)
./actions-runner-linux-x64-2.313.0/externals/node20/bin/node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node)
./actions-runner-linux-x64-2.313.0/externals/node20/bin/node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node)
./actions-runner-linux-x64-2.313.0/externals/node20/bin/node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by ./actions-runner-linux-x64-2.313.0/externals/node20/bin/node)
$
@igorcosta
Copy link

@snps-davidla if providing your own node20 is acceptable, I would opt for this instance. Mainly because if is not supported by our official images, is very unlikely that will add support in the short and long term.

I've got a straightforward solution for you that should sort out your current issues and set you up for the future.

Here is a step by step:

  1. Create a custom Node.js build for CentOS 7:

First up, we need to whip up a custom Node.js build that'll play nice with CentOS 7. Here's a script that'll do the job:

#!/bin/bash
set -e

# Update system and install dependencies
yum update -y
yum groupinstall -y "Development Tools"
yum install -y wget openssl-devel

# Download and extract Node.js source
NODE_VERSION="20.11.1"  # Adjust as needed
wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz
tar xzf node-v${NODE_VERSION}.tar.gz
cd node-v${NODE_VERSION}

# Configure and build Node.js
./configure --prefix=/opt/nodejs-${NODE_VERSION}
make -j$(nproc)
make install

# Create a tarball of the built Node.js
cd /opt
tar czf nodejs-${NODE_VERSION}-centos7.tar.gz nodejs-${NODE_VERSION}

echo "Custom Node.js build complete: /opt/nodejs-${NODE_VERSION}-centos7.tar.gz"
  1. Integrate the custom build into your GitHub Actions workflow:

Now, let's get this custom build working with your GitHub Actions. Here's how we'll modify the workflow:

name: CI with Custom Node.js

on: [push, pull_request]

jobs:
  build:
    runs-on: self-hosted
    steps:
    - uses: actions/checkout@v4
    
    - name: Set up custom Node.js
      run: |
        mkdir -p $HOME/.local
        tar xzf /path/to/nodejs-20.11.1-centos7.tar.gz -C $HOME/.local
        echo "$HOME/.local/nodejs-20.11.1/bin" >> $GITHUB_PATH

    - name: Use Node.js
      run: |
        node --version
        npm --version

    # Add your other build steps here
  1. Implementation steps:

a) Build the custom Node.js:

  • Set up a CentOS 7 environment (VM or container).
  • Run the build script I've provided in the first code block.
  • Chuck the resulting tarball in a secure spot that your runners can access.

b) Update your GitHub Actions workflow:

  • Modify your existing workflow or create a new one based on the second code block.
  • Make sure the path to the custom Node.js tarball is spot on.

c) Test and deploy:

  • Give it a whirl with a test workflow to make sure the custom Node.js build is behaving itself.
  • If it's all good, start rolling it out to your production workflows.
  1. Long-term considerations:
  • Create your own version of runner image that has built-in the node version for RH9.x or later version.
  • Automate the build process for new Node.js versions. It'll save you heaps of time down the track.
  • Have a think about containerisation. It'll give you even better isolation and make things more portable.
  • Start planning for the day when you'll need to upgrade your OS versions across your infrastructure.

This solution should sort out your immediate compatibility dramas while also setting you up with a process you can adapt for future Node.js versions. It lets you keep using CentOS 7 where you need to, but gives you control over the Node.js environment in your GitHub Actions workflows.

Let me know if you need more clarification.

@igorcosta
Copy link

Any progress on this?

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

No branches or pull requests

2 participants