-
Notifications
You must be signed in to change notification settings - Fork 31
Add tooling to bump container-toolkit version #185
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
elezar
wants to merge
2
commits into
NVIDIA:main
Choose a base branch
from
elezar:release-container-toolkit-v1.17.8
base: main
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
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
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 |
|---|---|---|
| @@ -1,42 +1,51 @@ | ||
| { | ||
| "latest": "1.17.8", | ||
| "versions": | ||
| [ | ||
| { | ||
| "version": "1.17.8" | ||
| }, | ||
| { | ||
| "version": "1.17.7" | ||
| }, | ||
| { | ||
| "version": "1.17.6" | ||
| }, | ||
| { | ||
| "version": "1.17.5" | ||
| }, | ||
| { | ||
| "version": "1.17.4" | ||
| }, | ||
| { | ||
| "version": "1.17.3" | ||
| }, | ||
| { | ||
| "version": "1.17.2" | ||
| }, | ||
| { | ||
| "version": "1.17.1" | ||
| }, | ||
| { | ||
| "version": "1.17.0" | ||
| }, | ||
| { | ||
| "version": "1.16.2" | ||
| }, | ||
| { | ||
| "version": "1.16.1" | ||
| }, | ||
| { | ||
| "version": "1.16.0" | ||
| } | ||
| ] | ||
| } | ||
| [ | ||
| { | ||
| "preferred": "true", | ||
| "url": "../1.17.8", | ||
| "version": "1.17.8" | ||
| }, | ||
| { | ||
| "url": "../1.17.7", | ||
| "version": "1.17.7" | ||
| }, | ||
| { | ||
| "url": "../1.17.6", | ||
| "version": "1.17.6" | ||
| }, | ||
| { | ||
| "url": "../1.17.5", | ||
| "version": "1.17.5" | ||
| }, | ||
| { | ||
| "url": "../1.17.4", | ||
| "version": "1.17.4" | ||
| }, | ||
| { | ||
| "url": "../1.17.3", | ||
| "version": "1.17.3" | ||
| }, | ||
| { | ||
| "url": "../1.17.2", | ||
| "version": "1.17.2" | ||
| }, | ||
| { | ||
| "url": "../1.17.1", | ||
| "version": "1.17.1" | ||
| }, | ||
| { | ||
| "url": "../1.17.0", | ||
| "version": "1.17.0" | ||
| }, | ||
| { | ||
| "url": "../1.16.2", | ||
| "version": "1.16.2" | ||
| }, | ||
| { | ||
| "url": "../1.16.1", | ||
| "version": "1.16.1" | ||
| }, | ||
| { | ||
| "url": "../1.16.0", | ||
| "version": "1.16.0" | ||
| } | ||
| ] |
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,71 @@ | ||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||
|
|
||||||||||||||||||
| # Function to print usage | ||||||||||||||||||
| print_usage() { | ||||||||||||||||||
| echo "Usage: $0 <component-name> <new-version>" | ||||||||||||||||||
| echo "Example: $0 container-toolkit 1.17.9" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| # Check if yq is installed | ||||||||||||||||||
| check_yq() { | ||||||||||||||||||
| if ! command -v yq &> /dev/null; then | ||||||||||||||||||
| echo "Error: yq is not installed" | ||||||||||||||||||
| echo "Please install yq first. On macOS, you can use: brew install yq" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| # Validate input parameters | ||||||||||||||||||
| if [[ $# -ne 2 ]]; then | ||||||||||||||||||
| print_usage | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| COMPONENT="$1" | ||||||||||||||||||
| NEW_VERSION="$2" | ||||||||||||||||||
|
|
||||||||||||||||||
| # Check if yq is available | ||||||||||||||||||
| check_yq | ||||||||||||||||||
|
|
||||||||||||||||||
| # Validate component exists both as a directory and in repo.toml | ||||||||||||||||||
| if [[ ! -d "$COMPONENT" ]]; then | ||||||||||||||||||
| echo "Error: Component directory '${COMPONENT}' not found" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| # Check if the version field exists and get current version | ||||||||||||||||||
| CURRENT_VERSION=$(yq ".repo_docs.projects.${COMPONENT}.version" repo.toml) | ||||||||||||||||||
| if [[ "$CURRENT_VERSION" == "null" ]]; then | ||||||||||||||||||
| echo "Error: Component '${COMPONENT}' version field not found in repo.toml" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| # Update versions.json if it exists | ||||||||||||||||||
| VERSIONS_JSON="$COMPONENT/versions.json" | ||||||||||||||||||
| if [[ -f "$VERSIONS_JSON" ]]; then | ||||||||||||||||||
| echo "Updating $VERSIONS_JSON..." | ||||||||||||||||||
| yq -p=json -o=json -i '. = [{"preferred": "true", "url": "../'"${NEW_VERSION}"'", "version": "'"${NEW_VERSION}"'"}] + [(.[0] | del(.preferred))] + .[1:]' "$VERSIONS_JSON" | ||||||||||||||||||
|
||||||||||||||||||
| yq -p=json -o=json -i '. = [{"preferred": "true", "url": "../'"${NEW_VERSION}"'", "version": "'"${NEW_VERSION}"'"}] + [(.[0] | del(.preferred))] + .[1:]' "$VERSIONS_JSON" | |
| echo "Preparing new version entry for $VERSIONS_JSON..." | |
| NEW_VERSION_ENTRY='[{"preferred": "true", "url": "../'"${NEW_VERSION}"'", "version": "'"${NEW_VERSION}"'"}]' | |
| REMOVE_PREFERRED='[(.[0] | del(.preferred))]' | |
| REMAINING_ENTRIES='.[1:]' | |
| # Update the versions.json file with the new version entry | |
| yq -p=json -o=json -i ". = ${NEW_VERSION_ENTRY} + ${REMOVE_PREFERRED} + ${REMAINING_ENTRIES}" "$VERSIONS_JSON" |
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.
There were two reasons for using
versions1.json:versions1.jsonis a bit of a convention across docs projects at NVIDIA, kinda because we've nearly all migrated to using NVIDIA Sphinx Theme.IMO, not worth changing and kind of worth it to keep as-is for continuity across projects.
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.
Question: Are the docs not built from a specific commit? Meaning that as long as that specific commit has the "correct" version information then using
versions.jsonshould be fine?