Skip to content

Commit 4422b95

Browse files
authored
Fix CI Image Tagging (#838)
* Correct templated CI image name * Pin pypy2.7 in image * Fix up scripting
1 parent ab92daf commit 4422b95

File tree

5 files changed

+19
-31
lines changed

5 files changed

+19
-31
lines changed

.github/containers/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ RUN echo 'eval "$(pyenv init -)"' >>$HOME/.bashrc && \
7474
pyenv update
7575

7676
# Install Python
77-
ARG PYTHON_VERSIONS="3.10 3.9 3.8 3.7 3.11 2.7 pypy2.7 pypy3.7"
77+
ARG PYTHON_VERSIONS="3.10 3.9 3.8 3.7 3.11 2.7 pypy2.7-7.3.11 pypy3.7"
7878
COPY --chown=1000:1000 --chmod=+x ./install-python.sh /tmp/install-python.sh
7979
COPY ./requirements.txt /requirements.txt
8080
RUN /tmp/install-python.sh && \

.github/containers/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
# limitations under the License.
1414

1515
# Repository root for mounting into container.
16-
REPO_ROOT:=$(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST))))../../)
16+
MAKEFILE_DIR:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
17+
REPO_ROOT:=$(realpath $(MAKEFILE_DIR)../../)
1718

1819
.PHONY: default
1920
default: test
2021

2122
.PHONY: build
2223
build:
2324
@# Perform a shortened build for testing
24-
@docker build --build-arg='PYTHON_VERSIONS=3.10 2.7' . -t ghcr.io/newrelic/python-agent-ci:local
25+
@docker build --build-arg='PYTHON_VERSIONS=3.10 2.7' $(MAKEFILE_DIR) -t ghcr.io/newrelic/newrelic-python-agent-ci:local
2526

2627
.PHONY: test
2728
test: build
@@ -40,4 +41,4 @@ run: build
4041
-e NEW_RELIC_HOST="${NEW_RELIC_HOST}" \
4142
-e NEW_RELIC_LICENSE_KEY="${NEW_RELIC_LICENSE_KEY}" \
4243
-e NEW_RELIC_DEVELOPER_MODE="${NEW_RELIC_DEVELOPER_MODE}" \
43-
ghcr.io/newrelic/python-agent-ci:local /bin/bash
44+
ghcr.io/newrelic/newrelic-python-agent-ci:local /bin/bash

.github/containers/install-python.sh

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
set -e
1717

18-
SED=$(which gsed || which sed)
19-
2018
SCRIPT_DIR=$(dirname "$0")
2119
PIP_REQUIREMENTS=$(cat /requirements.txt)
2220

