1
0
Fork 0

Move chain of trust functions into their own module

master
Johan Lorenzo 2019-03-28 18:05:51 +01:00 committed by Sebastian Kaspari
parent 94b7ee4996
commit b8b2b763e7
3 changed files with 21 additions and 21 deletions

View File

@ -14,7 +14,7 @@ import taskcluster
from lib import build_variants
from lib.tasks import TaskBuilder, schedule_task_graph
from lib.util import (
from lib.chain_of_trust import (
populate_chain_of_trust_task_graph,
populate_chain_of_trust_required_but_unused_files
)

View File

@ -0,0 +1,20 @@
import json
def populate_chain_of_trust_required_but_unused_files():
# Thoses files are needed to keep chainOfTrust happy. However, they have no
# need for android-components, at the moment. For more details, see:
# https://github.com/mozilla-releng/scriptworker/pull/209/files#r184180585
for file_names in ('actions.json', 'parameters.yml'):
with open(file_names, 'w') as f:
json.dump({}, f) # Yaml is a super-set of JSON.
def populate_chain_of_trust_task_graph(full_task_graph):
# taskgraph must follow the format:
# {
# task_id: full_task_definition
# }
with open('task-graph.json', 'w') as f:
json.dump(full_task_graph, f)

View File

@ -1,4 +1,3 @@
import json
import re
@ -6,22 +5,3 @@ def convert_camel_case_into_kebab_case(string):
# Inspired from https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case # noqa: E501
first_pass = re.sub('(.)([A-Z][a-z]+)', r'\1-\2', string)
return re.sub('([a-z0-9])([A-Z])', r'\1-\2', first_pass).lower()
def populate_chain_of_trust_required_but_unused_files():
# Thoses files are needed to keep chainOfTrust happy. However, they have no
# need for android-components, at the moment. For more details, see:
# https://github.com/mozilla-releng/scriptworker/pull/209/files#r184180585
for file_names in ('actions.json', 'parameters.yml'):
with open(file_names, 'w') as f:
json.dump({}, f) # Yaml is a super-set of JSON.
def populate_chain_of_trust_task_graph(full_task_graph):
# taskgraph must follow the format:
# {
# task_id: full_task_definition
# }
with open('task-graph.json', 'w') as f:
json.dump(full_task_graph, f)