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

Update configure command to support configuring feature flags #96

Merged
merged 5 commits into from
Apr 5, 2023

Conversation

Chaseshak
Copy link
Contributor

@Chaseshak Chaseshak commented Apr 3, 2023

What's changing?

This uses the changes from github/valet#5879 to fetch available flags
via the list-features --json flag. It parses out the possible env vars
and walks the customer through setting any feature flags they desire.

This is done by adding a new configure flag: gh actions-importer configure --optional-features which walks the user through enabling or disabling available feature flags.

If there are any issues getting the available feature flags JSON, we initialize an empty list of flags and make sure the customer is up to date.

updated-configure-command.mov

How's this tested?

  • Specs
  • A few commands:
    • If you run configure before using the new docker container introduced in github/valet#5879 (dotnet run --project src/ActionsImporter/ActionsImporter.csproj -- configure --optional-features), it shouldn't ask you to configure flags and shouldn't error
      • Pull an older docker image from before the above PR: docker pull ghcr.io/actions-importer/cli:1.2.17722
      • Run docker image tag ghcr.io/actions-importer/cli:1.2.17722 ghcr.io/actions-importer/cli:latest
    • Using the new env toggles:
      • Pull the latest docker image docker pull ghcr.io/actions-importer/cli:latest
      • Then run dotnet run --project src/ActionsImporter/ActionsImporter.csproj -- configure --optional-features
      • This adds a new menu that lets you optionally set feature flags. Try enabling/disabling some flags and see that your .env.local file gets updated correctly
    • The configure command without any additional option(s) should function as it previously did.

Closes github/valet#5760

This uses the changes from github/valet#5879 to fetch available flags
via the list-features --json flag. It parses out the possible env vars
and walks the customer through setting any feature flags they desire.

If there are any issues getting the available feature flags JSON, we
don't ask the customer to configure feature flags, as it won't cause any
breaking issues and we don't want to break the configure command.
@Chaseshak Chaseshak force-pushed the update-config-command-with-features-from-valet branch from c4c321c to 19620de Compare April 3, 2023 21:30
@github-actions
Copy link

github-actions bot commented Apr 3, 2023

Unit Test Results

40 tests  +5   40 ✔️ +5   0s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ±0 

Results for commit 90ac841. ± Comparison against base commit 8d75293.

♻️ This comment has been updated with latest results.

@Chaseshak Chaseshak force-pushed the update-config-command-with-features-from-valet branch from a2715f4 to 3e80469 Compare April 4, 2023 22:11
@Chaseshak Chaseshak marked this pull request as ready for review April 4, 2023 22:13
@Chaseshak Chaseshak requested a review from a team as a code owner April 4, 2023 22:13
@Chaseshak Chaseshak requested a review from ethanis April 4, 2023 22:14
Copy link
Member

@ethanis ethanis left a comment

Choose a reason for hiding this comment

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

Looking good!

$ dotnet run --project src/ActionsImporter/ActionsImporter.csproj -- configure --optional-features
✔ Which features would you like to configure?: actions/cache, reusable-workflows
✔ actions/cache (enabled): Disable
✔ reusable-workflows (enabled): Disable
Environment variables successfully updated.

src/ActionsImporter/Commands/Configure.cs Outdated Show resolved Hide resolved
src/ActionsImporter/Commands/Configure.cs Outdated Show resolved Hide resolved
src/ActionsImporter/Commands/ListFeatures.cs Show resolved Hide resolved
src/ActionsImporter/Models/Feature.cs Outdated Show resolved Hide resolved
src/ActionsImporter.UnitTests/Models/FeatureTests.cs Outdated Show resolved Hide resolved
src/ActionsImporter.UnitTests/Models/FeatureTests.cs Outdated Show resolved Hide resolved
src/ActionsImporter/Commands/Configure.cs Show resolved Hide resolved
src/ActionsImporter/Services/ConfigurationService.cs Outdated Show resolved Hide resolved
src/ActionsImporter/Services/ConfigurationService.cs Outdated Show resolved Hide resolved
src/ActionsImporter/Services/ConfigurationService.cs Outdated Show resolved Hide resolved
src/ActionsImporter/Services/DockerService.cs Show resolved Hide resolved
@Chaseshak Chaseshak force-pushed the update-config-command-with-features-from-valet branch from 7f15088 to 90ac841 Compare April 5, 2023 21:19
Copy link
Member

@ethanis ethanis left a comment

Choose a reason for hiding this comment

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

🎏

@Chaseshak Chaseshak merged commit e3c8e96 into main Apr 5, 2023
5 checks passed
@Chaseshak Chaseshak deleted the update-config-command-with-features-from-valet branch April 5, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants