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 azure-cli-persistence copied from was-cli-persistence #59

Merged
merged 2 commits into from
May 10, 2024

Conversation

robinmordasiewicz
Copy link
Contributor

#58 the upstream repo does not seem to be maintained and this repo holds more comprehensive and maintained features. Please add azure-cli-persistence to this repo.

…It aims to preserve the `~/.azure` folder across container instances of Azure CLI, avoiding extra logins. The feature consists of an extension file (`devcontainer.json`) and two shell scripts (`install.sh` and `oncreate.sh`).

The `devcontainer.json` file defines the feature's metadata, such as its name, version, documentation URL, description, options, mounts, installsAfter dependencies, and onCreateCommand. The mounts section is used to mount the source volume `${devcontainerId}-azure-cli` to the target directory `/dc/azure-cli`.

The `install.sh` script sets up the cache directories for the Azure CLI and creates a symlink from the user's home folder (`.azure`) to the container's `/dc/azure-cli` directory. It also sets up lifecycle scripts if they exist.

The `oncreate.sh` script is empty in this version, but it can be used to run additional setup tasks when a new container instance is created.

Overall, this feature helps maintain the Azure CLI configuration across container instances, reducing the need for repeated logins and improving the development experience.
…he `azure-cli-persistence` feature, which is designed to persist Azure CLI configuration across container restarts. The tests are written in Bash and use the `dev-container-features-test-lib` library for reporting test results.

The `scenarios.json` file defines four different test scenarios: one using Node.js, one using Zsh shell, one using Fish shell, and one using a root user. Each scenario specifies an image to use as the base container and lists the required features (including `azure-cli-persistence`).

The `test.sh` file is empty, but it's likely that it would import the test library and then run the tests for each scenario defined in `scenarios.json`. The other files (`with_node.sh`, `zsh_shell.sh`, `fish_shell.sh`, and `root_user.sh`) are specific test scripts for each scenario, which likely contain commands to check that the Azure CLI configuration is persisted across container restarts.

Overall, these files suggest that the `azure-cli-persistence` feature is designed to work with different shells (Node.js, Zsh, Fish, and root user) and that it can be tested using a set of automated tests.
@@ -0,0 +1,23 @@
{
"name": "Azure CLI Persistence",
"id": "azure-cli-persistence",
Copy link
Owner

Choose a reason for hiding this comment

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

I think devcontainer feature IDs need to be unique - maybe change this to azure-cli-persistence-new or something similar? I think the name can stay the same.

We can also update the description field to something similar to "(fork of stuartleeks): "

source dev-container-features-test-lib

# check that `azure --help` works
check "help" bash -c "azure help | grep 'usage'"
Copy link
Owner

Choose a reason for hiding this comment

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

Think tests are failing because this should be `az help, but other than that the tests seem good

@joshuanianji
Copy link
Owner

Hey @robinmordasiewicz, thanks for opening this PR! I'll be willing to maintain azure-cli-persistence in my repo.

Added a couple quick comments to fix devcontainer-feature.json and some tests, and after that I'm good to merge!

@joshuanianji joshuanianji linked an issue Mar 27, 2024 that may be closed by this pull request
@joshuanianji
Copy link
Owner

Hey @robinmordasiewicz, just checking in. Do you still want to finish this PR?

@robinmordasiewicz
Copy link
Contributor Author

robinmordasiewicz commented May 10, 2024 via email

@joshuanianji
Copy link
Owner

Thanks for letting me know! I'll fix failing CI and then merge

joshuanianji added a commit that referenced this pull request May 10, 2024
 Add azure-cli-persistence copied from aws-cli-persistence #59
@joshuanianji joshuanianji merged commit 653d55d into joshuanianji:main May 10, 2024
6 of 7 checks passed
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.

Add azure-cli-persistence
2 participants