Skip to content

Commit 37d09f8

Browse files
Add arm build images
1 parent 0de4bff commit 37d09f8

File tree

6 files changed

+173
-29
lines changed

6 files changed

+173
-29
lines changed

Makefile

+27-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ endif
1717

1818
# Linux Splunk arguments
1919
SPLUNK_LINUX_FILENAME ?= splunk-${SPLUNK_VERSION}-${SPLUNK_BUILD}-Linux-${SPLUNK_ARCH}.tgz
20+
SPLUNK_ARM_FILENAME ?= splunk-${SPLUNK_VERSION}-${SPLUNK_BUILD}-Linux-${SPLUNK_ARCH}.tgz
2021
SPLUNK_LINUX_BUILD_URL ?= https://download.splunk.com/products/${SPLUNK_PRODUCT}/releases/${SPLUNK_VERSION}/linux/${SPLUNK_LINUX_FILENAME}
22+
SPLUNK_ARM_BUILD_URL ?= https://download.splunk.com/products/${SPLUNK_PRODUCT}/releases/${SPLUNK_VERSION}/linux/${SPLUNK_ARM_FILENAME}
2123
UF_LINUX_FILENAME ?= splunkforwarder-${SPLUNK_VERSION}-${SPLUNK_BUILD}-Linux-${SPLUNK_ARCH}.tgz
2224
UF_LINUX_BUILD_URL ?= https://download.splunk.com/products/universalforwarder/releases/${SPLUNK_VERSION}/linux/${UF_LINUX_FILENAME}
25+
UF_ARM_FILENAME ?= splunkforwarder-${SPLUNK_VERSION}-${SPLUNK_BUILD}-Linux-${SPLUNK_ARCH}.tgz
26+
UF_ARM_BUILD_URL ?= https://download.splunk.com/products/universalforwarder/releases/${SPLUNK_VERSION}/linux/${UF_ARM_FILENAME}
2327
# Windows Splunk arguments
2428
SPLUNK_WIN_FILENAME ?= splunk-${SPLUNK_VERSION}-${SPLUNK_BUILD}-x64-release.msi
2529
SPLUNK_WIN_BUILD_URL ?= https://download.splunk.com/products/${SPLUNK_PRODUCT}/releases/${SPLUNK_VERSION}/windows/${SPLUNK_WIN_FILENAME}
@@ -32,8 +36,8 @@ SCANNER_DATE := `date +%Y-%m-%d`
3236
SCANNER_DATE_YEST := `TZ=GMT+24 +%Y:%m:%d`
3337
SCANNER_VERSION := v8
3438
SCANNER_LOCALIP := $(shell ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | awk '{print $1}' | head -n 1)
35-
SCANNER_IMAGES_TO_SCAN := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
36-
CONTAINERS_TO_SAVE := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
39+
SCANNER_IMAGES_TO_SCAN := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 splunk-arm64-amazon-linux-2023 uf-arm64-amazon-linux-2023 uf-debian-9 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
40+
CONTAINERS_TO_SAVE := splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-redhat-8 uf-debian-9 splunk-arm64-amazon-linux-2023 uf-arm64-amazon-linux-2023 uf-debian-10 uf-centos-7 uf-redhat-8 splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-redhat-8 uf-py23-debian-9 uf-py23-debian-10 uf-py23-centos-7 uf-py23-redhat-8
3741
ifeq ($(shell uname), Linux)
3842
SCANNER_FILE = clair-scanner_linux_amd64
3943
else ifeq ($(shell uname), Darwin)
@@ -57,7 +61,7 @@ ansible:
5761
@cat splunk-ansible/version.txt
5862

5963
##### Base images #####
60-
base: base-debian-9 base-debian-10 base-centos-7 base-centos-8 base-redhat-8 base-windows-2016
64+
base: base-debian-9 base-debian-10 base-centos-7 base-centos-8 base-redhat-8 base-windows-2016 base-arm64-amazon-linux-2023
6165

6266
base-debian-10:
6367
docker build ${DOCKER_BUILD_FLAGS} -t base-debian-10:${IMAGE_VERSION} ./base/debian-10
@@ -80,6 +84,9 @@ base-redhat-8-armv8:
8084
base-windows-2016:
8185
docker build ${DOCKER_BUILD_FLAGS} -t base-windows-2016:${IMAGE_VERSION} ./base/windows-2016
8286

87+
base-arm64-amazon-linux-2023:
88+
docker build ${DOCKER_BUILD_FLAGS} --platform=linux/arm64/v8 --label version=${SPLUNK_VERSION} -t base-arm64-amazon-linux-2023:${IMAGE_VERSION} ./base/amazon-linux-2023
89+
8390
##### Minimal images #####
8491
minimal: minimal-debian-9 minimal-debian-10 minimal-centos-7 minimal-centos-8 minimal-redhat-8
8592

