Skip to content

Commit f08f524

Browse files
chore: revert templates id changes (#3310)
1 parent e5df1fa commit f08f524

File tree

9 files changed

+65
-63
lines changed

9 files changed

+65
-63
lines changed

.github/workflows/test_deploy.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
env:
1010
DEPENDENCY_CACHE_PREFIX: "v2"
1111
NETWORK_CACHE_PREFIX: "v1"
12-
TEMPLATES_VERSION: "0.4.1" # To create a new cache key when only templates are updated
1312
jobs:
1413
set-matrix:
1514
runs-on: ubuntu-latest
@@ -62,7 +61,7 @@ jobs:
6261
path: |
6362
${{ env.pythonLocation }}
6463
renku/templates
65-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
64+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
6665
- name: Install dependencies
6766
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
6867
env:
@@ -114,7 +113,7 @@ jobs:
114113
path: |
115114
${{ env.pythonLocation }}
116115
renku/templates
117-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
116+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
118117
- name: Install dependencies
119118
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
120119
env:
@@ -159,7 +158,7 @@ jobs:
159158
path: |
160159
${{ env.pythonLocation }}
161160
renku/templates
162-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
161+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
163162
- name: Install dependencies
164163
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
165164
env:
@@ -202,7 +201,7 @@ jobs:
202201
path: |
203202
${{ env.pythonLocation }}
204203
renku/templates
205-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
204+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
206205
- name: Install dependencies
207206
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
208207
run: |
@@ -249,7 +248,7 @@ jobs:
249248
path: |
250249
${{ env.pythonLocation }}
251250
renku/templates
252-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
251+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
253252
- name: Install dependencies
254253
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
255254
env:
@@ -320,7 +319,7 @@ jobs:
320319
path: |
321320
${{ env.pythonLocation }}
322321
renku/templates
323-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
322+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
324323
- name: Install dependencies
325324
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
326325
env:
@@ -397,7 +396,7 @@ jobs:
397396
path: |
398397
${{ env.pythonLocation }}
399398
renku/templates
400-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
399+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
401400
- name: Install dependencies
402401
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
403402
env:
@@ -474,7 +473,7 @@ jobs:
474473
path: |
475474
${{ env.pythonLocation }}
476475
renku/templates
477-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
476+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
478477
- name: Install dependencies
479478
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
480479
env:
@@ -710,7 +709,7 @@ jobs:
710709
path: |
711710
${{ env.pythonLocation }}
712711
renku/templates
713-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
712+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
714713
- name: Install dependencies
715714
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
716715
env:
@@ -807,7 +806,7 @@ jobs:
807806
path: |
808807
${{ env.pythonLocation }}
809808
renku/templates
810-
key: ${{ env.DEPENDENCY_CACHE_PREFIX }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('Makefile') }}-${{ env.TEMPLATES_VERSION }}
809+
key: ${{env.DEPENDENCY_CACHE_PREFIX}}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{hashFiles('poetry.lock')}}-${{hashFiles('Makefile')}}
811810
- name: Install dependencies
812811
if: steps.dependency-cache.outputs.cache-hit != 'true' || 'refs/heads/master' == github.ref || 'refs/heads/develop' == github.ref || startsWith(github.ref, 'refs/tags/')
813812
env:

renku/ui/cli/init.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
... OK
7070
7171
INDEX ID DESCRIPTION PARAMETERS
72-
----- ------ -------------------------- ----------------------
73-
1 python Basic Python Project:[...] description: proj[...]
74-
2 R Basic R Project: The [...] description: proj[...]
72+
----- -------------- -------------------------- ----------------------
73+
1 python-minimal Basic Python Project:[...] description: proj[...]
74+
2 R-minimal Basic R Project: The [...] description: proj[...]
7575
7676
Please choose a template by typing the index:
7777
@@ -86,7 +86,7 @@
8686
8787
.. code-block:: console
8888
89-
$ renku init --template-id python --parameter \
89+
$ renku init --template-id python-minimal --parameter \
9090
"description"="my new shiny project"
9191
9292
Initializing new Renku repository... OK
@@ -113,7 +113,7 @@
113113
"@type": "https://schema.org/Organization", \
114114
"https://schema.org/legalName": "ETHZ"}' > metadata.json
115115
116-
$ renku init --template-id python --parameter \
116+
$ renku init --template-id python-minimal --parameter \
117117
"description"="my new shiny project" --metadata metadata.json
118118
119119
Initializing new Renku repository... OK
@@ -136,13 +136,13 @@
136136
$ echo "FROM python:3.7-alpine" > Dockerfile
137137
$ renku init
138138
139-
INDEX ID PARAMETERS
140-
------- --------- ------------
141-
1 python description
142-
2 R description
143-
3 bioc description
144-
4 julia description
145-
5 minimal
139+
INDEX ID PARAMETERS
140+
------- -------------- ------------
141+
1 python-minimal description
142+
2 R-minimal description
143+
3 bioc-minimal description
144+
4 julia-minimal description
145+
5 minimal
146146
Please choose a template by typing the index: 1
147147
The template requires a value for "description": Test Project
148148
Initializing Git repository...

