1 from fs.sshfs
import SSHFS
5 import gitlab
as gitlab_api
15 assert args.user
is not None,
"Need username for lxplus"
16 assert args.pwd
is not None,
"Neew password for lxplus"
17 with
Spinner(text=
"Connecting to lxplus", persist=
False):
19 host=
"lxplus.cern.ch",
29 p.add_argument(
"--user", default=
"atsjenkins")
30 p.add_argument(
"--pwd", default=os.getenv(
"ATSJENKINS_PASSWORD",
None))
33 "--gitlab-access-token",
35 default=os.getenv(
"ATSJENKINS_ACCESS_TOKEN",
None),
36 help=
"GitLab access token to authenticate with the GitLab API",
42 assert args.gitlab_access_token
is not None,
"Need gitlab access token"
43 gl = gitlab_api.Gitlab(
44 "https://gitlab.cern.ch", private_token=args.gitlab_access_token
50 @contextlib.contextmanager
52 server =
"smtp.cern.ch"
54 username =
"atsjenkins@cern.ch"
56 context = ssl.create_default_context()
57 server = smtplib.SMTP(server, port)
59 server.starttls(context=context)
61 server.login(args.user, args.pwd)
68 @contextlib.contextmanager
69 def Spinner(text, persist=True, *args, **kwargs):
70 stream = kwargs.get(
"stream", sys.stdout)
71 if stream.isatty()
and Halo
is not None:
72 spinner =
Halo(text, *args, **kwargs)
86 stream.write(text +
"\n")