Commit graph

93 commits

Author SHA1 Message Date
Yu Ming Zhu
47c4b5d70b kojid: extend SCM.assert_allowed with hub policy
This is a simple extention of `SCM.assert_allowed`

- `assert_allowed_by_policy` will set the default "use_common" to False which is different to the old behavior
- `channel`, `user_id`, `scratch` are passed in the `policy_data` with scminfo right now.

This is a prototype for this change, and there are some other solutions could be implemented too

- Use a scmpolicy plugin as `postSCMCheckout` callback, the pro is that we can do more checks after the source is initialized on builder, meanwhile, the con is that the source will be downloaded even it is denied by policy. It might be a potential risk?
- Do the scm check in hub's `make_task`, this looks straightforward, but may lack some builder's information

fixes: #2757
2021-08-16 17:55:26 +00:00
Tomas Kopecek
ef3e2cd04b lib: use parse_task_params for taskLabel
Fixes: https://pagure.io/koji/issue/2519
2021-04-26 14:43:20 +02:00
Tomas Kopecek
db1110a5b9 fix flake8 issues 2020-06-05 10:58:38 +02:00
Tomas Kopecek
3d698be2a7 use downloadFile for localPath and openRemoteFile 2020-06-05 10:58:38 +02:00
Tomas Kopecek
0132313f92 replace logging.warn with warning
call is deprected in python 3.7

Fixes: https://pagure.io/koji/issue/2135
2020-04-22 13:47:15 +02:00
Yuming Zhu
cf34706f04 use Exception instead of BaseException for bare expection 2020-03-03 21:38:22 +08:00
Yuming Zhu
2a2c5cb729 flake8: apply W rules (prefering W503) 2020-03-03 21:38:22 +08:00
Yuming Zhu
c5db34a8e1 flake8: apply E501 with max-line-length=99 2020-03-03 21:38:22 +08:00
Yuming Zhu
f1ba6cefd7 flake8: apply all rest E7 rules 2020-03-03 21:38:22 +08:00
Yuming Zhu
0f727a2ab4 flake8: apply E3 rules 2020-03-03 21:38:22 +08:00
Yuming Zhu
05340b146b flake8: apply E2 rules except E266 2020-03-03 21:38:21 +08:00
Yuming Zhu
ce1f9928af flake8: apply E1 rules 2020-03-03 21:38:21 +08:00
Yuming Zhu
97cfaa4fcf flake8: follow E265 rule 2020-03-03 21:35:08 +08:00
Tomas Kopecek
d6f2db6325 fix potentially undeclared variable error
Fixes: https://pagure.io/koji/issue/1957
2020-02-18 11:54:11 +01:00
Miro Hrončok
388bb070f1 Always use stream=True when iterating over a request
Fixes https://pagure.io/releng/issue/9226
2020-02-12 10:42:12 +01:00
Yuming Zhu
666111575b do not use with statement with requests.get
fixes: #1530
2019-12-23 10:00:21 +01:00
Yu Ming Zhu
5b83c682e4 remove unused imports 2019-12-12 11:00:58 +00:00
Tomas Kopecek
418376dc81 build can wait for actual repo
New options --wait-for-build and --wait-for-repo for build command are
simplification of using wait-repo + build command succession. They have
same semantices as the original one.

Fixes: https://pagure.io/koji/issue/1619
2019-12-12 15:29:27 +01:00
Tomas Kopecek
b35499cdb4 fix time type for restartHosts
Fixes: https://pagure.io/koji/issue/1825
2019-11-25 11:54:18 +01:00
Tomas Kopecek
aad9fac8d9 move from urrlib.request.urlopen to requests.get
Fixes: https://pagure.io/koji/issue/1530
2019-11-25 11:31:08 +01:00
Tomas Kopecek
dd8fd935f4 use preferred arch if there is more options
https://pagure.io/koji/pull-request/323 introduced option to force an
arch for noarch packages. Nevertheless, it is only task architecture and
not buildroot one. So, if builder can provide more possible archs (32/64
bit), it will pick one of these randomly and can go against preferred arch.

Patch introduces "preferred_arch" option for find_arch and use the
task's one when it works with noarch rpm.

