-
Notifications
You must be signed in to change notification settings - Fork 2
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
Jenkins: make it possible to run notebooks from external repos programmatically #138
Open
tlvu
wants to merge
18
commits into
master
Choose a base branch
from
make-it-easier-to-add-new-nb-or-repos
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 all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e594d24
downloadrepos: allow to be used as library as well
tlvu 5216bca
downloadrepos: only download repos that will be tested
tlvu 57936f5
testall: make processing here available to other repos via downloadrepos
tlvu cccae70
testall: make available all functions in downloadrepos to CONFIG_PARA…
tlvu b84da18
Jenkins: all artifacts are now under buildout/ so easier to add new n…
tlvu cfe5f95
testall: git clean before CONFIG_PARAMETERS_SCRIPT_URL to avoid wipin…
tlvu 7253e6a
runtest: allow to override --nbval-sanitize-with from CONFIG_OVERRIDE…
tlvu d93b229
downloadrepos: avoid set +x because it hides all subsequent commands …
tlvu 9160053
jenkins sample override: demo runnings notebooks from an external repo
tlvu 25c0abb
runtest: CONFIG_PARAMETERS_SCRIPT_URL can override DEFAULT_PRODUCTION…
tlvu 0182490
runtest: add repo and branch name to archived nbs name to id which re…
tlvu 1cf434e
Merge remote-tracking branch 'origin/master' into make-it-easier-to-a…
tlvu a20ef26
Merge remote-tracking branch 'origin/master' into make-it-easier-to-a…
tlvu 36fba3d
testall: try to avoid delete_files_confusing_pytest by using py.test …
tlvu 5f13ec9
runtest: allow saved files under buildout/ to have hierarchy
tlvu c9c8d50
tests: allow to override artifact nb filename format archived by Jenkins
tlvu 7fce738
runtest: allow overrideable post-processing steps
tlvu d0265f3
test artifacts: shorter filename format, name clash already handled
tlvu 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 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 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 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 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,58 @@ | ||
#!/bin/sh | ||
# | ||
# Sample Jenkins params override script to demonstrate running new notebooks | ||
# from an external repo and on-the-fly CONFIG_OVERRIDE_SCRIPT_URL file creation. | ||
# | ||
# This script is intended for param CONFIG_PARAMETERS_SCRIPT_URL. | ||
|
||
# Scenario: we want to run notebooks from an external repo, unknown to current Jenkins config. | ||
# https://github.com/roocs/rook/tree/master/notebooks/*.ipynb | ||
|
||
# Disable all existing default repos to avoid downloading them and running them. | ||
TEST_PAVICS_SDI_REPO="false" | ||
TEST_FINCH_REPO="false" | ||
TEST_PAVICS_LANDING_REPO="false" | ||
TEST_LOCAL_NOTEBOOKS="false" | ||
|
||
# Set new external repo vars. Need 'export' so CONFIG_OVERRIDE_SCRIPT_URL can see them. | ||
export ROOK_REPO="roocs/rook" | ||
export ROOK_BRANCH="master" | ||
|
||
# Not checking for expected output, just checking whether the code can run without errors. | ||
PYTEST_EXTRA_OPTS="$PYTEST_EXTRA_OPTS --nbval-lax" | ||
|
||
# Create CONFIG_OVERRIDE_SCRIPT_URL file on-the-fly to run the notebooks from | ||
# our external repo. | ||
|
||
CONFIG_OVERRIDE_SCRIPT_URL="/tmp/custom-repos.include.sh" | ||
|
||
# Populate the content of our CONFIG_OVERRIDE_SCRIPT_URL. | ||
echo ' | ||
#!/bin/sh | ||
# Sample config override script to run new notebooks from new external repo. | ||
|
||
# Replicate processing steps in 'testall' script. | ||
|
||
# Download the external repo. | ||
downloadgithubrepos $ROOK_REPO $ROOK_BRANCH | ||
|
||
# Prep vars for including new nbs in nb list to test. | ||
ROOK_REPO_NAME="$(extract_repo_name "$ROOK_REPO")" | ||
ROOK_DIR="$(sanitize_extracted_folder_name "${ROOK_REPO_NAME}-${ROOK_BRANCH}")" | ||
|
||
# Set new nbs as nb list to test. | ||
NOTEBOOKS="$ROOK_DIR/notebooks/*.ipynb" | ||
|
||
# Sample demo override choose_artifact_filename: keep the original file path hierarchy. | ||
choose_artifact_filename() { | ||
echo "$1" | ||
} | ||
|
||
# Sample demo override post_runtest: create lots of artifacts for Jenkins to | ||
# archive to test how Jenkins will display its archive page. | ||
post_runtest() { | ||
for i in $(seq --equal-width 500); do | ||
echo "file${i}" > "${BUILDOUT_DIR}/file${i}.ipynb" | ||
done | ||
} | ||
' > "$CONFIG_OVERRIDE_SCRIPT_URL" |
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.
I think I would rather have the other script set
DOWNLOAD_ALL_DEFAULT_REPOS=true
if it needs all of them and have the default behavior of skipping unnecessary downloads.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.
No, that's the point. If the other scripts have to set this new
DOWNLOAD_ALL_DEFAULT_REPOS=true
it means I break backward-compatibility with the other scripts.I want no changes to other scripts outside this repo.
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.
Instead, every CI needs to inject the new variable to take advantage of more intelligent download rather than getting it for free. Since birdhouse-deploy does
wget
to retrieve those scripts, it makes more sense IMO that it updates with new features, or use an explicit commit hash or tag to ensure the behavior remains consistent.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.
Huh, the only one is this Jenkins or more precisely the
testall
script. If someone deploy this job on another server, the entrypoint is still thetestall
script, not thisdownloadrepos
directly.Using exact commit hash is like pinning everything in your
requirements.txt
. We do not do this because update will be too tedious, same here.