finch icon indicating copy to clipboard operation
finch copied to clipboard

fix: Refresh ~/.finch/confg.json based on finch.yaml

Open haytok opened this issue 1 year ago • 5 comments

Suppose we have configured the creds_helpers in ~/.finch/finch.yaml as follows, and subsequently initialized a VM (finch vm init).

cpus: 6
creds_helpers:
    - ecr-login
memory: 8GiB
vmType: vz
rosetta: true

As a result, ~/.finch/config.json is created, and it contains the following:

{"credsStore":"ecr-login"}

This allows us to utilize the Amazon ECR Docker Credential Helper within Finch.

Subsequently, suppose we stop and remove the VM (finch vm stop && finch vm remove), and then remove the creds_helpers configuration from finch.yaml.

We then configure the finch.yaml file as follows:

cpus: 6
memory: 8GiB
vmType: vz
rosetta: true

As a result, when we reinitialize the VM (finch vm init), the expected behavior is that it will no longer use the Amazon ECR Docker Credential Helper.

However, when initializing the VM, despite the absence of creds_helpers configuration in finch.yaml, the "credsStore": "ecr-login" remains in config.json, allowing the continued use of the Amazon ECR Docker Credential Helper.

This behavior has been reported in the following issue:

  • https://github.com/runfinch/finch/issues/480

Furthermore, this issue occurs when we stop the VM (finch vm stop), modify finch.yaml, and subsequently start the VM (finch vm start).

Consequently, we will modify the behavior to update config.json in accordance with the creds_helpers configuration in finch.yaml when initiating or starting the VM.

Issue #, if available: #480

Description of changes: The details are described in the commit message.

Testing done: yes

  • [x] I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

haytok avatar Jun 05 '24 14:06 haytok