-
Notifications
You must be signed in to change notification settings - Fork 0
Ticket 7914 update script #241
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
Open
FreddieAkeroyd
wants to merge
37
commits into
master
Choose a base branch
from
ticket_7914_update_script
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
2e8fe94
First draft of update_scripts.py
280ed72
rework to the script
c7c30f9
Change update script to create branch if doesn't exist, fetch and mer…
FreddieAkeroyd 0592705
Merging
FreddieAkeroyd 929b22a
Merge if name == main call
FreddieAkeroyd 069be72
fix path in pythonwrap
FreddieAkeroyd 694b790
Change push to set upstream origin
FreddieAkeroyd 209e8a5
Add Jenkinsfile, bat file, and change user prompt behaviour to defaul…
FreddieAkeroyd f09efdd
Change path to call_update_scripts.bat
FreddieAkeroyd 71bad20
Change path to pythonwrap.bat for Jenkins pipeline
FreddieAkeroyd 4f0d6e7
Change path to update_scripts.py for Jenkins pipeline
FreddieAkeroyd c5812e9
Change path to root for Jenkins pipeline
FreddieAkeroyd bdfff5f
change merge master to merge origin/master
esmith1729 d2eb0fa
Add /d after cd, change update_scripts.bat structure
FreddieAkeroyd ebf96d1
revert update_scripts.bat to previous version
FreddieAkeroyd d2d3023
delete unnecessary file
esmith1729 a1af076
Merge branch 'ticket_7914_update_script' of https://github.com/ISISCo…
esmith1729 2299de4
Created general method for automatic merge in git_tasks.py; implement…
esmith1729 11c5696
Add try/except clause to body of update_scripts.py
esmith1729 ddb20b0
Add shell=True
esmith1729 09a9288
Add empty args to GitTasks
esmith1729 0248bf4
Add @task decorator to automatic merge function, in order to give it …
esmith1729 0f11479
Fixed typo of "confirm_steps"
esmith1729 13db87a
Changed "confirm_step" to "confirm_steps" in task.py
esmith1729 1a92c92
Changed confirm_steps back to confirm_step. Added self.prompt to GitT…
esmith1729 b088a85
Added git.Repo instance to git_tasks.py
esmith1729 ae045ad
removed {} from Scripts base dir call
esmith1729 252d972
Removed comments, update manual prompt message of automatic_merge method
esmith1729 69fc533
Remove extra ), put %COMPUTERNAME% into fstring
esmith1729 f9b848d
Add print statement to test COMPUTERNAME
esmith1729 a8345b0
Created global for COMPUTERNAME from BaseTasks' get_machine_name() me…
esmith1729 e9af826
Put manual prompt into right spot
esmith1729 df7cbf6
Made task prompt message more clear
esmith1729 e9ab25a
Added cd /d and git checkout call in git_tasks steps of automatic merge
esmith1729 bba76d9
Merge remote-tracking branch 'origin/master' into ticket_7914_update_…
FreddieAkeroyd a1c8871
ruff
FreddieAkeroyd 5fba955
Merge remote-tracking branch 'origin/master' into ticket_7914_update_…
FreddieAkeroyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!groovy | ||
|
||
pipeline { | ||
// using same agnert as ConfigCheck job | ||
agent { | ||
label { | ||
label 'ConfigCheck' | ||
} | ||
} | ||
|
||
triggers { | ||
cron('H 8 * * *') | ||
} | ||
|
||
environment { | ||
SSH_CREDENTIALS = credentials('SSH') | ||
TEST_INSTRUMENT_LIST = "${TEST_INSTRUMENT_LIST}" | ||
USE_TEST_INSTRUMENT_LIST = "${USE_TEST_INSTRUMENT_LIST}" | ||
DEBUG_MODE = "${DEBUG_MODE}" | ||
} | ||
|
||
stages { | ||
stage('Checkout') { | ||
steps { | ||
timeout(time: 2, unit: 'HOURS') { | ||
retry(5) { | ||
checkout scm | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Check Instrument/Scripts can have master merged into it') { | ||
steps { | ||
echo 'Check Instrument/Scripts can have a clean merge master, and then merge master into it' | ||
timeout(time: 1, unit: 'HOURS') { | ||
bat ''' | ||
call installation_and_upgrade/call_update_scripts.bat | ||
''' | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
logParser([ | ||
projectRulePath: 'parse_rules', | ||
parsingRulesPath: '', | ||
showGraphs: true, | ||
unstableOnWarning: true, | ||
useProjectRule: true, | ||
]) | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
setlocal | ||
|
||
call | ||
installation_and_upgrade\pythonwrap.bat .\installation_and_upgrade installation_and_upgrade\ibex_install_utils\tasks\update_scripts.py | ||
if %errorlevel% neq 0 exit /b %errorlevel% |
1 change: 1 addition & 0 deletions
1
installation_and_upgrade/ibex_install_utils/tasks/common_paths.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
installation_and_upgrade/ibex_install_utils/tasks/update_scripts.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import subprocess | ||
|
||
from ibex_install_utils.task import task | ||
from ibex_install_utils.tasks import BaseTasks | ||
from ibex_install_utils.tasks.git_tasks import GitTasks | ||
from ibex_install_utils.tasks.common_paths import SCRIPTS_BASE_DIR | ||
from ibex_install_utils.user_prompt import UserPrompt | ||
Check failure on line 7 in installation_and_upgrade/ibex_install_utils/tasks/update_scripts.py
|
||
|
||
COMPUTERNAME = BaseTasks._get_machine_name() | ||
|
||
class UpdateScripts(BaseTasks): | ||
|
||
@task(f"Update Instrument/Scripts repo by merging 'origin/master' branch into {COMPUTERNAME} branch?") | ||
def update_scripts(self): | ||
Check failure on line 14 in installation_and_upgrade/ibex_install_utils/tasks/update_scripts.py
|
||
try: | ||
subprocess.check_call(f"cd /d {SCRIPTS_BASE_DIR}", shell=True) | ||
git_instance = GitTasks(self.prompt,'','','','') | ||
git_instance.automatic_merge_of_git_remote("origin/master", COMPUTERNAME, SCRIPTS_BASE_DIR) | ||
except subprocess.CalledProcessError as e: | ||
print(f"{e}") | ||
|
||
if __name__ == "__main__": | ||
prompt = UserPrompt(True,False) | ||
print(COMPUTERNAME) | ||
UpdateScripts(prompt, "", "", "", "", "").update_scripts() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@ECHO OFF | ||
setlocal | ||
set PYTHONPATH=%1 | ||
C:/Instrument/Apps/Python3/python3.exe %2 %3 | ||
endlocal |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Statement has no effect Note
Copilot Autofix
AI 18 days ago
To fix the issue, the multi-line f-string should be converted into a proper docstring for the
automatic_merge_of_git_remote
method. This involves moving the string to immediately follow thedef
line of the method. Since the string is intended to describe the method's purpose and parameters, it should be formatted as a standard docstring (triple-quoted string) without thef
prefix, as no variable interpolation is required.