@@ -157,7 +164,7 @@ bare-redhat-8: base-redhat-8
157164
--target bare -t bare-redhat-8:${IMAGE_VERSION} .
158165

159166
##### Splunk images #####
160-
splunk: ansible splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-centos-8 splunk-redhat-8
167+
splunk: ansible splunk-debian-9 splunk-debian-10 splunk-centos-7 splunk-centos-8 splunk-redhat-8 splunk-arm64-amazon-linux-2023
161168

162169
splunk-debian-9: base-debian-9 ansible
163170
docker build ${DOCKER_BUILD_FLAGS} \
@@ -201,6 +208,14 @@ splunk-windows-2016: base-windows-2016 ansible
201208
--build-arg SPLUNK_BUILD_URL=${SPLUNK_WIN_BUILD_URL} \
202209
-t splunk-windows-2016:${IMAGE_VERSION} .
203210

211+
splunk-arm64-amazon-linux-2023: base-arm64-amazon-linux-2023 ansible
212+
docker build ${DOCKER_BUILD_FLAGS} \
213+
--platform=linux/arm64/v8 \
214+
-f splunk/common-files/Dockerfile \
215+
--build-arg SPLUNK_BASE_IMAGE=base-arm64-amazon-linux-2023 \
216+
--build-arg SPLUNK_BUILD_URL=${SPLUNK_ARM_BUILD_URL} \
217+
-t splunk-arm64-amazon-linux-2023:${IMAGE_VERSION} .
218+
204219
##### UF images #####
205220
uf: ansible uf-debian-9 uf-debian-10 uf-centos-7 uf-centos-8 uf-redhat-8
206221

@@ -268,6 +283,13 @@ uf-windows-2016: base-windows-2016 ansible
268283
--build-arg SPLUNK_BUILD_URL=${UF_WIN_BUILD_URL} \
269284
-t uf-windows-2016:${IMAGE_VERSION} .
270285

286+
uf-arm64-amazon-linux-2023: base-arm64-amazon-linux-2023 ansible
287+
docker build ${DOCKER_BUILD_FLAGS} \
288+
--platform=linux/arm64/v8 \
289+
-f uf/common-files/Dockerfile \
290+
--build-arg SPLUNK_BASE_IMAGE=base-arm64-amazon-linux-2023 \
291+
--build-arg SPLUNK_BUILD_URL=${UF_ARM_BUILD_URL} \
292+
-t uf-arm64-amazon-linux-2023:${IMAGE_VERSION} .
271293

272294
##### Python 3 support #####
273295
splunk-py23: splunk-py23-debian-9 splunk-py23-debian-10 splunk-py23-centos-7 splunk-py23-centos-8 splunk-py23-redhat-8
@@ -350,7 +372,7 @@ run_large_tests: run_large_tests_centos7 run_large_tests_redhat8 run_large_tests
350372

351373
test_centos7: clean ansible splunk-centos-7 uf-centos-7 test_setup run_small_tests_centos7 run_large_tests_centos7
352374

353-
test_redhat8: clean ansible splunk-redhat-8 uf-redhat-8 test_setup run_small_tests_redhat8 run_large_tests_redhat8
375+
test_redhat8: clean ansible splunk-redhat-8 splunk-arm64-amazon-linux-2023 uf-arm64-amazon-linux-2023 uf-redhat-8 test_setup run_small_tests_redhat8 run_large_tests_redhat8
354376

355377
test_debian9: clean ansible splunk-debian-9 uf-debian-9 test_setup run_small_tests_debian9 run_large_tests_debian9
356378

base/amazon-linux-2023/Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2018-2024 Splunk
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG BASE_IMAGE=amazonlinux:2023
16+
FROM ${BASE_IMAGE} as package
17+
18+
LABEL name="splunk" \
19+
maintainer="[email protected]" \
20+
vendor="splunk" \
21+
release="1" \
22+
summary="Amazon-Linux-2023" \
23+
description="Splunk Enterprise is a platform for operational intelligence. Our software lets you collect, analyze, and act upon the untapped value of big data that your technology infrastructure, security systems, and business applications generate. It gives you insights to drive operational performance and business results."
24+
25+
26+
COPY install.sh /install.sh
27+
28+
RUN mkdir /licenses \
29+
&& curl -o /licenses/apache-2.0.txt https://www.apache.org/licenses/LICENSE-2.0.txt
30+
31+
RUN /install.sh && rm -rf /install.sh

