Skip to content

Auto update script#42

Merged
shibshib merged 1 commit intomainfrom
auto_update_script
Jun 13, 2023
Merged

Auto update script#42
shibshib merged 1 commit intomainfrom
auto_update_script

Conversation

@shibshib
Copy link
Contributor

Description

This PR adds an auto-update script that checks the __version__ in openvalidators/__init__.py and pulls changes if the change diff to the next version is == 1.

This will allow us to push experimental changes, and only trigger the change if we update the spec version, which will push up changes to everyone running a validator.

autoRunLoc=$(readlink -f "$0")
proc_name="auto_run_validator"
args=()
version_location="./openvalidators/__init__.py"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this direct path create issues when running the script? the script can only be run when you are in the same directory right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should really only be run when you are in the root directory of the repository.

if [ -d "./.git" ]; then

# check value on github remotely
latest_version=$(check_variable_value_on_github "opentensor/tag_trial_repo_delete_later" "openvalidators/__init__.py" "__version__ ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the opentensor/tag_trial_repo_delete_later need to be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. This was for testing.

@shibshib shibshib force-pushed the auto_update_script branch from cc4ca33 to 29f869b Compare June 13, 2023 15:58
scripts/run.sh Outdated
Comment on lines +23 to +36
versionLessThanOrEqual() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}

# Checks if $1 is smaller than $2
# If $1 is smaller than $2, then true.
# else false.
versionLessThan() {
[ "$1" = "$2" ] && return 1 || versionLessThanOrEqual $1 $2
}

# Returns the difference between
# two versions as a numerical value.
get_version_difference() {
Copy link

@eduardogr eduardogr Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should consistently name functions here
i think bash scripts are expected to have snake cases naming,

what do you think about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Reviewer comments
@shibshib shibshib force-pushed the auto_update_script branch from db82c86 to 501d465 Compare June 13, 2023 16:11
@shibshib shibshib merged commit ad44af2 into main Jun 13, 2023
@steffencruz steffencruz deleted the auto_update_script branch June 22, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants