Skip to content

Commit 22af7df

Browse files
authored
Merge pull request #3 from ISISComputingGroup/Ticket8399_Refactor_of_hotfix_status_checker
Ticket8399_refactor_of_hotfix_status_checker
2 parents 9cff053 + 197f29f commit 22af7df

22 files changed

+953
-443
lines changed

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
REPO_DIR=C:\\Instrument\\Apps\\EPICS\\
2+
UPSTREAM_BRANCH_CONFIG=epics
3+
4+
WORKSPACE=temporary_workspace
5+
6+
SSH_CREDENTIALS_USR=username
7+
SSH_CREDENTIALS_PSW=password
8+
9+
USE_TEST_INSTRUMENT_LIST=false
10+
TEST_INSTRUMENT_LIST=NDXSCIDEMO
11+
12+
DEBUG_MODE=false

.gitignore

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
2+
/temporary_workspace
3+
4+
# files to be ignored from this particular project
5+
.ruff_cache
6+
7+
8+
# Byte-compiled / optimized / DLL files
9+
__pycache__/
10+
*.py[cod]
11+
*$py.class
12+
13+
# C extensions
14+
*.so
15+
16+
# Distribution / packaging
17+
.Python
18+
build/
19+
develop-eggs/
20+
dist/
21+
downloads/
22+
eggs/
23+
.eggs/
24+
lib/
25+
lib64/
26+
parts/
27+
sdist/
28+
var/
29+
wheels/
30+
share/python-wheels/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
MANIFEST
35+
36+
# PyInstaller
37+
# Usually these files are written by a python script from a template
38+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
39+
*.manifest
40+
*.spec
41+
42+
# Installer logs
43+
pip-log.txt
44+
pip-delete-this-directory.txt
45+
46+
# Unit test / coverage reports
47+
htmlcov/
48+
.tox/
49+
.nox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
*.py,cover
57+
.hypothesis/
58+
.pytest_cache/
59+
cover/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
db.sqlite3
69+
db.sqlite3-journal
70+
71+
# Flask stuff:
72+
instance/
73+
.webassets-cache
74+
75+
# Scrapy stuff:
76+
.scrapy
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
.pybuilder/
83+
target/
84+
85+
# Jupyter Notebook
86+
.ipynb_checkpoints
87+
88+
# IPython
89+
profile_default/
90+
ipython_config.py
91+
92+
# pyenv
93+
# For a library or package, you might want to ignore these files since the code is
94+
# intended to run in multiple environments; otherwise, check them in:
95+
# .python-version
96+
97+
# pipenv
98+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
100+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
101+
# install all needed dependencies.
102+
#Pipfile.lock
103+
104+
# poetry
105+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106+
# This is especially recommended for binary packages to ensure reproducibility, and is more
107+
# commonly ignored for libraries.
108+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109+
#poetry.lock
110+
111+
# pdm
112+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113+
#pdm.lock
114+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115+
# in version control.
116+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
117+
.pdm.toml
118+
.pdm-python
119+
.pdm-build/
120+
121+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122+
__pypackages__/
123+
124+
# Celery stuff
125+
celerybeat-schedule
126+
celerybeat.pid
127+
128+
# SageMath parsed files
129+
*.sage.py
130+
131+
# Environments
132+
.env
133+
.venv
134+
env/
135+
venv/
136+
ENV/
137+
env.bak/
138+
venv.bak/
139+
140+
# Spyder project settings
141+
.spyderproject
142+
.spyproject
143+
144+
# Rope project settings
145+
.ropeproject
146+
147+
# mkdocs documentation
148+
/site
149+
150+
# mypy
151+
.mypy_cache/
152+
.dmypy.json
153+
dmypy.json
154+
155+
# Pyre type checker
156+
.pyre/
157+
158+
# pytype static type analyzer
159+
.pytype/
160+
161+
# Cython debug symbols
162+
cython_debug/
163+
164+
# PyCharm
165+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
166+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
167+
# and can be added to the global gitignore or merged into this file. For a more nuclear
168+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
169+
#.idea/

Jenkinsfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ pipeline {
1717
TEST_INSTRUMENT_LIST = "${TEST_INSTRUMENT_LIST}"
1818
USE_TEST_INSTRUMENT_LIST = "${USE_TEST_INSTRUMENT_LIST}"
1919
DEBUG_MODE = "${DEBUG_MODE}"
20+
REPO_DIR = "C:\\Instrument\\Apps\\EPICS\\"
21+
UPSTREAM_BRANCH_CONFIG = "epics"
22+
SHOW_UNCOMMITTED_CHANGES_MESSAGES="false"
2023
}
2124

2225
stages {
@@ -35,7 +38,7 @@ pipeline {
3538
echo 'Check Instrument has any Hotfixes and then any uncommitteed changes'
3639
timeout(time: 1, unit: 'HOURS') {
3740
bat '''
38-
call hotfix_checker.bat
41+
call utils/jenkins_utils/hotfix_checker.bat
3942
'''
4043
}
4144
}

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
# HotfixStatusChecker Jenkins Pipeline
2-
This is a Jenkins pipeline to check the status of the EPICS repositories on instrument machines.
3-
It fails when there are uncommitted changes or an instrument is unreachable either via branch or hotfix.
2+
This program is designed to check the status of repositories on instrument machines, controlled by environment variables. It identifies issues such as uncommitted changes, local commits not present on the upstream branch, and vice versa, as well as instrument inaccessibility.
3+
4+
## Usage
5+
To use this program, you can create a Jenkinsfile for the repository you want to check, set the appropriate environment variables, and create a pipeline for this on the Jenkins dashboard. Additionally, the program can be run locally using a local .env file. If running locally or on the machine executing the Jenkins check, remember to run pip install -r requirements.txt. Include this installation in the Jenkinsfile or any .bat files as necessary.
6+
7+
## Important Notes
8+
- Set workspace to temporary dir when running locally.
9+
- Environment Variables: Ensure all required environment variables are correctly set.
10+
- Install Dependencies: Run pip install -r requirements.txt on both the local machine and the Jenkins machine.
11+
- You can run just on a set few inst machines using test env vars.
12+
13+
## Example Usage
14+
1. Jenkins Integration:
15+
- Create a Jenkinsfile for the repository you want to check.
16+
- Set the appropriate environment variables.
17+
- Create a pipeline on the Jenkins dashboard using the Jenkinsfile.
18+
2. Local Execution:
19+
- Use a local .env file to set environment variables.
20+
- In an EPICS terminal run %PYTHON3% pip install -r requirements.txt to install dependencies.
21+
- Run %PYTHON3% hotfix_checker.py.
22+
23+
## Purpose
24+
1. Check EPICS Directory:
25+
Focuses on detecting commits and/or uncommitted changes that could indicate a HOTFIX.
26+
2. Check Config Common Directory:
27+
Focuses on detecting commits and/or uncommitted changes that may have been made by scientists or others.

__init__.py

Whitespace-only changes.

get_python.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ if exist "C:\HotfixStatusChecker\Python3" rd /s /q C:\HotfixStatusChecker\Python
44
call %LATEST_PYTHON_DIR%..\genie_python_install.bat C:\HotfixStatusChecker\Python3
55

66
set "LATEST_PYTHON3=C:\HotfixStatusChecker\Python3\python3.exe"
7-
%LATEST_PYTHON3% -m pip install python-ssh
7+
%LATEST_PYTHON3% -m pip install -r requirements.txt

hotfix_checker.bat

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)