tests/cli/test_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def test_template_selection_helpers(isolated_runner):
6767

6868
assert "Please choose a template by typing its index:" in stripped_output
6969

70-
assert "1 python" in stripped_output
71-
assert "2 R" in stripped_output
70+
assert "1 python-minimal" in stripped_output
71+
assert "2 R-minimal" in stripped_output
7272

7373

7474
def test_init(isolated_runner, project_init):

tests/cli/test_migrate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_migrations_runs(isolated_runner, old_project):
142142
assert "Successfully applied" in result.output
143143
assert "OK" in result.output
144144

145-
result = isolated_runner.invoke(cli, ["migrate", "--skip-template-update"])
145+
result = isolated_runner.invoke(cli, ["migrate"])
146146
assert 0 == result.exit_code, format_result_exception(result)
147147
assert "No migrations required." in result.output
148148

tests/cli/test_template.py

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_template_list(isolated_runner):
4646
result = isolated_runner.invoke(cli, command, replace_argv=False)
4747

4848
assert 0 == result.exit_code, format_result_exception(result)
49-
assert "python" in result.output
49+
assert "python-minimal" in result.output
5050
finally:
5151
sys.argv = argv
5252

@@ -62,14 +62,14 @@ def test_template_list_from_source(isolated_runner):
6262
result = isolated_runner.invoke(cli, command + ["--source", TEMPLATES_URL])
6363

6464
assert 0 == result.exit_code, format_result_exception(result)
65-
assert "python" in result.output
66-
assert "julia" in result.output
65+
assert "python-minimal" in result.output
66+
assert "julia-minimal" in result.output
6767

6868
result = isolated_runner.invoke(cli, command + ["-s", TEMPLATES_URL, "--reference", "0.3.2"])
6969

7070
assert 0 == result.exit_code, format_result_exception(result)
71-
assert "python" in result.output
72-
assert "julia" in result.output
71+
assert "python-minimal" in result.output
72+
assert "julia-minimal" in result.output
7373
finally:
7474
sys.argv = argv
7575

@@ -81,7 +81,7 @@ def test_template_show(isolated_runner):
8181
sys.argv = command
8282

8383
try:
84-
result = isolated_runner.invoke(cli, command + ["R"])
84+
result = isolated_runner.invoke(cli, command + ["R-minimal"])
8585

8686
assert 0 == result.exit_code, format_result_exception(result)
8787
assert re.search("^Name: Basic R (.*) Project$", result.output, re.MULTILINE) is not None
@@ -135,18 +135,18 @@ def test_template_set_failure(runner, project, with_injection):
135135
assert 1 == result.exit_code, format_result_exception(result)
136136
assert "Project already has a template" in result.output
137137
with with_injection():
138-
assert "python" == project_context.project.template_metadata.template_id
138+
assert "python-minimal" == project_context.project.template_metadata.template_id
139139

140140

141141
def test_template_set(runner, project, with_injection):
142142
"""Test setting a new template in a project."""
143143
from renku.version import __template_version__
144144

145-
result = runner.invoke(cli, ["template", "set", "--force", "R"])
145+
result = runner.invoke(cli, ["template", "set", "--force", "R-minimal"])
146146

147147
assert 0 == result.exit_code, format_result_exception(result)
148148
with with_injection():
149-
assert "R" == project_context.project.template_metadata.template_id
149+
assert "R-minimal" == project_context.project.template_metadata.template_id
150150
assert __template_version__ == project_context.project.template_metadata.template_version
151151
assert __template_version__ == project_context.project.template_metadata.template_ref
152152

@@ -158,11 +158,11 @@ def test_template_set_overwrites_modified(runner, project, with_injection):
158158
"""Test setting a new template in a project overwrite modified files."""
159159
write_and_commit_file(project.repository, "Dockerfile", "my-modifications")
160160

161-
result = runner.invoke(cli, ["template", "set", "--force", "R"])
161+
result = runner.invoke(cli, ["template", "set", "--force", "R-minimal"])
162162

163163
assert 0 == result.exit_code, format_result_exception(result)
164164
with with_injection():
165-
assert "R" == project_context.project.template_metadata.template_id
165+
assert "R-minimal" == project_context.project.template_metadata.template_id
166166
assert "my-modifications" not in (project.path / "Dockerfile").read_text()
167167
assert not project.repository.is_dirty(untracked_files=True)
168168

