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

Ability to select images based on OS_FAMILY and select lastest version

    XMLWordPrintable

    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

            digitalirony Eric Blackwell created issue -
            digitalirony Eric Blackwell made changes -
            Field Original Value New Value
            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. 

            Thanks! 
            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 it myself. But I think if you just make the current "image name" and add "os family" parameter to the form, and make them an OR or use radio boxes, then take the input from os family, 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! 
            digitalirony Eric Blackwell made changes -
            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 it myself. But I think if you just make the current "image name" and add "os family" parameter to the form, and make them an OR or use radio boxes, then take the input from os family, 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! 
            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 them 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 have 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! 
            digitalirony Eric Blackwell made changes -
            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 them 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 have 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! 
            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 have 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! 
            digitalirony Eric Blackwell made changes -
            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 have 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! 
            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! 
            Hide
            ingwar Karol Lassak added a comment -

            This functionality can now be achieved via templates which was added in 1.8.0.

            Rachel Yen I think that this issue can be closed now..

            Show
            ingwar Karol Lassak added a comment - This functionality can now be achieved via templates which was added in 1.8.0. Rachel Yen  I think that this issue can be closed now..
            ingwar Karol Lassak made changes -
            Link This issue is duplicated by JENKINS-52651 [ JENKINS-52651 ]
            Hide
            zombiemoose Rachel Yen added a comment -

            Hmm, it sounds like new images are being generated whenever you run a new job? Karol Lassak I'm not sure we solve that with templates since we would still be creating a new template for each new image, no?

             

            Eric Blackwell can you please verify this? You are generating a new image constantly and want to filter by image family in the configuration for the image you're going to launch your agent with?

            Show
            zombiemoose Rachel Yen added a comment - Hmm, it sounds like new images are being generated whenever you run a new job? Karol Lassak I'm not sure we solve that with templates since we would still be creating a new template for each new image, no?   Eric Blackwell can you please verify this? You are generating a new image constantly and want to filter by image family in the configuration for the image you're going to launch your agent with?
            Hide
            digitalirony Eric Blackwell added a comment - - edited

            Yes, I am running a job that uses packer.io to build GCE images from a 'recipe' I maintain in a git repo. 

            I eventually want to be able to use my script to build several different flavors of my 'golden image', and tag them all using the os_family.

            Then I can have This plugin always use the latest build automatically from that family. This way I am not constantly having to adjust which image jenkins uses for the slaves/agents. And I can just run my golden image builds, and know that jenkins will always pull the latest from the family specified if that makes sense?

             

            And, no templates is not what I am looking for. Rachel Yen

            Show
            digitalirony Eric Blackwell added a comment - - edited Yes, I am running a job that uses packer.io to build GCE images from a 'recipe' I maintain in a git repo.  I eventually want to be able to use my script to build several different flavors of my 'golden image', and tag them all using the os_family. Then I can have This plugin always use the latest build automatically from that family. This way I am not constantly having to adjust which image jenkins uses for the slaves/agents. And I can just run my golden image builds, and know that jenkins will always pull the latest from the family specified if that makes sense?   And, no templates is not what I am looking for. Rachel Yen
            Hide
            zombiemoose Rachel Yen added a comment -

            Ok, I see. I'm not sure how popular this use case would be, and that would affect how I prioritize this feature/if we do implement this feature.

            Show
            zombiemoose Rachel Yen added a comment - Ok, I see. I'm not sure how popular this use case would be, and that would affect how I prioritize this feature/if we do implement this feature.
            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.
            zombiemoose Rachel Yen made changes -
            Assignee Evan Brown [ evanbrown ] Rachel Yen [ zombiemoose ]
            zombiemoose Rachel Yen made changes -
            Released As https://github.com/jenkinsci/google-compute-engine-plugin/releases/tag/google-compute-engine-1.0.9
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]

              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: