Skip to content

Commit ec588d0

Browse files
author
Pat
authored
workflows: ensure we substitute variables (fluent#5484)
* workflows: ensure we substitute variables Signed-off-by: Patrick Stephens <[email protected]> * workflows: handle tweaks for substitution Signed-off-by: Patrick Stephens <[email protected]> * workflows: handle tweaks for substitution Signed-off-by: Patrick Stephens <[email protected]> * workflows: support customising the install script Signed-off-by: Patrick Stephens <[email protected]>
1 parent 3d708fb commit ec588d0

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

install.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,38 @@ sudo -k
3434
# Will require sudo
3535
case ${OS} in
3636
amzn|amazonlinux)
37-
sudo sh <<'SCRIPT'
37+
# We need variable expansion and non-expansion on the URL line to pick up the base URL.
38+
# Therefore we combine things with sed to handle it.
39+
sudo sh <<SCRIPT
3840
rpm --import $RELEASE_KEY
3941
cat << EOF > /etc/yum.repos.d/fluent-bit.repo
4042
[fluent-bit]
4143
name = Fluent Bit
42-
baseurl = $RELEASE_URL/amazonlinux/\$releasever/\$basearch/
44+
baseurl = $RELEASE_URL/amazonlinux/VERSION_ARCH_SUBSTR
4345
gpgcheck=1
4446
repo_gpgcheck=1
4547
gpgkey=$RELEASE_KEY
4648
enabled=1
4749
EOF
50+
sed -i 's|VERSION_ARCH_SUBSTR|\$releasever/\$basearch/|g' /etc/yum.repos.d/fluent-bit.repo
51+
cat /etc/yum.repos.d/fluent-bit.repo
4852
yum -y install fluent-bit || yum -y install td-agent-bit
4953
SCRIPT
5054
;;
5155
centos|centoslinux|rhel|redhatenterpriselinuxserver|fedora|rocky|almalinux)
52-
sudo sh <<'SCRIPT'
56+
sudo sh <<SCRIPT
5357
rpm --import $RELEASE_KEY
5458
cat << EOF > /etc/yum.repos.d/fluent-bit.repo
5559
[fluent-bit]
5660
name = Fluent Bit
57-
baseurl = $RELEASE_URL/centos/\$releasever/\$basearch/
61+
baseurl = $RELEASE_URL/centos/VERSION_ARCH_SUBSTR
5862
gpgcheck=1
5963
repo_gpgcheck=1
6064
gpgkey=$RELEASE_KEY
6165
enabled=1
6266
EOF
67+
sed -i 's|VERSION_ARCH_SUBSTR|\$releasever/\$basearch/|g' /etc/yum.repos.d/fluent-bit.repo
68+
cat /etc/yum.repos.d/fluent-bit.repo
6369
yum -y install fluent-bit || yum -y install td-agent-bit
6470
SCRIPT
6571
;;
@@ -73,6 +79,7 @@ curl $RELEASE_KEY | gpg --dearmor > /usr/share/keyrings/fluentbit-keyring.gpg
7379
cat > /etc/apt/sources.list.d/fluent-bit.list <<EOF
7480
deb [signed-by=/usr/share/keyrings/fluentbit-keyring.gpg] $RELEASE_URL/${OS}/${CODENAME} ${CODENAME} main
7581
EOF
82+
cat /etc/apt/sources.list.d/fluent-bit.list
7683
apt-get -y update
7784
apt-get -y install fluent-bit || apt-get -y install td-agent-bit
7885
SCRIPT

packaging/test-release-packages.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if [[ -f "$SCRIPT_DIR/.env" ]]; then
99
fi
1010

1111
CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-docker}
12+
INSTALL_SCRIPT=${INSTALL_SCRIPT:-https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh}
1213

1314
APT_TARGETS=("ubuntu:18.04"
1415
"ubuntu:20.04"
@@ -26,7 +27,7 @@ do
2627
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
2728
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
2829
"$IMAGE" \
29-
sh -c "apt-get update && apt-get install -y sudo gpg curl;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
30+
sh -c "apt-get update && apt-get install -y sudo gpg curl;curl $INSTALL_SCRIPT | sh"
3031
done
3132

3233
for IMAGE in "${YUM_TARGETS[@]}"
@@ -36,5 +37,5 @@ do
3637
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
3738
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
3839
"$IMAGE" \
39-
sh -c "yum install -y curl sudo;curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh"
40+
sh -c "yum install -y curl sudo;curl $INSTALL_SCRIPT | sh"
4041
done

0 commit comments

Comments
 (0)