@@ -34,7 +32,7 @@ main() {
3432
# Find all latest pyenv supported versions for requested python versions
3533
PYENV_VERSIONS=()
3634
for v in "${PYTHON_VERSIONS[@]}"; do
37-
LATEST=$(pyenv latest -k "$v" || get_latest_patch_version "$v")
35+
LATEST=$(pyenv latest -k "$v" || pyenv latest -k "$v-dev")
3836
if [[ -z "$LATEST" ]]; then
3937
echo "Latest version could not be found for ${v}." 1>&2
4038
exit 1
@@ -55,15 +53,4 @@ main() {
5553
pyenv exec pip install --upgrade $PIP_REQUIREMENTS
5654
}
5755

58-
get_latest_patch_version() {
59-
pyenv install --list | # Get all python versions
60-
$SED 's/^ *//g' | # Remove leading whitespace
61-
grep -E "^$1" | # Find specified version by matching start of line
62-
grep -v -- "-c-jit-latest" | # Filter out pypy JIT versions
63-
$SED -E '/(-[a-zA-Z]+$)|(a[0-9]+)|(b[0-9]+)|(rc[0-9]+)/!{s/$/_/}' | # Append trailing _ to any non development versions to place them lower when sorted
64-
sort -V | # Sort using version sorting
65-
$SED 's/_$//' | # Remove any added trailing underscores to correct version names
66-
tail -1 # Grab last result as latest version
67-
}
68-
6956
main

.github/workflows/build-ci-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
id: meta
4040
uses: docker/metadata-action@v4
4141
with:
42-
images: ghcr.io/${{ github.repository }}
42+
images: ghcr.io/${{ github.repository }}-ci
4343
flavor: |
4444
prefix=
4545
suffix=

.github/workflows/tests.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117

118118
runs-on: ubuntu-20.04
119119
container:
120-
image: ghcr.io/newrelic/python-agent-ci:latest
120+
image: ghcr.io/${{ github.repository }}-ci
121121
timeout-minutes: 30
122122

123123
steps:
@@ -155,7 +155,7 @@ jobs:
155155

156156
runs-on: ubuntu-20.04
157157
container:
158-
image: ghcr.io/newrelic/python-agent-ci:latest
158+
image: ghcr.io/${{ github.repository }}-ci
159159
timeout-minutes: 30
160160

161161
steps:
@@ -193,7 +193,7 @@ jobs:
193193

194194
runs-on: ubuntu-20.04
195195
container:
196-
image: ghcr.io/newrelic/python-agent-ci:latest
196+
image: ghcr.io/${{ github.repository }}-ci
197197
timeout-minutes: 30
198198

199199
services:
@@ -246,7 +246,7 @@ jobs:
246246

247247
runs-on: ubuntu-20.04
248248
container:
249-
image: ghcr.io/newrelic/python-agent-ci:latest
249+
image: ghcr.io/${{ github.repository }}-ci
250250
timeout-minutes: 30
251251

252252
services:
@@ -302,7 +302,7 @@ jobs:
302302

303303
runs-on: ubuntu-20.04
304304
container:
305-
image: ghcr.io/newrelic/python-agent-ci:latest
305+
image: ghcr.io/${{ github.repository }}-ci
306306
timeout-minutes: 30
307307

308308
services:
@@ -353,7 +353,7 @@ jobs:
353353

354354
runs-on: ubuntu-20.04
355355
container:
356-
image: ghcr.io/newrelic/python-agent-ci:latest
356+
image: ghcr.io/${{ github.repository }}-ci
357357
timeout-minutes: 30
358358

359359
services:
@@ -406,7 +406,7 @@ jobs:
406406

407407
runs-on: ubuntu-20.04
408408
container:
409-
image: ghcr.io/newrelic/python-agent-ci:latest
409+
image: ghcr.io/${{ github.repository }}-ci
410410
timeout-minutes: 30
411411

412412
services:
@@ -457,7 +457,7 @@ jobs:
457457

458458
runs-on: ubuntu-20.04
459459
container:
460-
image: ghcr.io/newrelic/python-agent-ci:latest
460+
image: ghcr.io/${{ github.repository }}-ci
461461
timeout-minutes: 30
462462

463463
services:
@@ -581,7 +581,7 @@ jobs:
581581

582582
runs-on: ubuntu-20.04
583583
container:
584-
image: ghcr.io/newrelic/python-agent-ci:latest
584+
image: ghcr.io/${{ github.repository }}-ci
585585
timeout-minutes: 30
586586

587587
services:
@@ -632,7 +632,7 @@ jobs:
632632

633633
runs-on: ubuntu-20.04
634634
container:
635-
image: ghcr.io/newrelic/python-agent-ci:latest
635+
image: ghcr.io/${{ github.repository }}-ci
636636
timeout-minutes: 30
637637

638638
services:
@@ -685,7 +685,7 @@ jobs:
685685

686686
runs-on: ubuntu-20.04
687687
container:
688-
image: ghcr.io/newrelic/python-agent-ci:latest
688+
image: ghcr.io/${{ github.repository }}-ci
689689
timeout-minutes: 30
690690

691691
services:
@@ -739,7 +739,7 @@ jobs:
739739

740740
runs-on: ubuntu-20.04
741741
container:
742-
image: ghcr.io/newrelic/python-agent-ci:latest
742+
image: ghcr.io/${{ github.repository }}-ci
743743
timeout-minutes: 30
744744

745745
services:

0 commit comments

Comments
 (0)