Skip to content

chore(internal/provider): refactor cached_image_resource #46

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

Merged
merged 9 commits into from
Sep 4, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Sep 4, 2024

Addresses some non-blocking comments from #44:

  • Extracts some of the functions in cached_image_resource.go to separate internal packages tfutil and imgutil.
  • Some other functions are extracted to helpers.go.
  • Extracts non-overridable flags to a package-level variable.
  • Pre-allocates some slices where possible.

@johnstcn johnstcn self-assigned this Sep 4, 2024
Comment on lines -287 to -289
"CODER_AGENT_SUBSYSTEM": "one,two",
"CODER_AGENT_TOKEN": "string",
"CODER_AGENT_URL": "string",
Copy link
Member Author

Choose a reason for hiding this comment

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

These can simply be handled via extra_env. We don't need to test for them here.

Comment on lines +112 to +113
"CODER_AGENT_TOKEN", "some-token",
"CODER_AGENT_URL", "https://coder.example.com",
Copy link
Member Author

Choose a reason for hiding this comment

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

making sure the coder args still make their way into computed env.

Copy link
Member

@mafredri mafredri 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 nits but otherwise looks good 👍🏻

val = strings.Join(sa.GetSlice(), ",")
} else {
val = opt.Value.String()
}
Copy link
Member

Choose a reason for hiding this comment

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

What separation does this use by default? I had assumed it would already be comma separated and we can just .String() 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

It uses CSV format by default. Calling the String() method didn't work for me. This may be a bug in coder/serpent but I haven't looked too much closer.

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to lookup the inputs that you had when it failed? I'd be happy to file the issue upstream, if there is one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll try to create a minimal example and file a PR in coder/serpent.

@johnstcn johnstcn requested a review from mafredri September 4, 2024 13:37
@johnstcn johnstcn merged commit 482a446 into main Sep 4, 2024
14 checks passed
@johnstcn johnstcn deleted the cj/refactor/cached-image-resource branch September 4, 2024 15:29
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.

2 participants