add ability to specify ostree ref in OSTREE phase
It allows specify what ref we want this compose to commit to. New parameter 'ostree_ref' overrides the default value from the treefile json. Relates: https://pagure.io/pungi/issue/777 Signed-off-by: Ondrej Nosek <onosek@redhat.com>
This commit is contained in:
parent
953fb4c54c
commit
a6c65e026a
@ -1228,6 +1228,7 @@ repository with a new commit.
|
|||||||
:ref:`See how those values are created <auto-version>`.
|
:ref:`See how those values are created <auto-version>`.
|
||||||
* ``tag_ref`` -- (*bool*, default ``True``) If set to ``False``, a git
|
* ``tag_ref`` -- (*bool*, default ``True``) If set to ``False``, a git
|
||||||
reference will not be created.
|
reference will not be created.
|
||||||
|
* ``ostree_ref`` -- (*str*) To override value ``ref`` from ``treefile``.
|
||||||
|
|
||||||
|
|
||||||
Example config
|
Example config
|
||||||
|
@ -890,6 +890,7 @@ def make_schema():
|
|||||||
"version": {"type": "string"},
|
"version": {"type": "string"},
|
||||||
"config_branch": {"type": "string"},
|
"config_branch": {"type": "string"},
|
||||||
"tag_ref": {"type": "boolean"},
|
"tag_ref": {"type": "boolean"},
|
||||||
|
"ostree_ref": {"type": "string"},
|
||||||
},
|
},
|
||||||
"required": ["treefile", "config_url", "repo", "ostree_repo"],
|
"required": ["treefile", "config_url", "repo", "ostree_repo"],
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
@ -915,6 +916,7 @@ def make_schema():
|
|||||||
"version": {"type": "string"},
|
"version": {"type": "string"},
|
||||||
"config_branch": {"type": "string"},
|
"config_branch": {"type": "string"},
|
||||||
"tag_ref": {"type": "boolean"},
|
"tag_ref": {"type": "boolean"},
|
||||||
|
"ostree_ref": {"type": "string"},
|
||||||
},
|
},
|
||||||
"required": ["treefile", "config_url", "repo", "ostree_repo"],
|
"required": ["treefile", "config_url", "repo", "ostree_repo"],
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
|
@ -40,6 +40,8 @@ def main(args=None):
|
|||||||
help='version string to be added as versioning metadata')
|
help='version string to be added as versioning metadata')
|
||||||
treep.add_argument('--update-summary', action='store_true',
|
treep.add_argument('--update-summary', action='store_true',
|
||||||
help='update summary metadata')
|
help='update summary metadata')
|
||||||
|
treep.add_argument('--ostree-ref', metavar='PATH',
|
||||||
|
help='override ref value from treefile')
|
||||||
|
|
||||||
installerp = subparser.add_parser("installer", help="Create an OSTree installer image")
|
installerp = subparser.add_parser("installer", help="Create an OSTree installer image")
|
||||||
installerp.set_defaults(_class=Installer, func='run')
|
installerp.set_defaults(_class=Installer, func='run')
|
||||||
|
@ -57,7 +57,11 @@ class Tree(OSTree):
|
|||||||
if not tag_ref:
|
if not tag_ref:
|
||||||
print('Not updating ref as configured')
|
print('Not updating ref as configured')
|
||||||
return
|
return
|
||||||
ref = get_ref_from_treefile(self.treefile)
|
# if ostree_ref argument is given, it overrides ref value from treefile
|
||||||
|
if self.ostree_ref:
|
||||||
|
ref = self.ostree_ref
|
||||||
|
else:
|
||||||
|
ref = get_ref_from_treefile(self.treefile)
|
||||||
commitid = get_commitid_from_commitid_file(self.commitid_file)
|
commitid = get_commitid_from_commitid_file(self.commitid_file)
|
||||||
print('Ref: %r, Commit ID: %r' % (ref, commitid))
|
print('Ref: %r, Commit ID: %r' % (ref, commitid))
|
||||||
if ref and commitid:
|
if ref and commitid:
|
||||||
@ -79,6 +83,8 @@ class Tree(OSTree):
|
|||||||
self.logdir = self.args.log_dir
|
self.logdir = self.args.log_dir
|
||||||
self.update_summary = self.args.update_summary
|
self.update_summary = self.args.update_summary
|
||||||
self.extra_config = self.args.extra_config
|
self.extra_config = self.args.extra_config
|
||||||
|
self.ostree_ref = self.args.ostree_ref
|
||||||
|
|
||||||
if self.extra_config:
|
if self.extra_config:
|
||||||
self.extra_config = json.load(open(self.extra_config, 'r'))
|
self.extra_config = json.load(open(self.extra_config, 'r'))
|
||||||
repos = self.extra_config.get('repo', [])
|
repos = self.extra_config.get('repo', [])
|
||||||
|
@ -122,6 +122,10 @@ class OSTreeThread(WorkerThread):
|
|||||||
if config.get('update_summary', False):
|
if config.get('update_summary', False):
|
||||||
cmd.append('--update-summary')
|
cmd.append('--update-summary')
|
||||||
|
|
||||||
|
ostree_ref = config.get('ostree_ref')
|
||||||
|
if ostree_ref:
|
||||||
|
cmd.append('--ostree-ref=%s' % ostree_ref)
|
||||||
|
|
||||||
runroot_channel = compose.conf.get("runroot_channel")
|
runroot_channel = compose.conf.get("runroot_channel")
|
||||||
runroot_tag = compose.conf["runroot_tag"]
|
runroot_tag = compose.conf["runroot_tag"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user