base/amazon-linux-2023/install.sh

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
# Copyright 2018-2024 Splunk
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -e
17+
18+
# Generate UTF-8 char map and locale
19+
# Reinstalling local English def for now, removed in minimal image: https://bugzilla.redhat.com/show_bug.cgi?id=1665251
20+
dnf -y --nodocs install glibc-langpack-en
21+
22+
# Currently there is no access to the UTF-8 char map. The following command is commented out until
23+
# the base container can generate the locale.
24+
# localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
25+
# We get around the gen above by forcing the language install, and then pointing to it.
26+
export LANG=en_US.utf8
27+
28+
# Install utility packages
29+
dnf -y --nodocs install wget sudo shadow-utils procps tar make gcc \
30+
openssl-devel bzip2-devel libffi-devel findutils \
31+
libssh-devel libcurl-devel glib2-devel ncurses-devel \
32+
diffutils bzip2
33+
# Patch security updates
34+
dnf -y --nodocs update gnutls kernel-headers libdnf librepo libnghttp2 nettle \
35+
libpwquality libxml2 systemd-libs lz4-libs curl \
36+
rpm rpm-libs sqlite-libs cyrus-sasl-lib vim expat \
37+
openssl-libs xz-libs zlib libsolv file-libs pcre \
38+
libarchive libgcrypt libksba libstdc++ json-c gnupg
39+
40+
# Reinstall tzdata (originally stripped from minimal image): https://bugzilla.redhat.com/show_bug.cgi?id=1903219
41+
dnf -y --nodocs reinstall tzdata || dnf -y --nodocs update tzdata
42+
43+
# Build and install busybox direct from the multiarch since EPEL isn't available yet for redhat8
44+
cd ~
45+
wget https://busybox.net/downloads/busybox-1.36.1.tar.bz2
46+
bzip2 -d busybox-1.36.1.tar.bz2
47+
tar -xf busybox-1.36.1.tar
48+
cd busybox-1.36.1
49+
make defconfig
50+
make
51+
cp busybox /bin/busybox
52+
cd ~
53+
rm -rf busybox-1.36.1.tar busybox-1.36.1/
54+
55+
## Install Python and necessary packages
56+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
57+
python3 get-pip.py
58+
rm -f get-pip.py
59+
ln -sf /usr/bin/python3 /usr/bin/python
60+
61+
# Install splunk-ansible dependencies
62+
pip3 -q --no-cache-dir install --upgrade Mako avro lxml protobuf
63+
pip3 install setuptools
64+
pip3 install six
65+
pip3 install wheel
66+
pip3 install requests
67+
pip3 install cryptography==3.3.2
68+
pip3 install jmespath
69+
pip3 install urllib3==1.26.5
70+
pip3 install ansible
71+
cd /
72+
73+
# Remove tests packaged in python libs
74+
find /usr/lib/ -depth \( -type d -a -not -wholename '*/ansible/plugins/test' -a \( -name test -o -name tests -o -name idle_test \) \) -exec rm -rf '{}' \;
75+
find /usr/lib/ -depth \( -type f -a -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) -exec rm -rf '{}' \;
76+
find /usr/lib/ -depth \( -type f -a -name 'wininst-*.exe' \) -exec rm -rf '{}' \;
77+
ldconfig
78+
79+
# Cleanup
80+
dnf remove -y make gcc openssl-devel bzip2-devel findutils glib2-devel glibc-devel cpp binutils \
81+
keyutils-libs-devel krb5-devel libcom_err-devel libffi-devel libcurl-devel \
82+
libselinux-devel libsepol-devel libssh-devel libverto-devel libxcrypt-devel \
83+
ncurses-devel pcre2-devel zlib-devel diffutils bzip2
84+
dnf clean all
85+
86+
# Enable busybox symlinks
87+
cd /bin
88+
BBOX_LINKS=( clear find diff hostname killall netstat nslookup ping ping6 readline route syslogd tail traceroute vi )
89+
for item in "${BBOX_LINKS[@]}"
90+
do
91+
ln -s busybox $item || true
92+
done
93+
chmod u+s /bin/ping
94+
groupadd sudo
95+
96+
echo "
97+
## Allows people in group sudo to run all commands
98+
%sudo ALL=(ALL) ALL" >> /etc/sudoers
99+
100+
# Clean
101+
dnf clean all
102+
rm -rf /install.sh /anaconda-post.log /var/log/anaconda/*

splunk/common-files/Dockerfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ FROM ${SPLUNK_BASE_IMAGE}:latest as package
2121
ARG SPLUNK_BUILD_URL
2222
COPY splunk/common-files/make-minimal-exclude.py /tmp
2323
RUN python /tmp/make-minimal-exclude.py ${SPLUNK_BUILD_URL} > /tmp/splunk-minimal-exclude.list \
24-
&& echo "Downloading Splunk and validating the checksum at: ${SPLUNK_BUILD_URL}" \
24+
&& echo "Downloading Splunk: ${SPLUNK_BUILD_URL}" \
2525
&& wget -qO /tmp/`basename ${SPLUNK_BUILD_URL}` ${SPLUNK_BUILD_URL} \
26-
&& wget -qO /tmp/splunk.tgz.sha512 ${SPLUNK_BUILD_URL}.sha512 \
2726
&& cd /tmp \
28-
&& echo "$(cat /tmp/splunk.tgz.sha512)" | sha512sum --check --status \
29-
&& rm /tmp/splunk.tgz.sha512 \
3027
&& mkdir -p /minimal/splunk/var /extras/splunk/var \
3128
&& tar -C /minimal/splunk --strip 1 --exclude-from=/tmp/splunk-minimal-exclude.list -zxf /tmp/`basename ${SPLUNK_BUILD_URL}` \
3229
&& tar -C /extras/splunk --strip 1 --wildcards --files-from=/tmp/splunk-minimal-exclude.list -zxf /tmp/`basename ${SPLUNK_BUILD_URL}` \

splunk/common-files/make-minimal-exclude.py

+11-16
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
EXCLUDE_V7 = """*-manifest
66
*/bin/installit.py
7-
*/bin/jars/*
87
*/bin/jsmin*
9-
*/bin/*mongo*
10-
*/3rdparty/Copyright-for-mongo*
118
*/bin/node*
129
*/bin/pcregextest*
1310
*/etc/*.lic*
@@ -19,7 +16,6 @@
1916
*/etc/apps/sample_app*
2017
*/etc/apps/appsbrowser*
2118
*/etc/apps/alert_webhook*
22-
*/etc/apps/splunk_archiver*
2319
*/etc/apps/splunk_monitoring_console*
2420
*/lib/node_modules*
2521
*/share/splunk/app_templates*
@@ -30,24 +26,23 @@
3026
*/share/splunk/pdf*
3127
*mrsparkle*"""
3228

33-
version_string = re.match(".*splunk-([0-9]+)\.([0-9]+)\.[0-9]+\.?[0-9]?-[0-9a-z]+-Linux-[0-9a-z_-]+.tgz", sys.argv[1])
34-
major_version = None
35-
minor_version = None
29+
m = re.match(".*splunk-([0-9]+)\.([0-9]+)\.[0-9]+\.?[0-9]?-[0-9a-z]+-Linux-([0-9a-z_-]+).tgz", sys.argv[1])
3630

37-
if version_string:
38-
major_version = version_string.group(1)
39-
minor_version = version_string.group(2)
40-
41-
if major_version:
31+
if m and m.group(1):
4232
print(EXCLUDE_V7)
43-
if int(major_version) == 7:
33+
if int(m.group(1)) == 7:
4434
print("*/bin/parsetest*")
45-
if int(minor_version) < 3:
35+
if int(m.group(2)) < 3:
4636
print("*/etc/apps/framework*")
4737
print("*/etc/apps/gettingstarted*")
4838
else:
4939
print("*/etc/apps/splunk_metrics_workspace*")
50-
elif 7 < int(major_version) < 9:
40+
elif int(m.group(1)) > 7:
5141
print("*/etc/apps/splunk_metrics_workspace*")
52-
if int(minor_version) < 1:
42+
if int(m.group(1)) == 8 and int(m.group(2)) < 1:
5343
print("*/bin/parsetest*")
44+
if m.group(3) != "aarch64":
45+
print("*/bin/jars/*")
46+
print("*/bin/*mongo*")
47+
print("*/3rdparty/Copyright-for-mongo*")
48+
print("*/etc/apps/splunk_archiver*")

uf/common-files/Dockerfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ ARG SPLUNK_BASE_IMAGE=base-debian-10
2020
FROM ${SPLUNK_BASE_IMAGE}:latest as package
2121
ARG SPLUNK_BUILD_URL
2222
ENV SPLUNK_HOME=/opt/splunkforwarder
23-
RUN echo "Downloading Splunk and validating the checksum at: ${SPLUNK_BUILD_URL}" \
23+
RUN echo "Downloading Splunk: ${SPLUNK_BUILD_URL}" \
2424
&& wget -qO /tmp/`basename ${SPLUNK_BUILD_URL}` ${SPLUNK_BUILD_URL} \
25-
&& wget -qO /tmp/splunk.tgz.sha512 ${SPLUNK_BUILD_URL}.sha512 \
2625
&& cd /tmp \
27-
&& echo "$(cat /tmp/splunk.tgz.sha512)" | sha512sum --check --status \
28-
&& rm /tmp/splunk.tgz.sha512 \
2926
&& tar -C /opt -zxf /tmp/`basename ${SPLUNK_BUILD_URL}` \
3027
&& mv ${SPLUNK_HOME}/etc ${SPLUNK_HOME}-etc \
3128
&& mkdir -p ${SPLUNK_HOME}/etc ${SPLUNK_HOME}/var

0 commit comments

Comments
 (0)