Directory Structure of Source Code
The essence of source is a code repository. To make it easier for project members to understand and maintain the source code, it is recommended that you organize custom task, stage, and template definition files into logical directories according to a certain structure. For example, you can split tasks, stages, and templates into different modules to simplify the management. You can also use clear naming conventions to improve file readability and consistency, reducing errors and confusion.
Recommended Directory Structure
-
The first level is the resource type, such as task, stage, pipeline, etc.
-
The second level is the resource name. It is recommended to have the same name as the specific task, stage, or template.
-
The third level is the resource version. When encountering incompatible updates, a new version needs to be added.
-
The fourth level is the specific definition and documentation.
-
If there are usage examples for the resource, they can be placed in the samples directory.
-
If there are test cases for the resource, they can be placed in the test directory.
-
Directory Structure Example
.
├── pipeline - Pipeline template type
│ └── buildpacks - A template
│ └── 0.1
│ └── buildpacks.yaml - Definition file for templates
└── task - Task Type
├── argocd - A task
│ ├── 0.1
│ │ ├── OWNERS
│ │ ├── README.md
│ │ ├── argocd.yaml - Task definition file
│ │ └── samples
│ │ └── deploy-to-k8s.yaml
│ └── 0.2
└── golang-build
├── 0.1
│ ├── README.md
│ ├── golang-build.yaml
│ └── samples
│ └── golang-build.yaml
├── OWNERS
└── README.md