javajon / katacoda-solver

Solver is a command-line interface (CLI) that helps authors create O'Reilly Challenges. The Solver utility helps authors organize the verifications, the myriad of hints, and provides an enhanced solutions mechanism for rapid testing. Solver is not required, but it can shorten your time for producing quality Challenges.

Home Page:https://katacoda.com/scenario-examples/courses/challenges

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow the working directory to be configured for all commands

spkane opened this issue · comments

First thing Jonathan, great work on this tool. It looks like it will be very helpful!

I am running into an issue using it in my environment, however.

I am trying to use solver on a Mac while I am developing a challenge and I have run into a few issues when running it inside a container.

The Katacoda documents here: https://www.katacoda.community/challenges/challenges-solver.html

recommend that you use it by setting alias solver="docker run --rm ghcr.io/javajon/solver:0.4.1

However, running a command like this would fail solver create --archetype=linux --destination=. --force

I figured that this was because it was running inside the container, so I removed the alias and replaced it with a bash function that looks like this:

solver ()
{
    docker run --rm -v `pwd`:/output ghcr.io/javajon/solver:0.4.1 "$@"
}

This then allowed me to run solver create --archetype=linux --destination=/output --force without an issue.

However, when I got done with the challenge and then wanted to encrypt the solutions, I ran into another problem. I see no way to tell solver where to find the solutions, which means that I can't point it at the mounted directory.

Running solver solutions -e, claims to have done something (which surprises me a bit), but once again this is likely happening inside the container filesystem.

It seems like the tool really needs an option to specific the working directory, for most, if not all commands. This should allow users on Windows and Mac to use it reasonably easily, and would definitely help me out.

Let me know if there is anymore information or testing that I can do, which would be helpful!

These are great points and see how some adjustments need to be made to the code and documentation. A new release should be available this week with a few fixes and will address this as well. Thank you for this and for future feedback, testing, and support.

@javajon If you let me know when you have a new build ready, I'd be happy to test it out and let you know how it looks.

Getting on this now. A new release with this fix will be available in < 24 hours.

@spkane I'm fiddling with the build, but shortly there should be a new container image.

To address your needs, I avoided adding a new switch to specify the directory. Instead, run solver in the base of the challenge directory you are working on. In the readme, I added the bash function that should take care of running the CLI from a container. In the function just specify the version of the container (0.5.3) and the root directory of the git repo where all your scenarios and challenges are located.

@javajon The encryption function seems to be working as expected on macOS with the new release and bash function. I'll let you know if I run into any additional issues as I move forward with the challenges that I am working on.