rbm_steps.asc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. rbm_steps(7)
  2. ============
  3. NAME
  4. ----
  5. rbm_steps - rbm steps configuration
  6. DESCRIPTION
  7. -----------
  8. When you define some project, you can have more than one script
  9. definition, for the different steps of the build process (build, test,
  10. publish, etc ...), or for different types of packaging (rpm, deb, etc
  11. ...).
  12. All the configuration options are shared between all those scripts.
  13. However, in some cases you may want some option to have a different value
  14. depending of the script that we are running. The name of the script we
  15. are going to be running is called the 'step', and it is possible to have
  16. different option values depending on the current step.
  17. CONFIGURATION
  18. -------------
  19. The first way to have a different option value depending on the curernt
  20. step is to use the IF/ELSE template directives and the +step+ option.
  21. The +step+ option contains the name of the current step. For instance
  22. if you want to use a different git tag or branch for rpm and debian
  23. packages, you could do:
  24. ----
  25. git_hash: |
  26. [% IF c('step') == 'rpm' -%]
  27. dev-rpm
  28. [%- ELSIF c('step') == 'deb' -%]
  29. dev-deb
  30. [%- ELSE -%]
  31. dev
  32. [%- END -%]
  33. ----
  34. An other way to do it is to use +steps+ option. This option works in a
  35. similar way to the +targets+ option except that it contains a hash
  36. indexed by step name rather than a hash indexed by target name..
  37. The steps configuration can be defined in any of the configuration files,
  38. using the +steps+ option. This option is an hash, with the steps names
  39. as keys, and as value an other hash containing the options to be used
  40. for this step.
  41. A project which should use a different git tag or branch depending on
  42. whether we are building an rpm or deb package could be defined in the following way:
  43. ----
  44. git_hash: dev
  45. steps:
  46. rpm:
  47. git_hash: dev-rpm
  48. deb:
  49. git_hash: dev-deb
  50. ----
  51. It is also possible to combine step based configuration with target
  52. configuration. For instance you could do:
  53. ----
  54. targets:
  55. stable:
  56. git_hash: stable
  57. dev:
  58. git_hash: dev
  59. steps:
  60. rpm:
  61. targets:
  62. stable:
  63. git_hash: stable-rpm
  64. dev:
  65. git_hash: dev-rpm
  66. deb:
  67. targets:
  68. stable:
  69. git_hash: stable-deb
  70. dev:
  71. git_hash: dev-deb
  72. ----
  73. If the value of a step is not a hash containing options, but a string,
  74. then this name is used as step name. This can be used to alias a step
  75. configuration to an other step. For instance you usually want to use
  76. the same options for the rpm and srpm scripts. The default configuration
  77. includes the following steps aliases:
  78. - srpm: rpm
  79. - deb-src: deb
  80. PRE AND POST SCRIPTS
  81. --------------------
  82. Before starting some build script, you often need to prepare the host
  83. for the build. Usually this means installing some dependencies required
  84. for the build. After the build finished, you might want to remove those
  85. dependencies that have been added.
  86. This can be done using the +pre+ and +post+ options. Those options
  87. contains a script that is run as root before and after the build. Those
  88. options can be defined globally, or per step.
  89. The +pre+ and +post+ scripts are expected to be run as root. To do that,
  90. they are run using the +suexec+ option if run locally, or if run using
  91. the +remote_exec+ option the +exec_as_root+ option is set to true. The
  92. +suexec+ option takes the +suexec_cmd+ option and runs it as root. By
  93. default, the +suexec+ option uses sudo.
  94. SEE ALSO
  95. --------
  96. link:rbm.html[rbm(1)],
  97. link:rbm_config.html[rbm_config(7)]