Fixes: https://pagure.io/koji/issue/789
2019-10-14 10:12:40 +02:00
Tomas Kopecek
2bef7c16dc rename source_srpm to srpm 2019-06-26 09:06:48 +02:00
Tomas Kopecek
279e6533f6 rebuildSRPM task
New task rebuildSRPM for srpms uploaded to koji. If policy
'rebuild_srpm' returns True, build task will spawn rebuildSRPM task
first to recreate SRPM with updated buildroot macros, typically 'dist'.
Policy has access to same data as build_from_srpm and build_from_repo_id
policies. (user_id, source, task_id, build_tag, skip_tag, target, tag)

Fixes: https://pagure.io/koji/issue/1396
2019-06-26 09:06:48 +02:00
Mikolaj Izdebski
3d058c50db Allow generating separate src repo for build repos
Fixes #1266
2019-05-23 10:01:12 -04:00
Tomas Kopecek
426a8c2b16 rpm builds 2019-02-12 16:06:00 -05:00
Tomas Kopecek
d3766c19b5 replace obsoleted libs 2019-02-12 16:06:00 -05:00
Yu Ming Zhu
30c2e5f426 sorted set in Error msgs of tasks.find_arch 2019-01-28 08:46:11 -05:00
Tomas Kopecek
17db100db5 few sort speedups
Fixes: https://pagure.io/koji/issue/963
2018-12-04 00:05:26 -05:00
Tomas Kopecek
be535c2854 python-modernize -f libmodernize.fixes.fix_imports_six 2018-07-11 17:37:39 -04:00
Tomas Kopecek
b96092334d python-modernize -f libmodernize.fixes.fix_xrange_six 2018-07-11 17:37:39 -04:00
Tomas Kopecek
75ff25d4fd remove unused variable 2018-06-07 09:56:27 -04:00
Tomas Kopecek
7de48fe5ff propagate exception correctly
Fixes: https://pagure.io/koji/issue/844
2018-06-07 09:56:27 -04:00
Tomas Kopecek
c68396c059 Use unittest2 for rhel6 compatibility
Fixes: https://pagure.io/koji/issue/830
2018-06-07 09:39:39 -04:00
Tomas Kopecek
169aed66c5 make py2 files parseable with py3 2018-05-03 15:56:56 -04:00
Mike McLean
ed5ef6458c Fix typo in deleted mount check
Follow up to PR #402
Fixes #387
2018-04-24 17:20:37 -04:00
Yuming Zhu
62e94c100c fix duplicated args - parent in waittest task 2018-02-19 17:02:16 -05:00
Luiz Carvalho
a6f84f9a1e Import koji.plugin explicitly
The run_callbacks method assumes koji.plugin has already been imported.

Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
2017-11-13 14:46:31 +08:00
Mike McLean
75d192a149 update legacy signatures 2017-11-09 17:40:52 -05:00
Mike McLean
d8132543c5 move apply_argspec to koji.util 2017-11-09 17:40:52 -05:00
Mike McLean
89825a8d2d drop unused/incomplete parseParams method for now 2017-11-09 17:40:52 -05:00
Mike McLean
bf9e7520f7 fix defaults handling in apply_argspec 2017-11-09 17:40:52 -05:00
Mike McLean
9e48e440e8 cleanup, more testing 2017-11-09 17:40:52 -05:00
Mike McLean
e6de3e0d62 function to parse task parameters into a dictionary 2017-11-09 17:40:52 -05:00
Mike McLean
8a8999e01c partial work on apply_argspec function 2017-11-09 17:40:52 -05:00
Tomas Kopecek
379ec8ae63 python-modernize -f lib2to3.fixes.file . -w 2017-10-31 16:05:16 +01:00
Tomas Kopecek
d6a5cdf987 python-modernize -f lib2to3.fixes.fix_except . -w 2017-10-31 16:05:16 +01:00
Mike McLean
b848458251 safe_rmtree: make return value consistent with past behavior 2017-10-30 12:09:04 -04:00
Mike McLean
a2d9d756fe drop stale comment and avoid bare except in safe_rmtree 2017-10-30 12:09:04 -04:00
Tomas Kopecek
5b23fb1629 consolidate safe_rmtree, rmtree and shutil.rmtree
shutil.rmtree should be avoided in almost all cases
safe_rmtree has its usage in tasks module, but innards are replaced with
koji.util.rmtree, so we don't have two implementations of same task

Related: https://pagure.io/koji/issue/648
2017-10-30 12:09:04 -04:00
Mike McLean
ce6a88fa2a allow restart-hosts to work when deploying this change 2017-06-21 08:39:08 -04:00