Commit 2a773f20 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'docker-build-system' into 'master'

New Gitlab CI assemble version

See merge request !246
parents c7ddfa90 92387f4c
Pipeline #13473 passed with stages
in 245 minutes and 39 seconds
......@@ -3,7 +3,7 @@
# This is an auto generated file. Do not make #
# 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/ ... #
# and regenerate this file with the configuration tool #
# python3 ./CI/gitlab-ci/assemble-gitlab-ci.py #
......
#!/usr/bin/python3
import sys, os, re
import sys, os, re, yaml, hashlib
# Version 3
# Version 3.2
# Script for automated gitlab-ci creation
# Assembles the gitlab ci from master template file:
......@@ -32,7 +32,7 @@ autogenerated_notice = """######################################################
# This is an auto generated file. Do not make #
# 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/ ... #
# and regenerate this file with the configuration tool #
# python3 ./CI/gitlab-ci/assemble-gitlab-ci.py #
......@@ -86,10 +86,10 @@ def assembleTarget(master, depth=maxFileRecursionDepth):
if depth < 0:
raise "Max depth reached. Possible circular import?"
print_prefix = ""
for i in range(0, maxFileRecursionDepth-depth):
print_prefix = " | \t" + print_prefix
for _ in range(0, maxFileRecursionDepth-depth):
print_prefix = print_prefix + " | \t"
print_prefix_inverse = ""
for i in range(0, depth):
for _ in range(0, depth):
print_prefix_inverse = print_prefix_inverse + "\t"
master_content = readFile(master)
......@@ -139,13 +139,34 @@ def main():
os.chdir(findCIAssemblyDirectory())
target_content = autogenerated_notice
target_content += assembleTarget(master_file)
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()
m = hashlib.sha256()
m.update(readFile(target_file).encode('utf-8'))
hash_original = m.hexdigest()
m = hashlib.sha256()
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.")
......
Markdown is supported
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