You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

  1. package build
  2. // Phase enum type
  3. type Phase int
  4. // Distinct build phases that each compiler implementation should pass to
  5. // PhaseCompileable configuration (in the order they are defined here) to
  6. // allow for dependency injection during compilation.
  7. //
  8. const (
  9. PhasePrivileged Phase = iota // first, copies/execution done as root
  10. PhasePrivilegeDropped // second, copies/execution done as unprivileged user from here on
  11. PhasePreInstall // third, before application files and artifacts are copied
  12. PhaseInstall // fourth, application files and artifacts are copied
  13. PhasePostInstall // fifth, after application files and artifacts are copied
  14. )
  15. // PhaseCompileable defines and interface that all configuration types should
  16. // implement if they want to inject build instructions into any of the defined
  17. // build phases.
  18. //
  19. type PhaseCompileable interface {
  20. InstructionsForPhase(phase Phase) []Instruction
  21. }
  22. // Phases returns all build phases in the order to be compiled.
  23. //
  24. func Phases() []Phase {
  25. return []Phase{
  26. PhasePrivileged,
  27. PhasePrivilegeDropped,
  28. PhasePreInstall,
  29. PhaseInstall,
  30. PhasePostInstall,
  31. }
  32. }