| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 41eb95d commit cbc613d
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ | |||
| 8 | 8 | import time | |
| 9 | 9 | import uuid | |
| 10 | 10 | from subprocess import check_output | |
| 11 | - from typing import Sequence | ||
| 11 | + from typing import Sequence, TYPE_CHECKING | ||
| 12 | 12 | ||
| 13 | 13 | import pytest | |
| 14 | 14 | import requests | |
@@ -260,6 +260,7 @@ def gl(gitlab_url: str, gitlab_token: str) -> gitlab.Gitlab: | |||
| 260 | 260 | ||
| 261 | 261 | logging.info("Instantiating python-gitlab gitlab.Gitlab instance") | |
| 262 | 262 | instance = gitlab.Gitlab(gitlab_url, private_token=gitlab_token) | |
| 263 | + instance.auth() | ||
| 263 | 264 | ||
| 264 | 265 | logging.info("Reset GitLab") | |
| 265 | 266 | reset_gitlab(instance) | |
@@ -291,33 +292,36 @@ def gitlab_ultimate(gitlab_plan, request) -> None: | |||
| 291 | 292 | ||
| 292 | 293 | ||
| 293 | 294 | @pytest.fixture(scope="session") | |
| 294 | - def gitlab_runner(gl): | ||
| 295 | + def gitlab_runner(gl: gitlab.Gitlab): | ||
| 295 | 296 | container = "gitlab-runner-test" | |
| 296 | - runner_name = "python-gitlab-runner" | ||
| 297 | - token = "registration-token" | ||
| 297 | + runner_description = "python-gitlab-runner" | ||
| 298 | + if TYPE_CHECKING: | ||
| 299 | + assert gl.user is not None | ||
| 300 | + | ||
| 301 | + runner = gl.user.runners.create( | ||
| 302 | + {"runner_type": "instance_type", "run_untagged": True} | ||
| 303 | + ) | ||
| 298 | 304 | url = "http://gitlab" | |
| 299 | 305 | ||
| 300 | 306 | docker_exec = ["docker", "exec", container, "gitlab-runner"] | |
| 301 | 307 | register = [ | |
| 302 | 308 | "register", | |
| 303 | - "--run-untagged", | ||
| 304 | 309 | "--non-interactive", | |
| 305 | - "--registration-token", | ||
| 306 | - token, | ||
| 307 | - "--name", | ||
| 308 | - runner_name, | ||
| 310 | + "--token", | ||
| 311 | + runner.token, | ||
| 312 | + "--description", | ||
| 313 | + runner_description, | ||
| 309 | 314 | "--url", | |
| 310 | 315 | url, | |
| 311 | 316 | "--clone-url", | |
| 312 | 317 | url, | |
| 313 | 318 | "--executor", | |
| 314 | 319 | "shell", | |
| 315 | 320 | ] | |
| 316 | - unregister = ["unregister", "--name", runner_name] | ||
| 317 | 321 | ||
| 318 | 322 | yield check_output(docker_exec + register).decode() | |
| 319 | 323 | ||
| 320 | - check_output(docker_exec + unregister).decode() | ||
| 324 | + gl.runners.delete(token=runner.token) | ||
| 321 | 325 | ||
| 322 | 326 | ||
| 323 | 327 | @pytest.fixture(scope="module") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ services: | |||
| 12 | 12 | privileged: true # Just in case https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/1350 | |
| 13 | 13 | environment: | |
| 14 | 14 | GITLAB_ROOT_PASSWORD: 5iveL!fe | |
| 15 | - GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN: registration-token | ||
| 16 | 15 | GITLAB_OMNIBUS_CONFIG: | | |
| 17 | 16 | external_url 'http://127.0.0.1:8080' | |
| 18 | 17 | registry['enable'] = false | |
| Back | FazBrowse Home | New Git URL |
0 commit comments