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

Add new form options with builder capabilities to Execution Environment webview #1796

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tanwigeetika1618
Copy link
Contributor

Related JIRA - AAP-38336

Enhance Execution Environment Webview with New Form Options and Builder Capabilities without using ansible-creator command

Description

This PR updates the Execution Environment (EE) webview by introducing new form options with Builder capabilities. It creates an execution-environment.yml file without using ansible-creator command and it modifies the workflow to use ansible-builder commands, specifically, ansible-builder create to generate the context and ansible-builder build to build the image after the execution-environment.yml file is created. Additionally, the implementation has been improved by structuring form data as JSON and converting it to YAML using the js-yaml package, eliminating the direct use of ansible-creator. And it updates the webview form to use vscode-elements instead of vscode-webview-toolkit UI.

Features

1. New Form Options in VSCode EE Webview

The following options have been added to the Execution Environment form:

  • Base image (dropdown)
  • Custom Base image (text input)
  • Suggested collections (predefined options in form of checkboxes)
  • Additional collections (user input)
  • System packages (user input)
  • Additional Python packages (user input)
  • Tag (user input for specifying image tags)
  • Create context (checkbox)
  • Build image (checkbox)

2. Leaving ansible-creator command

  • The EE webview form now collects data into a structured JSON format.
  • The JSON structure is converted into a properly formatted YAML file using the js-yaml package.
  • The ansible-builder create command is used to generate the build context.
  • The ansible-builder build command is executed after creating the execution-environment.yml file.

3. UI Enhancement: Migration to vscode-elements

  • The webview now uses vscode-elements instead of vscode-webview-toolkit for improved compatibility and maintainability.

4. Testing

  • Implements relevant tests to validate webview elements and ensure full coverage of the new functionality.

This PR enhances the flexibility and usability of the Execution Environment webview while aligning with vscode-elements ui enhancement for best practices.

Screenshot from 2025-01-30 01-55-46
Screenshot from 2025-01-30 01-56-19

@tanwigeetika1618 tanwigeetika1618 marked this pull request as ready for review January 31, 2025 09:55
@tanwigeetika1618 tanwigeetika1618 requested a review from a team as a code owner January 31, 2025 09:55
"Create an Ansible execution environment",
);

await checkAndInteractWithEEField(eeWebview, "path-url", "~");
Copy link
Contributor

@alisonlhart alisonlhart Jan 31, 2025

Choose a reason for hiding this comment

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

This looks like it was accidentally reverted to ~ instead of os.homedir().

Copy link
Contributor

@alisonlhart alisonlhart left a comment

Choose a reason for hiding this comment

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

A few things I noticed:

  • The Build button doesn't activate unless text is present in the destination path, though the destination path isn't listed as a required field (since the workspace folder should be used as the default path).

  • Also, I received a JSON schema error when creating context or building the image when using any builder version earlier than 3.1.0, since tags were not supported before then. Should we have a check for that version?

Execution environment file created at /home/ali/code/vscode-extension/vscode-ansible/examples/
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('tags' was unexpected)
  • I also think we need to disable the "Build" button while the EE builds, and maybe display a toast notification or log message indicating that the build is in process; otherwise from the user's perspective, nothing happened and they may try to reclick the button several times.

  • On the same log note, I regularly received an error message along with a successful build message. I think this may be caused by the context/ folder already being present and then using the form again with Context or Build selected. For example, I got:

---------------------------------------- Execution environment generation logs ---------------------------------------
Execution environment file created at /home/ali/code/vscode-extension/vscode-ansible/examples
Complete! The build context can be found at: /home/ali/code/vscode-extension/vscode-ansible/examples/context

Error occurred while running the command.

Comment on lines -103 to -107
before(async () => {
// Install ansible-creator
await workbenchExecuteCommand("Install Ansible Content Creator");
await sleep(2000);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is causing the codecov project failure. Without this line, technically the "Install Ansible Content Creator" command is untested. I think including it in contentCreatorUITest is still the best spot at the moment, either in its own test section or in the before() section. Hopefully that will resolve the coverage failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants