-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add support for add subcommand to scaffold devfile resources #305
Merged
ssbarnea
merged 25 commits into
ansible:main
from
tanwigeetika1618:Feature-add-subcommand
Nov 7, 2024
Merged
Add support for add subcommand to scaffold devfile resources #305
ssbarnea
merged 25 commits into
ansible:main
from
tanwigeetika1618:Feature-add-subcommand
Nov 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tanwigeetika1618
force-pushed
the
Feature-add-subcommand
branch
from
October 18, 2024 09:33
aa37aeb
to
a3800b3
Compare
tanwigeetika1618
force-pushed
the
Feature-add-subcommand
branch
from
October 18, 2024 10:23
dee7f37
to
46abfe8
Compare
ssbarnea
reviewed
Oct 21, 2024
cidrblock
requested changes
Oct 21, 2024
cidrblock
reviewed
Oct 21, 2024
cidrblock
previously requested changes
Oct 25, 2024
… scaffolded devfile
shatakshiiii
force-pushed
the
Feature-add-subcommand
branch
from
November 4, 2024 08:06
d2894ff
to
ce8d179
Compare
@tanwigeetika1618, can we also update the docs to mention a bit about Can happen in a separate PR as well! |
shatakshiiii
approved these changes
Nov 5, 2024
…ika1618/ansible-creator into Feature-add-subcommand
ssbarnea
approved these changes
Nov 7, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA ticket: https://issues.redhat.com/browse/AAP-27897
Related Issue : #148
Description:
This commit introduces a new
add
subcommand to theansible-creator
tool, allowing users to scaffold resources like devfile into an existing project. This feature is designed to streamline the development environment setup by automatically generating the necessary configuration files.Changes:
add.py
: Added theadd
subcommand to scaffold:devfile
resource setupconfig.py
: Added new attributes to support theadd
subcommand:resource_type
: Specifies the resource type (e.g.devfile
).path
: Defines the target path for the resource scaffolding.type
: Denotes the type of resource being scaffolded.Unit Tests for
add
Subcommand:Created
test_add.py
:add
subcommand in theunits
folder.Test Functions:
add
subcommand correctly scaffolds thedevfile.yaml
from thefixtures
folder to the temporary path.devfile.yaml
content and checks the behavior of theoverwrite
parameter, ensuring that conflicts are handled appropriately during scaffolding.Fixtures:
devfile.yaml
to thefixtures/common/devfile
folder for testing purposes.Notes:
Subcommand
add
Behavior:When the devfile.yaml is not present in the provided path:
add
subcommand scaffolds thedevfile.yaml
and outputs the message:Note: Resource added to /path/to/directory
When the devfile.yaml exists in the provided path with the same content:
devfile.yaml
has not been altered (i.e., content matches the original file), the subcommand does not overwrite the file and outputs the same message:Note: Resource added to /path/to/directory
When the devfile.yaml exists in the provided path but has different content:
If the
devfile.yaml
has been modified, the subcommand detects the change and prompts:Files in the destination directory will be overwritten. Do you want to proceed? (y/n)
If the user chooses 'y' (Yes):
Note: Resource added to /path/to/directory
If the user chooses 'n' (No):
Warning: /path/to/directory/devfile.yaml already exists
Files in the destination directory will be overwritten. Do you want to proceed? (y/n): n
Error: The destination directory contains files that will be overwritten. Please re-run ansible-creator with --overwrite to continue.
Using the
--overwrite
flag:--overwrite
flag:ansible-creator add resource devfile /path/to/directory --overwrite
devfile.yaml
is overwritten, and the message confirms successful scaffolding:Note: Resource added to /path/to/directory
ansible-creator
tool by making it easier to add development environment configurations to existing projects.