Commit 676df456 authored by 金凯强's avatar 金凯强 🎨

脚本修复

parent 608c975e
......@@ -7,18 +7,9 @@ def install_runner(HSCUSCODE=None):
if not HSCUSCODE:
HSCUSCODE = input("请输入客户代号HSCUSCODE:")
print(HSCUSCODE)
if os.path.exists('/etc/gitlab-runner/config.toml'):
with open('/etc/gitlab-runner/config.toml', 'r') as f:
content = f.read()
if 'huansi.{hscode}'.format(hscode=HSCUSCODE) not in content:
register_huansi_runner(HSCUSCODE)
# if 'gitlab.{hscode}'.format(hscode=HSCUSCODE) not in content:
# register_gitlab_runner(HSCUSCODE)
else:
register_huansi_runner(HSCUSCODE)
# register_gitlab_runner(HSCUSCODE)
os.system("rm /etc/gitlab-runner/config.toml -f && sudo docker stop gitlab-runner && docker rm gitlab-runner")
register_huansi_runner(HSCUSCODE)
os.system("sudo chmod 777 /etc/gitlab-runner/config.toml")
with open('/etc/gitlab-runner/config.toml', 'r') as f:
......@@ -28,8 +19,6 @@ def install_runner(HSCUSCODE=None):
with open('/etc/gitlab-runner/config.toml', 'w') as f:
f.write(a)
os.system("sudo docker stop gitlab-runner && docker rm gitlab-runner")
s2 = os.system("sudo docker run -d --name gitlab-runner --restart always \
-v /etc/gitlab-runner:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
......
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