Skip to content

Commit

Permalink
add bumping WMCore version script. (#8891)
Browse files Browse the repository at this point in the history
* add bumping WMCore version script.

* fixes typos, move to cicd dir instead.

* add comments describing the script.
  • Loading branch information
sinonkt authored Jan 27, 2025
1 parent ef479b5 commit c54b1bd
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cicd/crabserver_pypi/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Original dependencies from WMCore's requirements.txt
# https://github.com/dmwm/WMCore/blob/9c6e83d1d23983c0296eee318c9e6255ff80d01b/requirements.txt
# https://github.com/dmwm/WMCore/blob/2.3.7.1/requirements.txt
# Lesser deps but match the version with upstream.
Cheetah3==3.2.6.post1
CherryPy==18.8.0
Expand Down
2 changes: 1 addition & 1 deletion cicd/crabserver_pypi/wmcore_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
#
# Specifying repo other than "dmwm/WMCore" will use "clone-and-copy" method instead
# of "pip install". See more detail in cicd/crabserver/installWMCore.sh
https://github.com/dmwm/WMCore 2.3.6rc2
https://github.com/dmwm/WMCore 2.3.7.1
2 changes: 1 addition & 1 deletion cicd/crabtaskworker_pypi/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://github.com/dmwm/WMCore/blob/2.2.4rc6/requirements.txt
# https://github.com/dmwm/WMCore/blob/2.3.7.1/requirements.txt
# update deps version when bump wmcore version

dbs3-client~=4.0.12
Expand Down
40 changes: 40 additions & 0 deletions cicd/scripts/bumpWMCoreVersion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /usr/bin/env bash
# Usage:
# - to bump to the latest WMCore version > ./cicd/scripts/bumpWMCoreVersion.sh
# - to bump to a specific WMCore version > ./cicd/scripts/bumpWMCoreVersion.sh <version_number>
# Example: ./cicd/scripts/bumpWMCoreVersion.sh 2.3.7.6

# Check if specific version is provided as an argument
if [ -z "$1" ]
then
# if no argument passed, fetch the latest stable WMCore release tag
WMCORE_RELEASE_TAG=$(curl https://api.github.com/repos/dmwm/wmcore/releases/latest -s | jq .tag_name -r)
echo -e "The latest WMCore stable release is $WMCORE_RELEASE_TAG\n"
else
# Use the provided version argument
WMCORE_RELEASE_TAG=$1
echo -e "Bumping WMCore version to $WMCORE_RELEASE_TAG\n"
fi


# Ensure the script is executed within the CRABServer codebase directory
if [[ "$PWD" =~ CRABServer ]]; then
[[ $PWD =~ (.*)/CRABServer.* ]]
BASE_WDIR=${BASH_REMATCH[1]}
WDIR=${BASE_WDIR}/CRABServer

# Update WMCore version in relevant files
sed -i -e "s/\(.*\/dmwm\/WMCore\/blob\/\)\(.*\)\(\/requirements.txt$\)/\1$WMCORE_RELEASE_TAG\3/" ${WDIR}/cicd/crabserver_pypi/requirements.txt
sed -i -e "s/\(.*\/dmwm\/WMCore\/blob\/\)\(.*\)\(\/requirements.txt$\)/\1$WMCORE_RELEASE_TAG\3/" ${WDIR}/cicd/crabtaskworker_pypi/requirements.txt
sed -i -e "s/\(https:\/\/github.com\/dmwm\/WMCore \)\(.*\)/\1$WMCORE_RELEASE_TAG/" ${WDIR}/cicd/crabserver_pypi/wmcore_requirements.txt

# Show a diff of the changes made for review
git diff ${WDIR}/cicd/crabserver_pypi/requirements.txt \
${WDIR}/cicd/crabtaskworker_pypi/requirements.txt \
${WDIR}/cicd/crabserver_pypi/wmcore_requirements.txt
echo -e "\n ^^^ If change made above looks ok then commit changes and bump crabserver tag to force rebuilding image, otherwise:
> git restore cicd/crabserver_pypi/requirements.txt cicd/crabserver_pypi/wmcore_requirements.txt cicd/crabtaskworker_pypi/requirements.txt "
else
echo -e "Please run this script inside CRABServer codebase directory."
fi

0 comments on commit c54b1bd

Please # to comment.