You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 12
Next »
- Build Workflow example
- TODO: Make a flow chart ppt when done creating
- Overall plan: runner checks out repo to /sdf/group/ad/eed/ad-build/<user>/ → runners request to backend build cluster to start new build container -> builder pod starts a new container on our ad-build cluster -> write log to database
- Steps broken down:
Runners request to backend build cluster, uses a rest api to send a POST request to 'build' endpoint with data like this:
curl -X POST \
'https://accel-webapp-dev.slac.stanford.edu/api/cbs/v1/component/build' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"organization": "str",
"componentName": "str",
"branchName": "str",
"actionUser": "str"
}'
- Backend builder pod talks to component database, grabs the build environment based off the organization, componentName and branchName
Backend builder pod then starts the build environment using build-deployment.yml with parameters (componentName, branchName, imageName, actionUser, buildInstructions)
- Use Declarative Management of Kubernetes Objects Using Kustomize | Kubernetes to configure the build-job.yml for the component
- build-job.yml will be a job with a volumeMount to s3df-dev-container-ad-group, and template parameters to label the container (componentName-branchName), and provide image name, and command to start build (buildInstructions)
- backend builder pod then logs to branches_in_development.
- backend builder pod sends the name of the build container thats running, back to runner,
- runners last job is to print the filepath to where the container is being built, and othe useful info like 'status'
- if triggered by action (push to main/ pull request), then we want to provide the Report to user which can include
- filepath to user of the build output
- status (successful built / fail).
- time duration
- LAST STEP: have the build container push its artifact somewhere where a test container can download the artifact then do its testing.
Backend meeting with Claudio/Jerry/Patrick 5-28-24
- info
core-build-system notes
- Example: Adding fields to the component schema, as well as the api. What classes to change:
- Rest API:
- controller/ComponentController.java → @RestController()
- This is where you define the api commands
- @PostMapping, @GetMapping, @DeleteMapping
- mapper/ComponentMapper.java → @Mapper
- This is only made when you have a field that has fields of its own, and you need to map it to main schema
- Service:
- This is the backend logic that the rest api commands call
- service/ComponentService.java → @Service()
- ex: create() - check no conflict, check dependencies, then create the component and save to mongodb, then return the created component id back to user
- Repository:
- This is backend logic that extends MongoRepository for functions regarding the repository like 'boolean existsByName(string name)"
- repository/ComponentRepository.java
- Schema:
- model/Component.java
- dto/ComponentDTO.java → @Schema()
- This is where you define the db document schema
- dto/newComponentDTO.java →@Schema()
- What's the difference between componentDTO and newComponentDTO?
- Exception Handling:
- exception/ComponentAlreadyExists → @ResponseStatus
- exception/ComponentNotFound→ @ResponseStatus