@@ -172,11 +172,11 @@ def test_template_set_interactive(runner, project, with_injection, overwrite, fo
172172
"""Test setting a template in interactive mode."""
173173
write_and_commit_file(project.repository, "Dockerfile", "my-modifications")
174174

175-
result = runner.invoke(cli, ["template", "set", "-f", "R", "-i"], input=f"{overwrite}\n" * 420)
175+
result = runner.invoke(cli, ["template", "set", "-f", "R-minimal", "-i"], input=f"{overwrite}\n" * 420)
176176

177177
assert 0 == result.exit_code, format_result_exception(result)
178178
with with_injection():
179-
assert "R" == project_context.project.template_metadata.template_id
179+
assert "R-minimal" == project_context.project.template_metadata.template_id
180180
assert ("my-modifications" in (project.path / "Dockerfile").read_text()) is found
181181
assert not project.repository.is_dirty(untracked_files=True)
182182

@@ -187,7 +187,7 @@ def test_template_set_preserve_renku_version(runner, project):
187187
new_content = re.sub(r"^\s*ARG RENKU_VERSION=(.+)$", "ARG RENKU_VERSION=0.0.42", content, flags=re.MULTILINE)
188188
write_and_commit_file(project.repository, "Dockerfile", new_content)
189189

190-
result = runner.invoke(cli, ["template", "set", "-f", "R", "--interactive"], input="y\n" * 420)
190+
result = runner.invoke(cli, ["template", "set", "-f", "R-minimal", "--interactive"], input="y\n" * 420)
191191

192192
assert 0 == result.exit_code, format_result_exception(result)
193193

@@ -212,7 +212,7 @@ def test_template_set_uses_renku_version_when_non_existing(tmpdir, runner):
212212

213213
assert "RENKU_VERSION" not in project_context.docker_path.read_text()
214214

215-
assert 0 == runner.invoke(cli, ["template", "set", "python"]).exit_code
215+
assert 0 == runner.invoke(cli, ["template", "set", "python-minimal"]).exit_code
216216

217217
assert f"RENKU_VERSION={__version__}" in project_context.docker_path.read_text()
218218

@@ -221,7 +221,7 @@ def test_template_set_dry_run(runner, project):
221221
"""Test set dry-run doesn't make any changes."""
222222
commit_sha_before = project.repository.head.commit.hexsha
223223

224-
result = runner.invoke(cli, ["template", "set", "-f", "R", "--dry-run"])
224+
result = runner.invoke(cli, ["template", "set", "-f", "R-minimal", "--dry-run"])
225225

226226
assert 0 == result.exit_code, format_result_exception(result)
227227
assert not project.repository.is_dirty()
@@ -232,23 +232,25 @@ def test_template_set_dry_run(runner, project):
232232
def test_template_update(runner, project, with_injection):
233233
"""Test updating a template."""
234234
result = runner.invoke(
235-
cli, ["template", "set", "-f", "python", "-s", TEMPLATES_URL, "-r", "0.4.0", "-p", "description=fixed-version"]
235+
cli,
236+
["template", "set", "-f", "python-minimal", "-s", TEMPLATES_URL, "-r", "0.3.2"]
237+
+ ["-p", "description=fixed-version"],
236238
)
237239

238240
assert 0 == result.exit_code, format_result_exception(result)
239241
with with_injection():
240-
assert "python" == project_context.project.template_metadata.template_id
241-
assert "0.4.0" == project_context.project.template_metadata.template_ref
242-
assert "5df0ae30086e6ac46ff2b1cc038f3e2dfcf74962" == project_context.project.template_metadata.template_version
242+
assert "python-minimal" == project_context.project.template_metadata.template_id
243+
assert "0.3.2" == project_context.project.template_metadata.template_ref
244+
assert "b9ab266fba136bdecfa91dc8d7b6d36b9d427012" == project_context.project.template_metadata.template_version
243245

244246
result = runner.invoke(cli, ["template", "update"])
245247

246248
assert 0 == result.exit_code, format_result_exception(result)
247249
assert "Template is up-to-date" not in result.output
248250
with with_injection():
249-
assert "python" == project_context.project.template_metadata.template_id
250-
assert Version(project_context.project.template_metadata.template_ref) > Version("0.4.0")
251-
assert "5df0ae30086e6ac46ff2b1cc038f3e2dfcf74962" != project_context.project.template_metadata.template_version
251+
assert "python-minimal" == project_context.project.template_metadata.template_id
252+
assert Version(project_context.project.template_metadata.template_ref) > Version("0.3.2")
253+
assert "6c59d8863841baeca8f30062fd16c650cf67da3b" != project_context.project.template_metadata.template_version
252254

253255
result = runner.invoke(cli, ["template", "update"])
254256

@@ -282,7 +284,8 @@ def test_template_update_dry_run(runner, project):
282284
"""Test update dry-run doesn't make any changes."""
283285
result = runner.invoke(
284286
cli,
285-
["template", "set", "-f", "python", "-s", TEMPLATES_URL, "-r", "0.4.0", "-p", "description=fixed-version"],
287+
["template", "set", "-f", "python-minimal", "-s", TEMPLATES_URL, "-r", "0.3.2"]
288+
+ ["-p", "description=fixed-version"],
286289
)
287290

288291
assert 0 == result.exit_code, format_result_exception(result)

0 commit comments

Comments
 (0)