Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ The following inputs can be specified to override the default behavior
- default: `false`
* `pkgDir`: Path where archives (.deb and .rpm) reside
- default: `./dist`
* `destPrefix`: Prefix of the destination s3 path for downloading the artifacts
- default: `infrastructure_agent/`

##### Supported `distros`

Expand Down
3 changes: 3 additions & 0 deletions linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ COPY helper*.sh rpm-repos/*.repo ./
ARG STAGING_REPO=false
ENV STAGING_REPO=$STAGING_REPO

ARG DEST_PREFIX

# Run helper prepare. This adds the NR repo and installs the agent
RUN ./helper.sh prepare

Expand Down Expand Up @@ -41,4 +43,5 @@ RUN INTEGRATION=$INTEGRATION \
INSTALL_REPO=$INSTALL_REPO \
FAIL_REPO=$FAIL_REPO \
INSTALL_LOCAL=$INSTALL_LOCAL \
DEST_PREFIX=$DEST_PREFIX \
./helper.sh install
2 changes: 2 additions & 0 deletions linux/action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -o pipefail
[[ -n $DISTROS ]] || DISTROS="ubuntu:jammy ubuntu:focal ubuntu:bionic debian:bullseye debian:buster rockylinux:8 registry.suse.com/suse/sles12sp5:latest suse"
[[ -n $PKGDIR ]] || PKGDIR="./dist"
[[ -n $PACKAGE_LOCATION ]] || PACKAGE_LOCATION="local"
[[ -n $DEST_PREFIX ]] || DEST_PREFIX="infrastructure_agent/"

# Strip leading v from TAG and REPO_VERSION if present
TAG=${TAG/v/}
Expand Down Expand Up @@ -125,6 +126,7 @@ function build_and_test() {
--build-arg INSTALL_LOCAL="$install_local" \
--build-arg FAIL_REPO="$fail_repo" \
--build-arg STAGING_REPO="$STAGING_REPO" \
--build-arg DEST_PREFIX="$DEST_PREFIX" \
"$dockerdir"; then
echo "::endgroup::"
echo "❌ Install for $dockertag failed"
Expand Down
5 changes: 5 additions & 0 deletions linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ inputs:
description: 'Folder containing installer packages'
required: false
default: ""
destPrefix:
description: 'Prefix of the destination s3 path for downloading the artifacts'
required: false
default: "infrastructure_agent/"

runs:
using: "composite"
Expand All @@ -58,3 +62,4 @@ runs:
POST_INSTALL_EXTRA: ${{ inputs.postInstallExtra }}
DISTROS: ${{ inputs.distros }}
PKGDIR: ${{ inputs.pkgDir }}
DEST_PREFIX: ${{ inputs.destPrefix }}
12 changes: 12 additions & 0 deletions linux/helper_rockylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ add_repo() {
fi
cp "newrelic-infra-rockylinux${env}.repo" /etc/yum.repos.d/newrelic-infra.repo

if [ "$STAGING_REPO" = "true" ]; then
if [ "$DEST_PREFIX" != "infrastructure_agent/"]; then
sed -i "s|baseurl=http://nr-downloads-ohai-staging\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/linux/yum/el/__VERSION__/x86_64|baseurl=http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}linux/yum/el/__VERSION__/x86_64|" /etc/yum.repos.d/newrelic-infra.repo
# sed -i "s|gpgkey=http://nr-downloads-ohai-staging\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/gpg/newrelic-infra\.gpg|gpgkey=http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}gpg/newrelic-infra.gpg|" /etc/yum.repos.d/newrelic-infra.repo
fi
else
if [ "$DEST_PREFIX" != "infrastructure_agent/"]; then
sed -i "s|baseurl=http://nr-downloads-main\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/linux/yum/el/__VERSION__/x86_64|baseurl=http://nr-downloads-main.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}linux/yum/el/__VERSION__/x86_64|" /etc/yum.repos.d/newrelic-infra.repo
# sed -i "s|gpgkey=http://nr-downloads-main\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/gpg/newrelic-infra.gpg|gpgkey=http://nr-downloads-main.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}gpg/newrelic-infra.gpg|" /etc/yum.repos.d/newrelic-infra.repo
fi
fi

# Get rockylinux version from docker tag, assuming it has a `:[0-9]` format
version=${BASE_IMAGE##*:}
sed -i "s/__VERSION__/$version/" /etc/yum.repos.d/newrelic-infra.repo
Expand Down
11 changes: 11 additions & 0 deletions linux/helper_suse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ add_repo() {

cp "newrelic-infra-suse${env}.repo" tmp.repo
sed -e "s/__VERSION__/$VERSION_ID/g" tmp.repo > /etc/zypp/repos.d/newrelic-infra.repo
if [ "$STAGING_REPO" = "true" ]; then
if [ "$DEST_PREFIX" != "infrastructure_agent/"]; then
sed -i "s|baseurl=http://nr-downloads-ohai-staging\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/linux/zypp/sles/__VERSION__/x86_64|baseurl=http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}linux/zypp/sles/__VERSION__/x86_64|" /etc/zypp/repos.d/newrelic-infra.repo
# sed -i "s|gpgkey=http://download\.newrelic\.com/infrastructure_agent/gpg/newrelic-infra\.gpg|gpgkey=http://download.newrelic.com/${DEST_PREFIX}gpg/newrelic-infra.gpg|" /etc/zypp/repos.d/newrelic-infra.repo
fi
else
if [ "$DEST_PREFIX" != "infrastructure_agent/"]; then
sed -i "s|baseurl=http://nr-downloads-main\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/linux/zypp/sles/__VERSION__/x86_64|baseurl=http://nr-downloads-main.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}linux/zypp/sles/__VERSION__/x86_64|" /etc/zypp/repos.d/newrelic-infra.repo
# sed -i "s|gpgkey=http://nr-downloads-main\.s3-website-us-east-1\.amazonaws\.com/infrastructure_agent/gpg/newrelic-infra.gpg|gpgkey=http://nr-downloads-main.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}gpg/newrelic-infra.gpg|" /etc/zypp/repos.d/newrelic-infra.repo
fi
fi
zypper --gpg-auto-import-keys ref
}

Expand Down
10 changes: 9 additions & 1 deletion linux/helper_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ add_repo() {

apt update && apt -y install wget gnupg
if [ "$STAGING_REPO" = "true" ]; then
repo="http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent/linux/apt"
echo "staginRepo is true"
if [ "$DEST_PREFIX" != "infrastructure_agent/" ]; then
echo "destPrefix is not infrastructure_agent/ it is $DEST_PREFIX"
repo="http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/${DEST_PREFIX}linux/apt"
else
echo "destPrefix is $DEST_PREFIX"
repo="http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent/linux/apt"
fi
else
echo "staginRepo is false"
repo="http://nr-downloads-main.s3-website-us-east-1.amazonaws.com/infrastructure_agent/linux/apt"
fi

Expand Down