Skip to content

Commit 6afb283

Browse files
author
Tyler Titsworth
authored
add cache registry (#55)
1 parent 0897a01 commit 6afb283

File tree

7 files changed

+17
-7
lines changed

7 files changed

+17
-7
lines changed

.github/workflows/container-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ jobs:
189189
- name: Test Container Group
190190
uses: intel/ai-containers/test-runner@main
191191
with:
192+
cache_registry: ${{ secrets.CACHE_REGISTRY }}
192193
mlops_repo: ${{ secrets.MLOPS_REPO || github.repository }}
193194
mlops_ref: ${{ secrets.MLOPS_REF || github.ref }}
194195
recipe_dir: ${{ inputs.group_dir }}

.github/workflows/test-runner-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ jobs:
104104
- name: Test Container Group
105105
uses: intel/ai-containers/test-runner@main
106106
with:
107+
cache_registry: ${{ secrets.CACHE_REGISTRY }}
107108
mlops_repo: ${{ github.repository }}
108109
mlops_ref: ${{ github.ref }}
109110
recipe_dir: test-runner

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Define your project's registry and repository each time you use the project:
1717

1818
```bash
1919
# REGISTRY/REPO:TAG
20+
export CACHE_REGISTRY=<cache_registry_name>
2021
export REGISTRY=<registry_name>
2122
export REPO=<repo_name>
2223
```

test-runner/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ name: Integration Test
1616
description: 'https://github.com/intel/ai-containers/blob/main/test-runner/README.md'
1717
author: tyler.titsworth@intel.com
1818
inputs:
19+
cache_registry:
20+
description: 'Container Cache Registry URL'
21+
required: true
22+
type: string
1923
mlops_repo:
2024
description: 'Test Runner org/repo'
2125
required: true
@@ -63,6 +67,7 @@ runs:
6367
shell: bash
6468
run: venv/bin/python mlops/test-runner/test_runner.py -f ${{ inputs.test_dir }}/tests.yaml -l ${{ inputs.test_dir }}/logs -a ${{ inputs.recipe_dir }}/.actions.json -v
6569
env:
70+
CACHE_REGISTRY: ${{ inputs.cache_registry }}
6671
PYTHONPATH: mlops/test-runner
6772
REGISTRY: ${{ inputs.registry }}
6873
REPO: ${{ inputs.repo }}

test-runner/tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ test2:
3131
env:
3232
TEST: Hello
3333
test3:
34-
img: python:3.10-slim-bullseye # python 3.10
34+
img: ${CACHE_REGISTRY}/cache/library/python:3.10-slim-bullseye # python 3.10
3535
cmd: python --version # will return python 3.11
3636
serving: True
3737
test${TEST:-4}:
38-
img: python:3.11-slim-bullseye
38+
img: ${CACHE_REGISTRY}/cache/library/python:3.11-slim-bullseye
3939
cmd: echo "${TEST:-4}"
4040
test6:
41-
img: python:3.11-slim-bullseye
41+
img: ${CACHE_REGISTRY}/cache/library/python:3.11-slim-bullseye
4242
cmd: "echo 'hello: world'"
4343
mask:
4444
- hello

test-runner/tests/utest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import pytest
1919
import yaml
20+
from expandvars import expandvars
2021
from hypothesis import given
2122
from hypothesis.strategies import dictionaries, text
2223
from test_runner import get_test_list, parse_args, set_log_filename
@@ -124,20 +125,20 @@ def test_get_test_list(test_args_input, test_json_input):
124125
"env": {"TEST": "Hello"},
125126
},
126127
"test3": {
127-
"img": "python:3.10-slim-bullseye",
128+
"img": "${CACHE_REGISTRY}/cache/library/python:3.10-slim-bullseye",
128129
"cmd": "python --version",
129130
"serving": True,
130131
},
131132
"test4": {
132-
"img": "python:3.11-slim-bullseye",
133+
"img": f"{expandvars('${CACHE_REGISTRY}')}/cache/library/python:3.11-slim-bullseye",
133134
"cmd": 'echo "4"',
134135
},
135136
"test5": {
136-
"img": "python:3.11-slim-bullseye",
137+
"img": f"{expandvars('${CACHE_REGISTRY}')}/cache/library/python:3.11-slim-bullseye",
137138
"cmd": 'echo "5"',
138139
},
139140
"test6": {
140-
"img": "python:3.11-slim-bullseye",
141+
"img": "${CACHE_REGISTRY}/cache/library/python:3.11-slim-bullseye",
141142
"cmd": "echo 'hello: world'",
142143
"mask": ["hello"],
143144
},

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ commands =
1111
pythonpath = tests
1212
passenv = DOCKER_*
1313
setenv =
14+
CACHE_REGISTRY = {env:CACHE_REGISTRY}
1415
PATH = {env:PATH}:/usr/local/bin/docker
1516
PWD = {env:PWD}
1617
REGISTRY = {env:REGISTRY}

0 commit comments

Comments
 (0)