-
Notifications
You must be signed in to change notification settings - Fork 887
Each-time build parameters #6828
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
Comments
I guess that we have a couple of side comments to address first:
Similar concerns can be applied to CLI, but I guess that we can find answers based on the site/UI requirements. EDIT: I can start looking into this, and pair with @BrunoQuaresma on frontend changes, but it will defer works around the operability milestone. |
My thinking was that these parameters would automatically return to the default value after a successful workspace startup. |
@aaronlehmann Could you please elaborate a bit more about your use-cases? Ben mentioned some of them in the issue description:
I'm afraid that one-time pass might be a bit confusing for regular users in terms of debugging. For instance: "I retried the failed build a few times, but I don't know what parameters I passed."
Is there any condition that justifies the need for "rebuild"? Maybe it can be "figured out" without prompting the end-user.
This is a common problem for integrating apps with Auth. For instance, in Github you can just create a Personal Access Token, that is limited to the single application and enables only relevant permissions. Users don't have to deal with OTP. Did you review if this option is available? |
My use case is "force a rebuild/pull of the underlying container image", not the one-time token.
So far this is based on heuristics, but sometimes base images will change and users will want to pick up those updates, so I want to give them an option to force a rebuild. I don't think the rebuild should be automatic whenever a base image changes, because it can slow down the startup process considerably and usually isn't necessary. |
I understand your use case, but it will add unnecessary randomness to the solution. Template revisions are versioned, by ID and name. From the support perspective, the safest option would be to hardlink the Docker image under the hood with a template version. Users could decide if they prefer to stick to the older revision or whether they should update their templates. If you allow users to force-update their workspace internals, you may deal with random workspace failures reported for the same template version. Let me know your thoughts. |
In my use case, container images are not tied to a tenplate version. There is a single, shared template and users specify a source repository as a parameter. Repositories have instructions for building a container image specific to that repository (in a A normal parameter doesn't work well for this because it means rebuilds will be forced on every restart goinfmg forward, until the user changes the parameter back. Another possible way to address this would be to give the TF provider a way to change the parameter value back once it's done with the forced rebuild. |
Yes, it is a tricky challenge. I'm not sure if it isn't more convenient to just stick to the latest version, but "cache it". Building Docker images in workspaces can be error-prone (mainly due to transient network issues), and takes time if the manifest is long. I admit that I don't have an insight into your Side note: |
Note that we aren't building these images in workspaces. They are built by a build service that supports caching.
This kind of prebuilding is on our roadmap but I see it as a bit tangential to the use case of "give me a fresh image right now". The asynchronicity could be a problem: CI may not have finished pushing a build for the latest commit by the time a workspace is started. Something like this might work if wrapped by a script that starts a build on the build server, waits for it to finish, and updates the workspace to use the newly-pushed image. The script would need to be able to update a workspace parameter containing the image digest, and ideally this parameter wouldn't be exposed to the user in the UI (to limit clutter and confusion). A downside of going this route is that users need to run a script instead of clicking a "rebuild image now" button or checkbox in the UI (which might potentially be possible with one-time parameters?) Basically, the behavior that I'm looking for is:
In both cases, the "rebuild now" setting shouldn't be persistent. |
Battle plan:
|
I'm curious what Thinking about this some more, I wonder if I can script the behavior I want using the Coder API by clearing my |
data "coder_parameter" "force_rebuild" {
name = "force_rebuild"
display_name = "Force rebuild image"
type = "bool"
description = "Rebuild the Docker image rather than use the cached one."
mutable = true
prompt_user = "always"
} prompt_user Re-prompt the user for the parameter value.
We need to place it somewhere in the UI. As you can see in the issue description, it would be similar to running a Github workflow, which requires one more button click. Is it still aligned with your expectations? If not, would you mind elaborating a bit more on the UI/UX side? |
The idea of an extra click to request a container rebuild (in this example) makes sense, but this makes it sound like the extra prompt would happen every time the user starts a workspace:
My thinking was that in the rare cases where users want to set this parameter, they would click through to the "parameters" page in the UI and set it there (or, equivalently, run a script that uses the Coder API or CLI to set the parameter). |
That is correct.
I'm not sure if this approach is super-efficient and intuitive. I'd rather set a transient build flag before starting the workspace (click Maybe we could add an extra menu option, |
Adding a "Start with options" menu item that goes to the parameters page (or a new "Build options" tab) is a good solution. I agree that adding a pop-up dialog for every build would be annoying for users, especially if 90% of the time they want to do a "normal" build using the default value of the "each time parameters." re. the syntax: What do you think about One other option for syntax is data "coder_parameter" {
# ...
persistence = <ephemeral/immutable/mutable> and gradually warn/deprecate the |
I also like the idea of "Start with options".
|
I think we can do something like this in the UI:
Thoughts? @aaronlehmann I would appreciate your feedback. |
I love it! Thanks for working with me on this. |
There are some use cases where a user may want to apply a parameter value for a single workspace build, but not persist that value for feature runs.
This kind of reminds me of build arguments or inputs for workflow_dispatch in GitHub actions
The text was updated successfully, but these errors were encountered: