TruCol / Self-host-GitLab-CI-for-GitHub

Installs your own GitLab CI and runs it on all your GitHub repos, in a single command.
GNU Affero General Public License v3.0
4 stars 3 forks source link

Restore getting runner token functionality. #61

Closed a-t-0 closed 2 years ago

a-t-0 commented 2 years ago

After running:

./install_gitlab.sh -s -r

The following error is thrown:

2022-02-05 11:39:17 (3,38 MB/s) - ‘chrome_driver/chrome_driver.zip’ saved [5795569/5795569]

Archive:  chrome_driver/chrome_driver.zip
  inflating: chrome_driver/chromedriver90/chromedriver  
mv  chrome_driver/chromedriver90/chromedriver chrome_driver
rm -r chrome_driver/chromedriver90
rm -r chrome_driver/chrome_driver.zip
mv  chrome_driver/chromedriver chrome_driver/chromedriver90
Traceback (most recent call last):
  File "/home/name/anaconda/envs/get_gitlab_generation_token/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/name/anaconda/envs/get_gitlab_generation_token/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/name/git/Self-host-GitLab-Server-and-Runner-CI/get-gitlab-runner-registration-token/code/project1/src/__main__.py", line 8, in <module>
    main = Main(project_nr)
  File "/home/name/git/Self-host-GitLab-Server-and-Runner-CI/get-gitlab-runner-registration-token/code/project1/src/Main.py", line 48, in __init__
    loiter_till_gitlab_server_is_ready_for_login(self.hc, 1200, 5)
  File "/home/name/git/Self-host-GitLab-Server-and-Runner-CI/get-gitlab-runner-registration-token/code/project1/src/helper.py", line 110, in loiter_till_gitlab_server_is_ready_for_login
    website_controller = Website_controller()
  File "/home/name/git/Self-host-GitLab-Server-and-Runner-CI/get-gitlab-runner-registration-token/code/project1/src/Website_controller.py", line 19, in __init__
    self.driver = webdriver.Firefox(executable_path=r"firefox_driver/geckodriver")
  File "/home/name/anaconda/envs/get_gitlab_generation_token/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    self.service.start()
  File "/home/name/anaconda/envs/get_gitlab_generation_token/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/home/name/anaconda/envs/get_gitlab_generation_token/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service firefox_driver/geckodriver unexpectedly exited. Status code was: 64

This error occurs in the https://github.com/a-t-0/get-gitlab-runner-registration-token repository. So that is where it can be fixed.

However, if you consider resolving this issue, a better approach would be to get the GitLab runner token using bash inside the Docker container. I do not know where inside that Docker this token is stored, nor how to access it. However, if we can get it directly from inside the docker, instead of "downloading a browser controller, starting a browser, going to the gitlab server local website, logging in as root, clicking on get gitlab runner token, clicking on show token, and then scraping the token out the website page source".

So perhaps consider ignoring the error in that other repository and get the runner using Bash instead of Python.

a-t-0 commented 2 years ago

Resolved, the code automatically gets the GitLab runner token again.