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
This commit is contained in:
committed by
Jan Möbius
parent
c7ddfa903b
commit
92387f4c2a
@@ -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 #
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/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.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user