Compare commits
2 commits
cff7cb02d4
...
4e87890108
Author | SHA1 | Date | |
---|---|---|---|
4e87890108 | |||
fbf8a1b3d9 |
4 changed files with 36 additions and 12 deletions
28
.ci/gen_output.sh
Executable file
28
.ci/gen_output.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
set -x -e
|
||||||
|
echo "" > output.txt
|
||||||
|
|
||||||
|
process_output() {
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
head -n 5 output_tmp.txt >> output.txt
|
||||||
|
echo "... [See pipeline output for full details]" >> output.txt
|
||||||
|
tail -n 5 output_tmp.txt >> output.txt
|
||||||
|
else
|
||||||
|
cat output_tmp.txt >> output.txt
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "-- START Port attribution watcher --" | tee -a output.txt
|
||||||
|
python3 .ci/port_attribution_watcher.py | tee output_tmp.txt
|
||||||
|
|
||||||
|
process_output
|
||||||
|
|
||||||
|
echo "-- END Port attribution watcher --" | tee -a output.txt
|
||||||
|
echo "" >> output.txt
|
||||||
|
echo "-- START Traefik label watcher --" | tee -a output.txt
|
||||||
|
|
||||||
|
python3 .ci/traefik_label_watcher.py | tee output_tmp.txt
|
||||||
|
|
||||||
|
process_output
|
||||||
|
|
||||||
|
echo "-- END Traefik label watcher --" | tee -a output.txt
|
||||||
|
|
|
@ -52,25 +52,20 @@ def main(watchFolder: str):
|
||||||
# Get exposed ports
|
# Get exposed ports
|
||||||
exposedPorts = getExposedPortsFromDockerComposeFile(dockerComposeFile)
|
exposedPorts = getExposedPortsFromDockerComposeFile(dockerComposeFile)
|
||||||
ports[dockerComposeFile] = exposedPorts
|
ports[dockerComposeFile] = exposedPorts
|
||||||
if len(exposedPorts) == 0:
|
if len(exposedPorts) != 0:
|
||||||
print(f"\n📦 {dockerComposeFile}"
|
print(f"\n📦 {dockerComposeFile}"
|
||||||
f"\n🔴 No exposed ports found"
|
f"\n🔗 Exposed ports: {exposedPorts}")
|
||||||
f"\n")
|
|
||||||
else:
|
|
||||||
print(f"\n📦 {dockerComposeFile}"
|
|
||||||
f"\n🔗 Exposed ports: {exposedPorts}"
|
|
||||||
f"\n")
|
|
||||||
|
|
||||||
wrong = checkPortUnique(ports)
|
wrong = checkPortUnique(ports)
|
||||||
|
|
||||||
if wrong:
|
if wrong:
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print("\n\n✅ All ports are unique\n\n")
|
print("\n✅ All ports are unique")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Traefik label watcher CI/CD")
|
print("Port Attribution Watcher")
|
||||||
# Read folder from env
|
# Read folder from env
|
||||||
watchFolder = os.getenv("WATCH_FOLDER")
|
watchFolder = os.getenv("WATCH_FOLDER")
|
||||||
if watchFolder == None:
|
if watchFolder == None:
|
||||||
|
|
|
@ -85,7 +85,7 @@ def main(watchFolder: str):
|
||||||
if wrong:
|
if wrong:
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
print("\n\n✅ All routers are unique\n\n")
|
print("\n\n✅ All routers are unique")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -3,8 +3,7 @@ steps:
|
||||||
image: python:3.12
|
image: python:3.12
|
||||||
commands:
|
commands:
|
||||||
- pip3 install -r .ci/requirements.txt
|
- pip3 install -r .ci/requirements.txt
|
||||||
- python3 .ci/port_attribution_watcher.py | tee output.txt
|
- ./.ci/gen_output.sh
|
||||||
- python3 .ci/traefik_label_watcher.py | tee output.txt
|
|
||||||
comment:
|
comment:
|
||||||
image: git.gnous.eu/enpls/gitea-comment-plugin:1.1
|
image: git.gnous.eu/enpls/gitea-comment-plugin:1.1
|
||||||
settings:
|
settings:
|
||||||
|
@ -14,6 +13,7 @@ steps:
|
||||||
comment_file: output.txt
|
comment_file: output.txt
|
||||||
when:
|
when:
|
||||||
status: [failure, success]
|
status: [failure, success]
|
||||||
|
event: [pull_request]
|
||||||
lint:
|
lint:
|
||||||
image: debian:stable
|
image: debian:stable
|
||||||
commands:
|
commands:
|
||||||
|
@ -31,6 +31,7 @@ steps:
|
||||||
comment_file: output.txt
|
comment_file: output.txt
|
||||||
when:
|
when:
|
||||||
status: [failure, success]
|
status: [failure, success]
|
||||||
|
event: [pull_request]
|
||||||
when:
|
when:
|
||||||
- event: [push, pull_request]
|
- event: [push, pull_request]
|
||||||
- evaluate: 'CI_COMMIT_AUTHOR in ["gnous-ci-bot", "mael", "ada"]'
|
- evaluate: 'CI_COMMIT_AUTHOR in ["gnous-ci-bot", "mael", "ada"]'
|
Loading…
Add table
Reference in a new issue