Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54418

Ability to select images based on OS_FAMILY and select lastest version

    Details

    • Similar Issues:

      Description

      I have a jenkins job that uses packer to generate my GCE images on demand, so that we can maintain our build and dev environments in version control. When building this way, we can set an "image_family" parameter to a custom string, and name the image with version string.

       

      It would be great if, in the configuration there was an option to select the image via 'OS Family', and always use the latest version. This way, we don't have to constantly adjust the image used, and it can be picked up dynamically. 

       

      EDIT
      After a bit of research I found that what you would want to use is  compute.Images.GetFromFamily. I do not know java very well, and I wouldn't know where to begin or I would do this myself. But I think if you just copy the current "image name" and add "os family" parameter to the form, and make it so one of them is required, or use radio boxes to select between them, then take the input from os family, save it in the settings db.

      Then when an instance is created, check if this setting is in the DB or not, and if it is, then call the compute.Images.GetFromFamily on it, and pass it to the create instance function. it could work automatically, as the documentation says it will already return the latest.

      Here is the documentation:
      https://developers.google.com/resources/api-libraries/documentation/compute/v1/java/latest/com/google/api/services/compute/Compute.Images.GetFromFamily.html

      Thanks! 

        Attachments

          Issue Links

            Activity

            Hide
            digitalirony Eric Blackwell added a comment -

            I bet more people would use it if it was available. Is pretty handy.

            Show
            digitalirony Eric Blackwell added a comment - I bet more people would use it if it was available. Is pretty handy.
            Hide
            ingwar Karol Lassak added a comment -

            Eric Blackwell Rachel Yen Thats exactly what Im telling about..

            Thats was one of main reasons to add templates in our company.

             

            At template level you can choose image family instead of image instead of image itself, and every time you create new image in that family it will automatically use it.

            Show
            ingwar Karol Lassak added a comment - Eric Blackwell Rachel Yen  Thats exactly what Im telling about.. Thats was one of main reasons to add templates in our company.   At template level you can choose image family instead of image instead of image itself, and every time you create new image in that family it will automatically use it.
            Hide
            zombiemoose Rachel Yen added a comment -

            Eric Blackwell Why don't you try out the template first and let me know what you think? I just tried it out via the command line in cloud console, and it did seem to give me the latest image in my image family.

            Example:

            gcloud compute instance-templates create example-template-custom \
                --machine-type n1-standard-4 \
                --image-family jenkins-agent \
                --image-project rach-project \
                --boot-disk-size 250GB
            

             

            Karol Lassak I was trying to create a template from cloud console, but it forces you to provide an image rather than just specifying an image family, so that's interesting. Thanks for your input.

            Show
            zombiemoose Rachel Yen added a comment - Eric Blackwell Why don't you try out the template first and let me know what you think? I just tried it out via the command line in cloud console, and it did seem to give me the latest image in my image family. Example: gcloud compute instance-templates create example-template-custom \ --machine-type n1-standard-4 \ --image-family jenkins-agent \ --image-project rach-project \ --boot-disk-size 250GB   Karol Lassak I was trying to create a template from cloud console, but it forces you to provide an image rather than just specifying an image family, so that's interesting. Thanks for your input.
            Hide
            ingwar Karol Lassak added a comment - - edited

            We are using terraform + API directly to create templates (terraform and gcloud dont have such options)..

            And seems like UI have only option to set image..

            But via templates its possible to set every parameter of created machine (At least I did not found any parameter when its not possible)

            Show
            ingwar Karol Lassak added a comment - - edited We are using terraform + API directly to create templates (terraform and gcloud dont have such options).. And seems like UI have only option to set image.. But via templates its possible to set every parameter of created machine (At least I did not found any parameter when its not possible)
            Hide
            zombiemoose Rachel Yen added a comment -

            Karol Lassak Great to know. Thanks for your continued contributions! You've really helped us improve the plugin.

            Show
            zombiemoose Rachel Yen added a comment - Karol Lassak Great to know. Thanks for your continued contributions! You've really helped us improve the plugin.

              People

              • Assignee:
                zombiemoose Rachel Yen
                Reporter:
                digitalirony Eric Blackwell
              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: