mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-15 11:28:09 +00:00
Allow authority to be specified in check-pr (#1473)
* fix interactive login in check-pr * specify tenant domain in check-pr * bug fix * rename tenant to authority
This commit is contained in:
@ -873,13 +873,17 @@ class Run(Command):
|
||||
test_id: UUID,
|
||||
*,
|
||||
endpoint: Optional[str],
|
||||
authority: Optional[str] = None,
|
||||
client_id: Optional[str],
|
||||
client_secret: Optional[str],
|
||||
poll: bool = False,
|
||||
stop_on_complete_check: bool = False,
|
||||
) -> None:
|
||||
self.onefuzz.__setup__(
|
||||
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
tester = TestOnefuzz(self.onefuzz, self.logger, test_id)
|
||||
result = tester.check_jobs(
|
||||
@ -895,9 +899,13 @@ class Run(Command):
|
||||
endpoint: Optional[str],
|
||||
client_id: Optional[str],
|
||||
client_secret: Optional[str],
|
||||
authority: Optional[str] = None,
|
||||
) -> None:
|
||||
self.onefuzz.__setup__(
|
||||
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
tester = TestOnefuzz(self.onefuzz, self.logger, test_id)
|
||||
launch_result, repros = tester.launch_repro()
|
||||
@ -910,6 +918,7 @@ class Run(Command):
|
||||
samples: Directory,
|
||||
*,
|
||||
endpoint: Optional[str] = None,
|
||||
authority: Optional[str] = None,
|
||||
client_id: Optional[str] = None,
|
||||
client_secret: Optional[str] = None,
|
||||
pool_size: int = 10,
|
||||
@ -925,7 +934,10 @@ class Run(Command):
|
||||
|
||||
def try_setup(data: Any) -> None:
|
||||
self.onefuzz.__setup__(
|
||||
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
|
||||
retry(try_setup, "trying to configure")
|
||||
@ -940,11 +952,15 @@ class Run(Command):
|
||||
test_id: UUID,
|
||||
*,
|
||||
endpoint: Optional[str],
|
||||
authority: Optional[str],
|
||||
client_id: Optional[str],
|
||||
client_secret: Optional[str],
|
||||
) -> None:
|
||||
self.onefuzz.__setup__(
|
||||
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
tester = TestOnefuzz(self.onefuzz, self.logger, test_id=test_id)
|
||||
tester.cleanup()
|
||||
@ -954,11 +970,15 @@ class Run(Command):
|
||||
test_id: UUID,
|
||||
*,
|
||||
endpoint: Optional[str],
|
||||
authority: Optional[str] = None,
|
||||
client_id: Optional[str],
|
||||
client_secret: Optional[str],
|
||||
) -> None:
|
||||
self.onefuzz.__setup__(
|
||||
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
tester = TestOnefuzz(self.onefuzz, self.logger, test_id=test_id)
|
||||
tester.check_logs_for_errors()
|
||||
@ -968,6 +988,7 @@ class Run(Command):
|
||||
samples: Directory,
|
||||
*,
|
||||
endpoint: Optional[str] = None,
|
||||
authority: Optional[str] = None,
|
||||
client_id: Optional[str] = None,
|
||||
client_secret: Optional[str] = None,
|
||||
pool_size: int = 15,
|
||||
@ -985,6 +1006,7 @@ class Run(Command):
|
||||
self.launch(
|
||||
samples,
|
||||
endpoint=endpoint,
|
||||
authority=authority,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
pool_size=pool_size,
|
||||
@ -997,6 +1019,7 @@ class Run(Command):
|
||||
self.check_jobs(
|
||||
test_id,
|
||||
endpoint=endpoint,
|
||||
authority=authority,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
poll=True,
|
||||
@ -1009,6 +1032,7 @@ class Run(Command):
|
||||
self.check_repros(
|
||||
test_id,
|
||||
endpoint=endpoint,
|
||||
authority=authority,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
)
|
||||
@ -1018,6 +1042,7 @@ class Run(Command):
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@ -1034,6 +1059,7 @@ class Run(Command):
|
||||
endpoint=endpoint,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
authority=authority,
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error("testing failed: %s", repr(e))
|
||||
|
@ -167,6 +167,7 @@ class Deployer:
|
||||
instance: str,
|
||||
region: str,
|
||||
subscription_id: Optional[str],
|
||||
authority: Optional[str],
|
||||
skip_tests: bool,
|
||||
test_args: List[str],
|
||||
repo: str,
|
||||
@ -182,8 +183,9 @@ class Deployer:
|
||||
self.test_args = test_args or []
|
||||
self.repo = repo
|
||||
self.unattended = unattended
|
||||
self.client_id = ""
|
||||
self.client_secret = ""
|
||||
self.client_id: Optional[str] = None
|
||||
self.client_secret: Optional[str] = None
|
||||
self.authority = authority
|
||||
|
||||
def merge(self) -> None:
|
||||
if self.pr:
|
||||
@ -272,6 +274,7 @@ class Deployer:
|
||||
if self.unattended
|
||||
else ""
|
||||
)
|
||||
authority_args = f"--authority {self.authority}" if self.authority else ""
|
||||
|
||||
commands = [
|
||||
(
|
||||
@ -286,6 +289,7 @@ class Deployer:
|
||||
(
|
||||
f"{py} {test_dir}/{script} test {test_dir} "
|
||||
f"--region {self.region} --endpoint {endpoint} "
|
||||
f"{authority_args} "
|
||||
f"{unattended_args} {test_args}"
|
||||
),
|
||||
),
|
||||
@ -361,6 +365,7 @@ def main() -> None:
|
||||
parser.add_argument("--skip-cleanup-on-failure", action="store_true")
|
||||
parser.add_argument("--merge-on-success", action="store_true")
|
||||
parser.add_argument("--subscription_id")
|
||||
parser.add_argument("--authority", default=None)
|
||||
parser.add_argument("--test_args", nargs=argparse.REMAINDER)
|
||||
parser.add_argument("--unattended", action="store_true")
|
||||
args = parser.parse_args()
|
||||
@ -378,6 +383,7 @@ def main() -> None:
|
||||
test_args=args.test_args,
|
||||
repo=args.repo,
|
||||
unattended=args.unattended,
|
||||
authority=args.authority,
|
||||
)
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
os.chdir(directory)
|
||||
|
Reference in New Issue
Block a user