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

optionally allow image resolution by name #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hsitter
Copy link
Contributor

@hsitter hsitter commented Aug 12, 2021

this enables a use case where one would continuously update the image
and re-create it as a new snapshot, causing the id to constantly change
but the name to be persistent. since ordinarily name is a really poor
way to resolve images, in particular also because we always need to talk
to the api to get the actual image, this entire feature is limited to
user images rather than all images. specifically this also lessens the
API work we need to do.

the template config has a new checkbox to enable this feature, which
then prompts a reload of the image combobox to only include user images
(and at the same time the values in the model are changed from slugOrIds
to names)

at provisioning time we then need to pass a bit more context along so as
to resolve accordingly in newImage()

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

this enables a use case where one would continuously update the image
and re-create it as a new snapshot, causing the id to constantly change
but the name to be persistent. since ordinarily name is a really poor
way to resolve images, in particular also because we always need to talk
to the api to get the actual image, this entire feature is limited to
user images rather than all images. specifically this also lessens the
API work we need to do.

the template config has a new checkbox to enable this feature, which
then prompts a reload of the image combobox to only include user images
(and at the same time the values in the model are changed from slugOrIds
to names)

at provisioning time we then need to pass a bit more context along so as
to resolve accordingly in newImage()
*/
@DataBoundConstructor
public SlaveTemplate(String name, String imageId, String sizeId, String regionId, String username, String workspacePath,
Integer sshPort, Boolean setupPrivateNetworking, String idleTerminationInMinutes, String numExecutors, String labelString,
Boolean labellessJobsAllowed, String instanceCap, Boolean installMonitoring, String tags,
String userData, String initScript) {
String userData, String initScript, Boolean imageByName) {
Copy link
Member

Choose a reason for hiding this comment

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

So I'm doing a quick pass on my phone. Is this actually used in the constructor or just setting?

I think changing the constructor can break loading older configs. I'll have to check. I think in general a @DataBoundSetter is safer. It might only matter if your removing fields.

I'll do a trial run with existing config and jcasc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hadn't given it much thought TBH. Having a constructor that accepts all but one member feels a bit iffy though, so does having imageByName not be final when imageId is. That said, I'm not a fan of ctors with a million arguments of none-descriptive type anyway ^^

So, I drop the ctor argument and replace it with setImageByName(Boolean imageByName)?

@halkeye
Copy link
Member

halkeye commented Aug 15, 2021

I really like this. I need to review the code but love the idea. I mostly selfishly want to make sure nothing brwks my installs

@halkeye halkeye added the feature A PR that adds a feature - used by Release Drafter label Sep 5, 2022
@oneingan
Copy link

oneingan commented Aug 8, 2023

any chance to get this merged??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A PR that adds a feature - used by Release Drafter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants