Skip to content

Commit 9cff053

Browse files
authored
Merge pull request #2 from ISISComputingGroup/FLASH_Adding_build_artfefact_for_git_status
Flash_adding_build_artfefact_for_git_status
2 parents b060f3c + 31eadec commit 9cff053

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pipeline {
4444

4545
post {
4646
always {
47+
archiveArtifacts artifacts: '*git_status/*.txt', caseSensitive: false
4748
logParser([
4849
projectRulePath: 'parse_rules',
4950
parsingRulesPath: '',

hotfix_checker.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
EPICS_DIR = "C:\\Instrument\\Apps\\EPICS\\"
99
SSH_USERNAME = os.environ["SSH_CREDENTIALS_USR"]
1010
SSH_PASSWORD = os.environ["SSH_CREDENTIALS_PSW"]
11+
WORKSPACE_DIR = os.environ["WORKSPACE"]
1112

1213
USE_TEST_INSTRUMENT_LIST = os.environ["USE_TEST_INSTRUMENT_LIST"] == "true"
1314
TEST_INSTRUMENT_LIST = os.environ["TEST_INSTRUMENT_LIST"]
@@ -22,6 +23,25 @@ class CHECK(Enum):
2223
FALSE = 2
2324

2425

26+
def save_to_file(path, data):
27+
""" Save data to a file in the workspace directory.
28+
29+
Args:
30+
hostname (str): The hostname to connect to.
31+
path (str): The path to save the file to.
32+
data (str): The data to save to the file.
33+
34+
Returns:
35+
None
36+
"""
37+
# check if the parent dir exists
38+
if not os.path.exists(os.path.join(WORKSPACE_DIR + os.path.dirname(path))):
39+
os.makedirs(os.path.join(WORKSPACE_DIR + os.path.dirname(path)))
40+
41+
with open(os.path.join(WORKSPACE_DIR + path), "w") as file:
42+
file.write(data)
43+
44+
2545
def get_insts_on_latest_ibex_via_inst_congif():
2646
""" Get a list of instruments that are on the latest version of IBEX via the inst_config file.
2747
@@ -44,7 +64,7 @@ def get_insts_on_latest_ibex_via_inst_congif():
4464

4565
# Get the latest version of IBEX
4666
latest_version = max([inst["version"]
47-
for inst in result_list])
67+
for inst in result_list])
4868

4969
# filter out the instruments that are not on the latest version
5070
insts_on_latest_ibex = [inst["hostname"] for inst in result_list if
@@ -67,6 +87,9 @@ def check_for_uncommitted_changes(hostname):
6787
hostname, SSH_USERNAME, SSH_PASSWORD, command)
6888

6989
if ssh_process['success']:
90+
# log the output to a workspace file for viewing later
91+
save_to_file("/git_status/" + hostname + '.txt', ssh_process['output'])
92+
7093
if ssh_process['output'].strip() != "":
7194
return CHECK.TRUE
7295
else:

0 commit comments

Comments
 (0)