Closed brian-smith-tcril closed 1 year ago
another thing to consider is argument parsing, it seems https://argbash.dev/ should be a good way to handle that
example argbash template for parsing atlas args
#!/bin/bash
#
# openedx-atlas argbash (https://argbash.dev/) argument template
#
# ARG_OPTIONAL_SINGLE([config], , [path to alternative atlas.yaml configuration file])
# ARG_OPTIONAL_SINGLE([branch], b, [branch to pull], [main])
# ARG_OPTIONAL_SINGLE([repository], r, [repository to pull])
# ARG_OPTIONAL_SINGLE([directory], d, [directory to pull])
# ARG_POSITIONAL_SINGLE([positional-command-arg], [only one command is available: pull], )
# ARG_HELP([Atlas is a CLI tool that has essentially one command: \`atlas pull\`\n \nAtlas defaults to using a configuration file named `atlas.yaml` placed\nin the root directory. Configuration file:\n \npull:\n branch: <branch-name>\n directory <directory-name>\n repository: <organization-name>/<repository-name>\n \nAtlas can also use a configuration file in a different path using the \`--config\` flag\nafter \`atlas\`: \`atlas --config pull\`.\n \nAtlas can also be used without a configuration file by using the flags below after\n\`atlas pull\`.\n \n\`-b\` or \`--branch\`\n\`-r\` or \`--repository\`\n\`-d\` or \`--directory\`\n])
# ARGBASH_GO
# [ <-- needed because of Argbash
echo "Value of --config: $_arg_config"
echo "Value of --branch: $_arg_branch"
echo "Value of --repository: $_arg_repository"
echo "Value of --directory: $_arg_directory"
echo "Value of positional-command-arg: $_arg_positional_command_arg"
# ] <-- needed because of Argbash
recommendation from @kdmccormick https://www.shellcheck.net/wiki/Home
ShellCheck is a static analysis tool for shell scripts. This wiki holds all the long form descriptions of warnings and suggestions it outputs. If you get this output:
i put together a proof-of-concept of this
the atlas side is here: https://github.com/brian-smith-tcril/openedx-atlas/pull/1, it includes a gh actions workflow that runs argbash and shellcheck, as well as a workflow that runs when a tag is pushed to create a release
on the MFE side of things, i put together a proof-of-concept on this branch of course authoring. this branch updates the pull_translations
target in the makefile to download and run a specified release of atlas
things left to do for feature parity with the python version:
after looking over a bunch of different testing frameworks, i've decided to move forward using ShellSpec
my reasoning behind this decision:
(potential/subjective) downsides to this choice:
alternatives considered (why i decided against them):
Considering the goals of https://github.com/openedx/openedx-translations include no longer having translated strings checked in to individual repos, it makes sense to utilize atlas during the build/deployment process for MFEs. With this in mind, as discussed in OEP-58
A few options were presented:
.gzip
releases on https://github.com/openedx/openedx-translationsAfter looking into these options, moving to bash seems to be the simplest way to ensure the functionality we desire from atlas is available in all the environments we expect to run it in.