Skip to content

Commit

Permalink
Merge cae5004 into fc85454
Browse files Browse the repository at this point in the history
  • Loading branch information
midnightercz committed Oct 7, 2021
2 parents fc85454 + cae5004 commit 159fbf1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions legacy.constraints
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# These constraints are applied during testing with python2.
# Old versions of libraries can be added here if you want to
# ensure pubtools-quay works with those.
PyYAML < 5.1
jsonschema==2.3.0
pluggy==0.5.2

# For compatibility with old pluggy
pytest-cov<2
10 changes: 10 additions & 0 deletions pubtools/iib/iib_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@
"required": False,
"type": bool,
},
("--build-tag",): {
"group": "IIB service",
"help": "extra tags to apply on built index image in temp namespace",
"required": False,
"type": str,
"action": "append",
},
}

ADD_CMD_ARGS = CMD_ARGS.copy()
Expand Down Expand Up @@ -237,6 +244,9 @@ def _iib_op_main(args, operation=None, items_final_state="PUSHED"):
if args.overwrite_from_index_token:
extra_args["overwrite_from_index_token"] = args.overwrite_from_index_token

if args.build_tag:
extra_args["build_tags"] = args.build_tag

build_details = bundle_op(
args.index_image,
args.bundle if operation == "add_bundles" else args.operator,
Expand Down
12 changes: 12 additions & 0 deletions tests/test_iib_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def fixture_common_iib_op_args():
"example@REALM",
"--iib-insecure",
"--overwrite-from-index",
"--build-tag",
"extra-tag-1",
"--build-tag",
"extra-tag-2",
]


Expand All @@ -174,6 +178,7 @@ def add_bundles_mock_calls_tester(
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
deprecation_list=["bundle1"],
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_iib_client.assert_called_once_with(
"iib-server", auth=fixture_iib_krb_auth.return_value, ssl_verify=False
Expand All @@ -198,6 +203,7 @@ def add_bundles_mock_calls_tester_empty_deprecation_list(
binary_image="binary-image",
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_iib_client.assert_called_once_with(
"iib-server", auth=fixture_iib_krb_auth.return_value, ssl_verify=False
Expand All @@ -223,6 +229,7 @@ def add_bundles_mock_calls_tester_deprecation_bundles(
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
deprecation_list=["bundle1", "bundle2"],
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_iib_client.assert_called_once_with(
"iib-server", auth=fixture_iib_krb_auth.return_value, ssl_verify=False
Expand All @@ -247,6 +254,7 @@ def add_bundles_mock_calls_tester_not_called(
binary_image="binary-image",
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_iib_client.assert_called_once_with(
"iib-server", auth=fixture_iib_krb_auth.return_value, ssl_verify=False
Expand All @@ -271,6 +279,7 @@ def remove_operators_mock_calls_tester_not_called(
binary_image="binary-image",
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_pulplib_repo_sync.assert_not_called()
fixture_pulplib_repo_publish.assert_not_called()
Expand All @@ -292,6 +301,7 @@ def remove_operators_mock_calls_tester(
binary_image="binary-image",
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_pulplib_repo_sync.assert_called_once()
assert fixture_pulplib_repo_sync.mock_calls[0].args[0].feed == "https://feed.com"
Expand Down Expand Up @@ -451,6 +461,7 @@ def test_add_bundles_py(
binary_image="binary-image",
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_pulplib_repo_sync.assert_called_once()
assert fixture_pulplib_repo_sync.mock_calls[0].args[0].feed == "https://feed.com"
Expand Down Expand Up @@ -508,6 +519,7 @@ def test_add_bundles_py_multiple_bundles(
binary_image="binary-image",
overwrite_from_index=True,
overwrite_from_index_token="overwrite_from_index_token",
build_tags=["extra-tag-1", "extra-tag-2"],
)
fixture_pulplib_repo_sync.assert_called_once()
assert fixture_pulplib_repo_sync.mock_calls[0].args[0].feed == "https://feed.com"
Expand Down
1 change: 1 addition & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def setup_task(
state_seq=("in_progress", "finished"),
op_type="add",
deprecation_list=None,
build_tags=None,
):
tid = self._gen_task_id()
self.task_state_seq[tid] = list(state_seq)
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,setup.py,docs
[testenv:py27]
deps=
{[py]deps}
-c legacy.constraints
basepython = python2.7
commands = python -m pytest -v --cov=pubtools --cov-report=html

Expand Down

0 comments on commit 159fbf1

Please sign in to comment.