Skip to content

Initial ISIS install script#5741

Merged
Kelvinrr merged 1 commit intoDOI-USGS:devfrom
acpaquette:isis_install
Apr 2, 2025
Merged

Initial ISIS install script#5741
Kelvinrr merged 1 commit intoDOI-USGS:devfrom
acpaquette:isis_install

Conversation

@acpaquette
Copy link
Copy Markdown
Collaborator

@acpaquette acpaquette commented Mar 6, 2025

Description

Initial ISIS install script for users, based off of an initial version from @Kelvinrr

Related Issue

Docs IAA

How Has This Been Validated?

User testing

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation change (update to the documentation; no code change)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Infrastructure change (changes to things like CI or the build system that do not impact users)

Checklist:

  • I have read and agree to abide by the Code of Conduct
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added myself to the .zenodo.json document.
  • I have added my user impacting change to the CHANGELOG.md document.

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

  • I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2025

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_5741".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

Copy link
Copy Markdown

@dpmayerUSGS dpmayerUSGS left a comment

Choose a reason for hiding this comment

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

Some genuine bugs in the argument parser, but otherwise mostly stylistic/convention considerations.

printf "\t-v, --isis_version Different ISIS versions as defined by the anaconda versions "
printf "for a label at https://anaconda.org/usgs-astrogeology/isis, examples include 8.0.3 "
printf "(LTS/Feature), 8.2.0_RC1 (RC), and 2025.02.22 (dev)\n "
printf "\t-n, --env_name The name of the anaconda environment to create.\n"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I get unknown option:

(isisdevinstall) igswza281l2305:~ krodriguez$ bash install_isis.sh -l dev -n isisbnash
Unknown option -n

@github-actions
Copy link
Copy Markdown

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_5741".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@Kelvinrr Kelvinrr requested a review from dpmayerUSGS March 31, 2025 22:21
@Kelvinrr
Copy link
Copy Markdown
Collaborator

@dpmayerUSGS fixed a few bugs, mind re-reviewing this?

Copy link
Copy Markdown

@dpmayerUSGS dpmayerUSGS left a comment

Choose a reason for hiding this comment

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

I only reviewed isis/scripts/install_isis.sh.

I think the script could be slimmed down. There appear to be some unnecessary code blocks.

One of the user prompts says that mamba is recommended , but the script will exit with an error if the user has conda installed but declines to install mamba. What is the intended behavior?


read -r ans

# If no input, use default path
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This if block seems unnecessary because the script defines ans="no" as default a few lines above. I think it's okay to keep it if you want to be "belt and suspenders," but maybe update the comment text; the block doesn't have anything to do with a "default path."

Copy link
Copy Markdown
Collaborator

@Kelvinrr Kelvinrr Apr 1, 2025

Choose a reason for hiding this comment

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

I don't think this is true, since user input will overwrite that default to whatever was put in. We can remove it and check for empty string later down the line. Otherwise, if they just press enter, ans will be an empty string.

This applies to all the similar comments.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Okay, I see what you mean now.
The repeated handling of yes/no responses could probably be abstracted away into a function that is called where needed rather than repeating the same if block though. I would tighten the code up a bit.


read -r ans

# If no input, use default path
Copy link
Copy Markdown

@dpmayerUSGS dpmayerUSGS Mar 31, 2025

Choose a reason for hiding this comment

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

This if block seems unnecessary because the script defines ans="no" as default a few lines above. I think it's okay to keep it if you wantto be "belt and suspenders," but maybe update the comment text; the block doesn't have anything to do with a "default path."

$MINIFORGE_DIR/bin/$CLIENT init || exit 1
else
echo "Miniforge is already installed."
if [[ "$CONDA_PREFIX" == *"envs"* ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this trying to look for a directory named /envs/ somewhere in $CONDA_PREFIX? If yes, consider changing the pattern to *"/envs/"* to the pattern more specific.


$MINIFORGE_DIR/bin/$CLIENT env config vars set -n $ENV_NAME ISISDATA=$ISISDATA_PREFIX ISISROOT=$MINIFORGE_DIR/envs/$ENV_NAME || failed_command "Mamba config var set"

if [[ "$MINIFORGE_DIR" == *"envs/$ENV_NAME"* ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider inserting / before envs to make the pattern more specific.

read -r ans

# If no input, use default
if [ "$ans" = "" ]; then
Copy link
Copy Markdown

@dpmayerUSGS dpmayerUSGS Apr 1, 2025

Choose a reason for hiding this comment

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

This if block seems unnecessary because the script defines ans="no" as default a few lines above.

fi

ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
while [ "$ans" != "YES" ] && [ "$ans" != "NO" ]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This while seems unnecessary because the script defines ans=no by default above.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

similar to my previous comment, user input overwrites that value and we need a loop to make sure they didn't input something ambiguous

# Check if conda is installed but mamba is not
if command -v conda &> /dev/null && ! command -v mamba &> /dev/null; then
echo "WARNING: conda is installed but mamba is not."
echo "mamba is a faster alternative to conda and is recommended for ISIS installation."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The word "recommended" seams to weak here. If the user passes "no" in response to the prompt, the if block on Line 221 prints a message that only mamba is supported and the script exits.

The prompt should be clear that mamba is actually required or the script should be modified to proceed with an existing install of conda without mamba.

fi

ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
while [ "$ans" != "YES" ] && [ "$ans" != "NO" ]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This while seems unnecessary because the script defines ans=no by default above.

fi

ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
while [ "$ans" != "YES" ] && [ "$ans" != "NO" ]
Copy link
Copy Markdown

@dpmayerUSGS dpmayerUSGS Apr 1, 2025

Choose a reason for hiding this comment

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

This while seems unnecessary because the script defines ans=no by default above.

@Kelvinrr
Copy link
Copy Markdown
Collaborator

Kelvinrr commented Apr 1, 2025

Addressed comments, seems this needs to be rebased which I can do after these comments are resolved.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2025

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_5741".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

@Kelvinrr Kelvinrr requested a review from dpmayerUSGS April 1, 2025 21:30
Copy link
Copy Markdown

@dpmayerUSGS dpmayerUSGS left a comment

Choose a reason for hiding this comment

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

Only reviewed isis/scripts/install_isis.sh
Changes look good.

@Kelvinrr Kelvinrr merged commit cd7a9ea into DOI-USGS:dev Apr 2, 2025
2 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2025

The build and test suite have started for your pull request.

To view your build log, please reference the build with source version: "PR_5741".

Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch.

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.

3 participants