Pipelines can be configured either through the UI or using a yaml file in the repository, i.e. .rancher-pipeline.yml or .rancher-pipeline.yaml.

    In the pipeline configuration reference, we provide examples of how to configure each feature using the Rancher UI or using YAML configuration.

    Below is a full example rancher-pipeline.yml for those who want to jump right in.

    1. # example
    2. stages:
    3. - name: Build something
    4. # Conditions for stages
    5. when:
    6. branch: master
    7. event: [ push, pull_request ]
    8. # Multiple steps run concurrently
    9. steps:
    10. - runScriptConfig:
    11. image: busybox
    12. shellScript: echo ${FIRST_KEY} && echo ${ALIAS_ENV}
    13. # Set environment variables in container for the step
    14. env:
    15. FIRST_KEY: VALUE
    16. SECOND_KEY: VALUE2
    17. # Set environment variables from project secrets
    18. envFrom:
    19. - sourceName: my-secret
    20. sourceKey: secret-key
    21. targetKey: ALIAS_ENV
    22. - runScriptConfig:
    23. image: busybox
    24. shellScript: date -R
    25. # Conditions for steps
    26. when:
    27. branch: [ master, dev ]
    28. event: push
    29. - name: Publish my image
    30. steps:
    31. - publishImageConfig:
    32. dockerfilePath: ./Dockerfile
    33. buildContext: .
    34. tag: rancher/rancher:v2.0.0
    35. # Optionally push to remote registry
    36. pushRemote: true
    37. registry: reg.example.com
    38. - name: Deploy some workloads
    39. steps:
    40. - applyYamlConfig:
    41. path: ./deployment.yaml
    42. # branch conditions for the pipeline
    43. branch:
    44. include: [ master, feature/*]
    45. exclude: [ dev ]
    46. # timeout in minutes
    47. timeout: 30
    48. notification:
    49. recipients:
    50. - # Recipient
    51. recipient: "#mychannel"
    52. # ID of Notifier
    53. notifier: "c-wdcsr:n-c9pg7"
    54. - recipient: "test@example.com"
    55. notifier: "c-wdcsr:n-lkrhd"
    56. # Select which statuses you want the notification to be sent
    57. condition: ["Failed", "Success", "Changed"]
    58. # Ability to override the default message (Optional)
    59. message: "my-message"