Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

fix: credential secrets: avoid race condition when prompting user (#2410) #2422

Merged

Conversation

g-linville
Copy link
Contributor

for #2410

There is a race condition that occurs only when deploying an acorn to the SaaS that defines a credential secret. The user will be prompted to enter credentials multiple times because the app keeps changing upstream. If we wait for a little bit (until all containers are marked as Defined), the race condition doesn't occur, and the user is only prompted once.

I also tested this with Acornfiles that only define this secret and a nested acorn, as well as an Acornfile that defines just the secret and nothing else, and it still works just fine.

Checklist

  • The title of this PR would make a good line in Acorn's Release Note's Changelog
  • The title of this PR ends with a link to the main issue being address in parentheses, like: This is a title (#1216). Here's an example
  • All relevant issues are referenced in the PR description. NOTE: don't use GitHub keywords that auto-close issues
  • Commits follow contributing guidance
  • Automated tests added to cover the changes. If tests couldn't be added, an explanation is provided in the Verification and Testing section
  • Changes to user-facing functionality, API, CLI, and upgrade impacts are clearly called out in PR description
  • PR has at least two approvals before merging (or a reasonable exception, like it's just a docs change)

Signed-off-by: Grant Linville <grant@acorn.io>
@g-linville g-linville merged commit 7632a3e into acorn-io:main Jan 18, 2024
4 checks passed
@g-linville g-linville deleted the fix-credential-secret-race-condition branch January 18, 2024 14:49
Copy link
Contributor

@njhale njhale left a comment

Choose a reason for hiding this comment

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

late to the party, but lgtm anyway

Comment on lines +64 to +69
err := login.Secrets(d.ctx, d.client, app)
if err != nil {
go d.Errorf(err.Error())
} else {
d.lastLogin = app.Generation
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nano-nit:

Suggested change
err := login.Secrets(d.ctx, d.client, app)
if err != nil {
go d.Errorf(err.Error())
} else {
d.lastLogin = app.Generation
}
if err := login.Secrets(d.ctx, d.client, app); err != nil {
go d.Errorf(err.Error())
} else {
d.lastLogin = app.Generation
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants