Skip to content

Commit 806873d

Browse files
Support custom start-command/start-options on GHA container runner and openssl1.1.1 on AL2 docker images (#5187)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent d74cbaf commit 806873d

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

.github/workflows/get-ci-image-tag.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,33 @@ on:
2525
ci-image-version-linux:
2626
description: The ci image version for linux build
2727
value: ${{ jobs.Get-CI-Image-Tag.outputs.output-ci-image-version-linux }}
28+
ci-image-start-options:
29+
description: The ci image start options to set when starting the container
30+
value: ${{ jobs.Get-CI-Image-Tag.outputs.output-ci-image-start-options }}
31+
ci-image-start-command:
32+
description: The ci image start commands to run after initialization
33+
value: ${{ jobs.Get-CI-Image-Tag.outputs.output-ci-image-start-command }}
2834

2935
jobs:
3036
Get-CI-Image-Tag:
3137
runs-on: ubuntu-latest
3238
outputs:
33-
output-ci-image-version-linux: ${{ steps.step-ci-image-version-linux.outputs.ci-image-version-linux }}
39+
output-ci-image-version-linux: ${{ steps.step-ci-image-setups.outputs.ci-image-version-linux }}
40+
output-ci-image-start-command: ${{ steps.step-ci-image-setups.outputs.ci-image-start-command }}
41+
output-ci-image-start-options: ${{ steps.step-ci-image-setups.outputs.ci-image-start-options }}
3442
steps:
3543
- name: Install crane
3644
uses: iarekylew00t/crane-installer@v1
3745
with:
3846
crane-release: v0.15.2
3947
- name: Checkout opensearch-build repository
40-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4149
with:
4250
repository: 'opensearch-project/opensearch-build'
4351
ref: ${{ inputs.build_ref }}
4452
path: 'opensearch-build'
4553
- name: Get ci image version from opensearch-build repository scripts
46-
id: step-ci-image-version-linux
54+
id: step-ci-image-setups
4755
run: |
4856
PRODUCT=${{ inputs.product }}
4957
PLATFORM=${{ inputs.platform }}
@@ -55,6 +63,18 @@ jobs:
5563
PLATFORM="almalinux8"
5664
fi
5765
fi
66+
67+
if [[ "$PLATFORM" = "al2" ]]; then
68+
CI_IMAGE_CMD="cp -a /node_al2/* /node && /node/bin/node -v"
69+
echo "ci-image-start-command=$CI_IMAGE_CMD" >> $GITHUB_OUTPUT
70+
CI_IMAGE_OPTIONS="--user root -v /node:/node:rw,rshared -v /node:/__e/node20:ro,rshared"
71+
echo "ci-image-start-options=$CI_IMAGE_OPTIONS" >> $GITHUB_OUTPUT
72+
else
73+
CI_IMAGE_CMD="echo pass"
74+
echo "ci-image-start-command=$CI_IMAGE_CMD" >> $GITHUB_OUTPUT
75+
CI_IMAGE_OPTIONS="--user root"
76+
echo "ci-image-start-options=$CI_IMAGE_OPTIONS" >> $GITHUB_OUTPUT
77+
fi
5878
crane version
5979
echo $PRODUCT $PLATFORM
6080
CI_IMAGE_VERSION=`opensearch-build/docker/ci/get-ci-images.sh -p $PLATFORM -u $PRODUCT -t $TYPE | head -1`

docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile

+27-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,21 @@ ENV GEM_HOME=$CONTAINER_USER_HOME/.gem
7676
ENV GEM_PATH=$GEM_HOME
7777
ENV PATH=$RUBY_HOME:$RVM_HOME:$PATH
7878

79+
# Installing openssl1.1.1
80+
# Support requests >= 2.28.1 version
81+
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64:/usr/lib
82+
RUN yum install -y curl libcurl-devel libfaketime perl-core pcre-devel && yum remove -y openssl-devel && yum clean all && \
83+
mkdir -p /tmp/openssl && cd /tmp/openssl && \
84+
curl -sSL -o- https://www.openssl.org/source/openssl-1.1.1g.tar.gz | tar -xz --strip-components 1 && \
85+
./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared zlib-dynamic && make && make install && \
86+
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64:/usr/lib" > /etc/profile.d/openssl.sh && openssl version
87+
7988
# Install Python binary
8089
RUN curl https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz | tar xzvf - && \
8190
cd Python-3.9.7 && \
82-
./configure --enable-optimizations && \
83-
make altinstall
91+
env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64:/usr/lib ./configure --enable-optimizations --with-openssl=/usr --prefix=/usr/local && \
92+
make altinstall && cd ../ && rm -rf Python-3.9.7.tgz Python-3.9.7 && \
93+
cp -v /etc/ssl/certs/ca-bundle.crt /etc/ssl/cert.pem
8494

8595
# Setup Python links
8696
RUN ln -sfn /usr/local/bin/python3.9 /usr/bin/python3 && \
@@ -114,6 +124,21 @@ RUN git clone -b v0.3.27 --single-branch https://github.com/xianyi/OpenBLAS.git
114124
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
115125
RUN pip3 install cmake==3.26.4
116126

127+
# NodeJS Unofficial Builds
128+
# https://github.com/opensearch-project/opensearch-build/issues/5178
129+
# https://github.com/actions/runner/issues/2906
130+
# https://github.com/actions/runner/issues/3475
131+
# GitHub enforce nodejs 20 official build in runner 2.317.0 of their actions and CentOS7/AL2 would fail due to having older glibc versions
132+
# Until https://github.com/actions/runner/pull/3128 is merged or AL2 is deprecated (2025/06) this is a quick fix with unofficial builds support glibc 2.17
133+
# With changes done similar to this PR (https://github.com/opensearch-project/job-scheduler/pull/702) alongside the image here
134+
# Only linux x64 is supported in unofficial build until https://github.com/nodejs/unofficial-builds/pull/91 is merged
135+
RUN if [ `uname -m` = "x86_64" ]; then \
136+
curl -SL https://unofficial-builds.nodejs.org/download/release/v20.10.0/node-v20.10.0-linux-x64-glibc-217.tar.xz -o /node20.tar.xz; \
137+
mkdir /node_al2; \
138+
tar -xf /node20.tar.xz --strip-components 1 -C /node_al2; \
139+
rm -v /node20.tar.xz; \
140+
fi
141+
117142
# Change User
118143
USER $CONTAINER_USER
119144
WORKDIR $CONTAINER_USER_HOME

0 commit comments

Comments
 (0)