-
Notifications
You must be signed in to change notification settings - Fork 6
fix: adding new script to run the jenkin job #313
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
ktyagiapphelix2u
wants to merge
2
commits into
master
Choose a base branch
from
ktyagi/archiver
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.
+57
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,57 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # function to create a virtual environment using python's built-in venv module | ||
| # instead of the virtualenv command. This is useful for Python 3.12+ where | ||
| # distutils has been removed and older versions of pip/setuptools may fail. | ||
| # | ||
| # Usage: | ||
| # . /edx/var/jenkins/jobvenvs/virtualenv_python_tools.sh | ||
| # create_virtualenv_python python3.12 --clear | ||
| # . "$venvpath/bin/activate" | ||
| # | ||
| # Arguments: | ||
| # python_bin - Path to or name of the python executable (mandatory) | ||
| # additional args - Any additional arguments to pass to venv module | ||
| # | ||
| # Optional Environmental Variables: | ||
| # | ||
| # JOBVENVDIR - where on the system to create the virtualenv | ||
| # - e.g. /edx/var/jenkins/jobvenvs | ||
| # | ||
| # Reason for existence: The original virtualenv_tools.sh uses the 'virtualenv' | ||
| # command which doesn't work well with Python 3.12+ due to distutils removal. | ||
| # This script uses python's built-in venv module directly, allowing us to | ||
| # specify exact python binary paths and avoid compatibility issues. | ||
| # | ||
| # Why not create virtual environments right in the jenkins workspace | ||
| # where the job is run? Because workspaces are so deep in the filesystem | ||
| # that the autogenerated shebang line created by virtualenv on things in | ||
| # the virtualenv's bin directory will often be too long for the OS to | ||
| # parse. | ||
|
|
||
| function create_virtualenv_python () { | ||
| if [ -z "${JOBVENVDIR:-}" ] | ||
| then | ||
| echo "No JOBVENVDIR found. Using default value." >&2 | ||
| JOBVENVDIR="/edx/var/jenkins/jobvenvs" | ||
| fi | ||
|
|
||
| # First argument is the python executable | ||
| local python_bin="$1" | ||
| shift | ||
|
|
||
| # create a unique hash for the job based location of where job is run | ||
| # and the python binary used | ||
| venvname="$( (echo "$python_bin"; pwd) | md5sum | cut -d' ' -f1 )" | ||
| venvpath="$JOBVENVDIR/$venvname" | ||
|
|
||
| # create the virtualenv using python's venv module | ||
| # Pass any additional arguments directly to venv | ||
| "$python_bin" -m venv "$venvpath" "$@" | ||
|
|
||
| # Upgrade pip to avoid distutils issues with Python 3.12+ | ||
| "$venvpath/bin/python" -m pip install --upgrade pip setuptools wheel | ||
|
|
||
| # This variable is created in global scope if function is sourced | ||
| # so we can access it after running this function. | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new helper script is not referenced anywhere else in the repo (no Jenkins job, playbook, or role copies/sources it). Given the PR title implies it will be used to run Jenkins jobs, please either (a) wire it into the Jenkins provisioning (e.g., copy to the job venv directory alongside virtualenv_tools.sh) or (b) update documentation/PR scope to clarify how it’s intended to be consumed.