component.yaml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. name: "MyCustomLinuxComponent"
  2. description: "A custom Image Builder component for Linux with shell commands."
  3. schemaVersion: 1.0
  4. phases:
  5. - name: build
  6. steps:
  7. - name: InstallPackages
  8. action: ExecuteBash
  9. inputs:
  10. commands:
  11. - "sudo yum update -y"
  12. - "sudo yum install -y httpd"
  13. - "sudo systemctl enable httpd"
  14. - "sudo systemctl start httpd"
  15. onFailure: "Abort" # Option to abort the build on failure
  16. - name: ConfigureWebServer
  17. action: ExecuteBash
  18. inputs:
  19. commands:
  20. - "echo 'Hello from Image Builder!' | sudo tee /var/www/html/index.html"
  21. onFailure: "Continue" # Option to continue even if this step fails
  22. - name: test
  23. steps:
  24. - name: VerifyWebServer
  25. action: ExecuteBash
  26. inputs:
  27. commands:
  28. - "curl -s http://localhost | grep 'Hello from Image Builder!'"
  29. onFailure: "Abort"
  30. - name: CheckServiceStatus
  31. action: ExecuteBash
  32. inputs:
  33. commands:
  34. - "sudo systemctl is-active httpd"
  35. onFailure: "Abort"