patch_jobs.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.osconfig.agentendpoint.v1;
  16. option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1;agentendpoint";
  17. option java_outer_classname = "PatchJobs";
  18. option java_package = "com.google.cloud.osconfig.agentendpoint.v1";
  19. // Patch configuration specifications. Contains details on how to
  20. // apply patches to a VM instance.
  21. message PatchConfig {
  22. // Post-patch reboot settings.
  23. enum RebootConfig {
  24. // The default behavior is DEFAULT.
  25. REBOOT_CONFIG_UNSPECIFIED = 0;
  26. // The agent decides if a reboot is necessary by checking
  27. // signals such as registry keys on Windows or `/var/run/reboot-required` on
  28. // APT based systems. On RPM based systems, a set of core system package
  29. // install times are compared with system boot time.
  30. DEFAULT = 1;
  31. // Always reboot the machine after the update completes.
  32. ALWAYS = 2;
  33. // Never reboot the machine after the update completes.
  34. NEVER = 3;
  35. }
  36. // Post-patch reboot settings.
  37. RebootConfig reboot_config = 1;
  38. // Retry strategy can be defined to have the agent retry patching
  39. // during the window if patching fails. If omitted, the agent will use its
  40. // default retry strategy.
  41. RetryStrategy retry_strategy = 2;
  42. // Apt update settings. Use this override the default apt patch rules.
  43. AptSettings apt = 3;
  44. // Yum update settings. Use this override the default yum patch rules.
  45. YumSettings yum = 4;
  46. // Goo update settings. Use this override the default goo patch rules.
  47. GooSettings goo = 5;
  48. // Zypper update settings. Use this override the default zypper patch rules.
  49. ZypperSettings zypper = 6;
  50. // Windows update settings. Use this override the default windows patch rules.
  51. WindowsUpdateSettings windows_update = 7;
  52. // The ExecStep to run before the patch update.
  53. ExecStep pre_step = 8;
  54. // The ExecStep to run after the patch update.
  55. ExecStep post_step = 9;
  56. // Allows the patch job to run on Managed instance groups (MIGs).
  57. bool mig_instances_allowed = 10;
  58. }
  59. // Apt patching will be performed by executing `apt-get update && apt-get
  60. // upgrade`. Additional options can be set to control how this is executed.
  61. message AptSettings {
  62. // Apt patch type.
  63. enum Type {
  64. // By default, upgrade will be performed.
  65. TYPE_UNSPECIFIED = 0;
  66. // Runs `apt-get dist-upgrade`.
  67. DIST = 1;
  68. // Runs `apt-get upgrade`.
  69. UPGRADE = 2;
  70. }
  71. // By changing the type to DIST, the patching will be performed
  72. // using `apt-get dist-upgrade` instead.
  73. Type type = 1;
  74. // List of packages to exclude from update.
  75. repeated string excludes = 2;
  76. // An exclusive list of packages to be updated. These are the only packages
  77. // that will be updated. If these packages are not installed, they will be
  78. // ignored. This field cannot be specified with any other patch configuration
  79. // fields.
  80. repeated string exclusive_packages = 3;
  81. }
  82. // Yum patching will be performed by executing `yum update`. Additional options
  83. // can be set to control how this is executed.
  84. //
  85. // Note that not all settings are supported on all platforms.
  86. message YumSettings {
  87. // Adds the `--security` flag to `yum update`. Not supported on
  88. // all platforms.
  89. bool security = 1;
  90. // Will cause patch to run `yum update-minimal` instead.
  91. bool minimal = 2;
  92. // List of packages to exclude from update. These packages will be excluded by
  93. // using the yum `--exclude` flag.
  94. repeated string excludes = 3;
  95. // An exclusive list of packages to be updated. These are the only packages
  96. // that will be updated. If these packages are not installed, they will be
  97. // ignored. This field must not be specified with any other patch
  98. // configuration fields.
  99. repeated string exclusive_packages = 4;
  100. }
  101. // Googet patching is performed by running `googet update`.
  102. message GooSettings {
  103. }
  104. // Zypper patching is performed by running `zypper patch`.
  105. // See also https://en.opensuse.org/SDB:Zypper_manual.
  106. message ZypperSettings {
  107. // Adds the `--with-optional` flag to `zypper patch`.
  108. bool with_optional = 1;
  109. // Adds the `--with-update` flag, to `zypper patch`.
  110. bool with_update = 2;
  111. // Install only patches with these categories.
  112. // Common categories include security, recommended, and feature.
  113. repeated string categories = 3;
  114. // Install only patches with these severities.
  115. // Common severities include critical, important, moderate, and low.
  116. repeated string severities = 4;
  117. // List of patches to exclude from update.
  118. repeated string excludes = 5;
  119. // An exclusive list of patches to be updated. These are the only patches
  120. // that will be installed using 'zypper patch patch:<patch_name>' command.
  121. // This field must not be used with any other patch configuration fields.
  122. repeated string exclusive_patches = 6;
  123. }
  124. // Windows patching is performed using the Windows Update Agent.
  125. message WindowsUpdateSettings {
  126. // Microsoft Windows update classifications as defined in
  127. // [1]
  128. // https://support.microsoft.com/en-us/help/824684/description-of-the-standard-terminology-that-is-used-to-describe-micro
  129. enum Classification {
  130. // Invalid. If classifications are included, they must be specified.
  131. CLASSIFICATION_UNSPECIFIED = 0;
  132. // "A widely released fix for a specific problem that addresses a critical,
  133. // non-security-related bug." [1]
  134. CRITICAL = 1;
  135. // "A widely released fix for a product-specific, security-related
  136. // vulnerability. Security vulnerabilities are rated by their severity. The
  137. // severity rating is indicated in the Microsoft security bulletin as
  138. // critical, important, moderate, or low." [1]
  139. SECURITY = 2;
  140. // "A widely released and frequent software update that contains additions
  141. // to a product’s definition database. Definition databases are often used
  142. // to detect objects that have specific attributes, such as malicious code,
  143. // phishing websites, or junk mail." [1]
  144. DEFINITION = 3;
  145. // "Software that controls the input and output of a device." [1]
  146. DRIVER = 4;
  147. // "New product functionality that is first distributed outside the context
  148. // of a product release and that is typically included in the next full
  149. // product release." [1]
  150. FEATURE_PACK = 5;
  151. // "A tested, cumulative set of all hotfixes, security updates, critical
  152. // updates, and updates. Additionally, service packs may contain additional
  153. // fixes for problems that are found internally since the release of the
  154. // product. Service packs my also contain a limited number of
  155. // customer-requested design changes or features." [1]
  156. SERVICE_PACK = 6;
  157. // "A utility or feature that helps complete a task or set of tasks." [1]
  158. TOOL = 7;
  159. // "A tested, cumulative set of hotfixes, security updates, critical
  160. // updates, and updates that are packaged together for easy deployment. A
  161. // rollup generally targets a specific area, such as security, or a
  162. // component of a product, such as Internet Information Services (IIS)." [1]
  163. UPDATE_ROLLUP = 8;
  164. // "A widely released fix for a specific problem. An update addresses a
  165. // noncritical, non-security-related bug." [1]
  166. UPDATE = 9;
  167. }
  168. // Only apply updates of these windows update classifications. If empty, all
  169. // updates will be applied.
  170. repeated Classification classifications = 1;
  171. // List of KBs to exclude from update.
  172. repeated string excludes = 2;
  173. // An exclusive list of kbs to be updated. These are the only patches
  174. // that will be updated. This field must not be used with other
  175. // patch configurations.
  176. repeated string exclusive_patches = 3;
  177. }
  178. // The strategy for retrying failed patches during the patch window.
  179. message RetryStrategy {
  180. // If true, the agent will continue to try and patch until the window has
  181. // ended.
  182. bool enabled = 1;
  183. }
  184. // A step that runs an executable for a PatchJob.
  185. message ExecStep {
  186. // The ExecStepConfig for all Linux VMs targeted by the PatchJob.
  187. ExecStepConfig linux_exec_step_config = 1;
  188. // The ExecStepConfig for all Windows VMs targeted by the PatchJob.
  189. ExecStepConfig windows_exec_step_config = 2;
  190. }
  191. // Common configurations for an ExecStep.
  192. message ExecStepConfig {
  193. // The interpreter used to execute the a file.
  194. enum Interpreter {
  195. // Deprecated, defaults to NONE for compatibility reasons.
  196. INTERPRETER_UNSPECIFIED = 0;
  197. // Invalid for a Windows ExecStepConfig. For a Linux ExecStepConfig, the
  198. // interpreter will be parsed from the shebang line of the script if
  199. // unspecified.
  200. NONE = 3;
  201. // Indicates that the script will be run with /bin/sh on Linux and cmd
  202. // on windows.
  203. SHELL = 1;
  204. // Indicates that the file will be run with PowerShell.
  205. POWERSHELL = 2;
  206. }
  207. // Location of the executable.
  208. oneof executable {
  209. // An absolute path to the executable on the VM.
  210. string local_path = 1;
  211. // A GCS object containing the executable.
  212. GcsObject gcs_object = 2;
  213. }
  214. // Defaults to [0]. A list of possible return values that the
  215. // execution can return to indicate a success.
  216. repeated int32 allowed_success_codes = 3;
  217. // The script interpreter to use to run the script. If no interpreter is
  218. // specified the script will be executed directly, which will likely
  219. // only succeed for scripts with shebang lines.
  220. // [Wikipedia shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)).
  221. Interpreter interpreter = 4;
  222. }
  223. // GCS object representation.
  224. message GcsObject {
  225. // Bucket of the GCS object.
  226. string bucket = 1;
  227. // Name of the GCS object.
  228. string object = 2;
  229. // Generation number of the GCS object. This is used to ensure that the
  230. // ExecStep specified by this PatchJob does not change.
  231. int64 generation_number = 3;
  232. }