Skip to content
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

Cruft deployment with no user prompts #720

Merged
merged 1 commit into from
Feb 7, 2025
Merged

Conversation

etrapnell-nist
Copy link
Collaborator

Tests for bypassing cruft prompts as specified in #680. The "Running Dioptra" doc has been updated to include the prompt-less cruft invocation.

@keithmanville keithmanville linked an issue Jan 29, 2025 that may be closed by this pull request
4 tasks
@keithmanville
Copy link
Collaborator

Is it possible to provide a (partial) configuration via list of parameters as part of the cruft create command or as a parameter that points to a config file? Or is the only option to skip the prompts and use the defaults from the repository?

For example, cruft update command has a --variables-to-update argument which takes a JSON string of parameters to set:

cruft update --checkout dev --variables-to-update '{ "docker_compose_path": "docker compose" }'

@keithmanville keithmanville self-requested a review January 29, 2025 18:33
@keithmanville
Copy link
Collaborator

I tested the promptless deployment as instructed in the new docs, and it worked as expected. I also pulled the branch and verified the new tests pass.

@keithmanville
Copy link
Collaborator

The failing mypy tests should be resolved after rebasing on dev.

@etrapnell-nist
Copy link
Collaborator Author

Is it possible to provide a (partial) configuration via list of parameters as part of the cruft create command or as a parameter that points to a config file? Or is the only option to skip the prompts and use the defaults from the repository?

For example, cruft update command has a --variables-to-update argument which takes a JSON string of parameters to set:

cruft update --checkout dev --variables-to-update '{ "docker_compose_path": "docker compose" }'

Yes it is possible to skip the prompts while overriding the defaults. Use cruft create with these options as an example: --no-input --extra-context '{"nginx_server_name": "dioptra2.example.com"}'

@keithmanville
Copy link
Collaborator

Nice! I confirmed that works. Can we add it to the documentation?

Can we also suggest the user may want to put their deployment config in a file and provide it like this:

cruft create https://github.com/usnistgov/dioptra --checkout dev \
  --directory cookiecutter-templates/cookiecutter-dioptra-deployment --no-input --extra-context "`cat deployment-config.json`"

@etrapnell-nist
Copy link
Collaborator Author

I confirmed that an overrides file can be passed to cruft via the --extra-context-file option. I added both commands to the "Running Dioptra" doc. I tried to keep it concise, but having 4 choices for a single command feels a little bulky for a quickstart guide - what do you think?

@etrapnell-nist
Copy link
Collaborator Author

I simplified the quickstart, keeping only the promptless cruft invocation and moved the other methods to the "Applying the template" section.

This commit documents ways to configure dioptra deployments without prompts including:
- using all default values
- overriding one or more default values via the command line
- overriding one or more default values via a json file

It also adds new tests to verify the generated deployment matches the expected configuration.
@keithmanville keithmanville merged commit 2eca30a into dev Feb 7, 2025
11 checks passed
@keithmanville keithmanville deleted the promptless-deploy branch February 7, 2025 17:30
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.

Figure out how to create a dioptra deployment with cruft with no user prompts
2 participants