-
Notifications
You must be signed in to change notification settings - Fork 210
Adding Jenkins CI to GaeaC6 using role account #3389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
78562bb
097cf03
fefde1a
13dd8b0
7a2d67e
d9d241c
f13014d
e6af0af
4f34f5b
97384a3
8c052c5
cd90dd5
468b7bc
02486bc
45fb69b
199d18d
70cdf0d
7f839df
a993717
5f535e1
4148db4
0df7f35
64759c5
2132efe
18b5152
b2fe776
7bcda9d
2e212da
6f48a11
e1b2b08
b6fc870
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,18 @@ | ||
| #!/usr/bin/bash | ||
|
|
||
| export GFS_CI_ROOT=/gpfs/f6/drsa-precip3/scratch/${USER}/GFS_CI_ROOT | ||
| export ICSDIR_ROOT=/gpfs/f6/drsa-precip3/world-shared/role.glopara/data/ICSDIR | ||
| export GFS_CI_ROOT=/ncrc/proj/nggps_emc/${USER}/GFS_CI_CD | ||
|
DavidHuber-NOAA marked this conversation as resolved.
|
||
| export ICSDIR_ROOT=/gpfs/f6/bil-fire8/world-shared/global/glopara/data/ICSDIR | ||
|
|
||
| # CI BASH test directories | ||
| export GFS_BASH_CI_ROOT=${GFS_CI_ROOT}/Bash | ||
|
|
||
| # Jenkins directories | ||
| export JENKINS_AGENT_LANUCH_DIR=${GFS_CI_ROOT}/Jenkins/agent | ||
| export JENKINS_WORK_DIR=${GFS_CI_ROOT}/Jenkins/workspace | ||
|
|
||
| # CTest functional test directories for pre stagged input data | ||
| export STAGED_TESTS_DIR=${GFS_CI_ROOT}/STAGED_TESTS_DIR | ||
|
|
||
| export HPC_ACCOUNT=drsa-precip3 | ||
| export max_concurrent_cases=5 | ||
| export max_concurrent_pr=4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,11 @@ | |
| import os | ||
| import re | ||
|
|
||
| from github import Github, GithubException, InputFileContent, UnknownObjectException | ||
| from wxflow import which | ||
| from github import Auth, Github, GithubException, InputFileContent, UnknownObjectException | ||
| from wxflow import which, Logger | ||
|
|
||
| # Initialize logger with environment variable for logging level | ||
| logger = Logger(level=os.environ.get("LOGGING_LEVEL", "DEBUG"), colored_log=False) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking, should this remain at Also, I have been looking for a way to disable colors when logging. Thanks for showing off this
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. David, All of the python scripts that use the wxflow Logger are set at the DEBUG level, so I thought it best to follow form here. Notice that we can alter the Level at runtime with the environment variable LOGGING_LEVEL, so it appears the intent was to have DEBUG as the default. |
||
|
|
||
|
|
||
| class GitHubDBError(Exception): | ||
|
|
@@ -54,10 +57,24 @@ def __init__(self, repo_url=None, TOKEN=None): | |
| environment variable when repo_url is not provided. | ||
| """ | ||
| if TOKEN is None: | ||
| gh_cli = which('gh') | ||
| gh_cli.add_default_arg(['auth', 'status', '--show-token']) | ||
| TOKEN = gh_cli(output=str, error=str).split('\n')[3].split(': ')[1] | ||
| super().__init__(TOKEN) | ||
| TOKEN = os.environ.get('GH_TOKEN') or os.environ.get('GITHUB_TOKEN') | ||
| if TOKEN: | ||
| logger.info("Using TOKEN from environment variable.") | ||
| else: | ||
| gh_cli = which('gh') | ||
| gh_cli.add_default_arg(['auth', 'status', '--show-token']) | ||
| gh_output = gh_cli(output=str, error=str) | ||
| token_match = re.search(r"Token:\s*([a-zA-Z0-9_]+)", gh_output) | ||
| if token_match: | ||
| TOKEN = token_match.group(1) | ||
| logger.info("Using TOKEN from gh CLI tool.") | ||
| else: | ||
| raise ValueError("Token not found in gh CLI output.") | ||
| else: | ||
| logger.info("Using provided TOKEN.") | ||
|
|
||
| auth = Auth.Token(TOKEN) | ||
| super().__init__(auth=auth) | ||
|
|
||
| self.repo = self.get_repo_url(repo_url) | ||
| self.pulls = self.repo.get_pulls(state='open', sort='updated', direction='desc') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.