Commit 92387f4c authored by Johannes Lenzen's avatar Johannes Lenzen Committed by Jan Möbius
Browse files

Changed the .gitlab-ci.yml structure

Beginned with new building system
.gitlab-ci.yml can now be generated by the script assemble-gitlab-ci.py.

Therefore the .gitlab-ci.yml configuration file can be split into several smaller files
parent c7ddfa90
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# This is an auto generated file. Do not make # # This is an auto generated file. Do not make #
# changes to this file. They possible will be overriden. # # changes to this file. They possible will be overriden. #
# # # #
# To make persistent changes changes files in # # To make persistent changes, changes files in #
# ./CI/gitlab-ci/ ... # # ./CI/gitlab-ci/ ... #
# and regenerate this file with the configuration tool # # and regenerate this file with the configuration tool #
# python3 ./CI/gitlab-ci/assemble-gitlab-ci.py # # python3 ./CI/gitlab-ci/assemble-gitlab-ci.py #
......
#!/usr/bin/python3 #!/usr/bin/python3
import sys, os, re import sys, os, re, yaml, hashlib
# Version 3 # Version 3.2
# Script for automated gitlab-ci creation # Script for automated gitlab-ci creation
# Assembles the gitlab ci from master template file: # Assembles the gitlab ci from master template file:
...@@ -32,7 +32,7 @@ autogenerated_notice = """###################################################### ...@@ -32,7 +32,7 @@ autogenerated_notice = """######################################################
# This is an auto generated file. Do not make # # This is an auto generated file. Do not make #
# changes to this file. They possible will be overriden. # # changes to this file. They possible will be overriden. #
# # # #
# To make persistent changes changes files in # # To make persistent changes, changes files in #
# ./CI/gitlab-ci/ ... # # ./CI/gitlab-ci/ ... #
# and regenerate this file with the configuration tool # # and regenerate this file with the configuration tool #
# python3 ./CI/gitlab-ci/assemble-gitlab-ci.py # # python3 ./CI/gitlab-ci/assemble-gitlab-ci.py #
...@@ -86,10 +86,10 @@ def assembleTarget(master, depth=maxFileRecursionDepth): ...@@ -86,10 +86,10 @@ def assembleTarget(master, depth=maxFileRecursionDepth):
if depth < 0: if depth < 0:
raise "Max depth reached. Possible circular import?" raise "Max depth reached. Possible circular import?"
print_prefix = "" print_prefix = ""
for i in range(0, maxFileRecursionDepth-depth): for _ in range(0, maxFileRecursionDepth-depth):
print_prefix = " | \t" + print_prefix print_prefix = print_prefix + " | \t"
print_prefix_inverse = "" print_prefix_inverse = ""
for i in range(0, depth): for _ in range(0, depth):
print_prefix_inverse = print_prefix_inverse + "\t" print_prefix_inverse = print_prefix_inverse + "\t"
master_content = readFile(master) master_content = readFile(master)
...@@ -139,13 +139,34 @@ def main(): ...@@ -139,13 +139,34 @@ def main():
os.chdir(findCIAssemblyDirectory()) os.chdir(findCIAssemblyDirectory())
target_content = autogenerated_notice target_content = autogenerated_notice
target_content += assembleTarget(master_file) target_content += assembleTarget(master_file)
print("Writing config to file "+target_file)
target_file_handle = open(target_file, "w") m = hashlib.sha256()
target_file_handle.write(target_content) m.update(readFile(target_file).encode('utf-8'))
target_file_handle.write("\n") hash_original = m.hexdigest()
target_file_handle.flush() m = hashlib.sha256()
target_file_handle.close() m.update(target_content.encode('utf-8'))
m.update("\n".encode('utf-8'))
hash_new = m.hexdigest()
print("Old checksum: ", hash_original)
print("New checksum: ", hash_new)
if (hash_original == hash_new):
print("No changes made: Skipping file write")
else:
print("File differs")
print("Writing config to file "+target_file)
target_file_handle = open(target_file, "w")
target_file_handle.write(target_content)
target_file_handle.write("\n")
target_file_handle.flush()
target_file_handle.close()
try:
yaml.load(target_content, Loader=yaml.SafeLoader)
print("Yaml syntax check: OK")
except Exception as e:
print("Invalid yaml syntax:", e)
print("Finished.") print("Finished.")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment