Skip to content

Commit 9ed1136

Browse files
authored
fix: use Python 3 for Ubuntu 16.04 to support systemctl3.py (#44)
* fix: use Python 3 for Ubuntu 16.04 to support systemctl3.py * fix: add python3-apt and symlink python3 to python for Ansible compatibility * fix: force ubuntu1604 to build from Dockerfile instead of using pre-built image * fix: install Python 3.6 from deadsnakes PPA for Ansible compatibility * fix: use local image name for ubuntu1604 when building from Dockerfile * fix: use Ubuntu 18.04 base image for ubuntu1604 platform (16.04 EOL) * fix: add gnupg package for GPG key handling * docs: update README and testing workflow
1 parent 700909b commit 9ed1136

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
with:
2121
repo_base_url: 'https://download.newrelic.com/infrastructure_agent'
2222
package_name: 'newrelic-infra'
23-
package_version: '1.71.0'
23+
package_version: '1.72.0'
2424
gpg_key: 'https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg'
2525
platforms: "al2,al2023,centos7,centos8,debian-bullseye,debian-trixie,redhat8,redhat9,redhat10,suse15.2,suse15.3,suse15.4,suse15.5,suse15.6,suse15.7,ubuntu1604,ubuntu1804,ubuntu2004,ubuntu2204,ubuntu2404"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
repo_base_url: 'http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent'
5959
package_name: 'newrelic-infra'
60-
package_version: '1.71.0'
60+
package_version: '1.72.0'
6161
gpg_key: 'https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg'
6262
platforms: "al2,al2022,centos7,centos8,debian-bullseye,redhat8,redhat9,suse15.2,suse15.3,suse15.4,suse15.5,suse15.6,suse15.7,ubuntu1604,ubuntu1804,ubuntu2004,ubuntu2204"
6363
```

molecule/default/dockerfiles/ubuntu1604

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:18.04
22

33
RUN apt-get update \
4-
&& apt-get install -y init ca-certificates sudo curl apt-transport-https python-minimal\
4+
&& apt-get install -y init ca-certificates sudo curl apt-transport-https python3 gnupg \
5+
&& ln -sf /usr/bin/python3 /usr/bin/python \
56
&& apt-get clean all
67

7-
# Adding fake systemctl
8+
# Adding fake systemctl (requires Python 3.6+)
89
RUN curl https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -o /bin/systemctl
910

1011
RUN chmod +x /bin/systemctl

prepare_platform.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,16 @@ set_platforms_config() {
5959
\"name\": \"$PLATFORM\",
6060
\"privileged\": true}]" $FILE_PATH
6161

62-
if [[ ! -z "${IS_TESTING}" ]]; then
62+
# ubuntu1604 needs to build from Dockerfile to use Python 3.6
63+
if [[ $PLATFORM == "ubuntu1604" ]]; then
64+
yq -i ".platforms[] |= select(.name == \"$PLATFORM\") += {\"image\":\"$PLATFORM\", \"dockerfile\": \"./dockerfiles/$PLATFORM\"}" $FILE_PATH
65+
elif [[ ! -z "${IS_TESTING}" ]]; then
6366
yq -i ".platforms[] |= select(.name == \"$PLATFORM\") += {\"image\":\"$PLATFORM\", \"dockerfile\": \"./dockerfiles/$PLATFORM\"}" $FILE_PATH
6467
else
6568
yq -i ".platforms[] |= select(.name == \"$PLATFORM\") += {\"image\":\"ghcr.io/newrelic/pkg-installation-testing-action-$PLATFORM\"}" $FILE_PATH
6669

6770
# Prevent molecule to install extra tools in the pre-build image
6871
# https://ansible.readthedocs.io/projects/molecule/guides/custom-image/
69-
# ubuntu16 python 2 installation was being corrupted by this behaivor.
70-
if [[ $PLATFORM == "ubuntu1604" ]]; then
71-
yq -i ".platforms[] |= select(.name == \"$PLATFORM\") += {\"pre_build_image\": true}" $FILE_PATH
72-
fi
7372
fi
7473

7574
# debian based distributions need to set up the init command
@@ -78,7 +77,7 @@ set_platforms_config() {
7877
fi
7978

8079
# set python interpreter groups
81-
if [[ $PLATFORM == "al2" || $PLATFORM == "centos7" || $PLATFORM == "ubuntu1604" ]]; then
80+
if [[ $PLATFORM == "al2" || $PLATFORM == "centos7" ]]; then
8281
yq -i ".platforms[] |= select(.name == \"$PLATFORM\") += {\"groups\": [\"python\"]}" $FILE_PATH
8382
else
8483
yq -i ".platforms[] |= select(.name == \"$PLATFORM\") += {\"groups\": [\"python3\"]}" $FILE_PATH

0 commit comments

Comments
 (0)